@@ -6,36 +6,36 @@ import 'ast.dart';
6
6
import 'generator_tools.dart' ;
7
7
8
8
/// The internal options used by the generator.
9
- abstract class PigeonInternalOptions {
9
+ abstract class InternalOptions {
10
10
/// Constructor.
11
- const PigeonInternalOptions ();
11
+ const InternalOptions ();
12
12
}
13
13
14
14
/// An abstract base class of generators.
15
15
///
16
16
/// This provides the structure that is common across generators for different languages.
17
- abstract class Generator <PigeonInternalOptions > {
17
+ abstract class Generator <T extends InternalOptions > {
18
18
/// Constructor.
19
19
const Generator ();
20
20
21
21
/// Generates files for specified language with specified [generatorOptions]
22
22
void generate (
23
- PigeonInternalOptions generatorOptions,
23
+ T generatorOptions,
24
24
Root root,
25
25
StringSink sink, {
26
26
required String dartPackageName,
27
27
});
28
28
}
29
29
30
30
/// An abstract base class that enforces code generation across platforms.
31
- abstract class StructuredGenerator <PigeonInternalOptions >
32
- extends Generator <PigeonInternalOptions > {
31
+ abstract class StructuredGenerator <T extends InternalOptions >
32
+ extends Generator <T > {
33
33
/// Constructor.
34
34
const StructuredGenerator ();
35
35
36
36
@override
37
37
void generate (
38
- PigeonInternalOptions generatorOptions,
38
+ T generatorOptions,
39
39
Root root,
40
40
StringSink sink, {
41
41
required String dartPackageName,
@@ -126,15 +126,15 @@ abstract class StructuredGenerator<PigeonInternalOptions>
126
126
127
127
/// Adds specified headers to [indent] .
128
128
void writeFilePrologue (
129
- PigeonInternalOptions generatorOptions,
129
+ T generatorOptions,
130
130
Root root,
131
131
Indent indent, {
132
132
required String dartPackageName,
133
133
});
134
134
135
135
/// Writes specified imports to [indent] .
136
136
void writeFileImports (
137
- PigeonInternalOptions generatorOptions,
137
+ T generatorOptions,
138
138
Root root,
139
139
Indent indent, {
140
140
required String dartPackageName,
@@ -144,7 +144,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
144
144
///
145
145
/// This method is not required, and does not need to be overridden.
146
146
void writeOpenNamespace (
147
- PigeonInternalOptions generatorOptions,
147
+ T generatorOptions,
148
148
Root root,
149
149
Indent indent, {
150
150
required String dartPackageName,
@@ -154,7 +154,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
154
154
///
155
155
/// This method is not required, and does not need to be overridden.
156
156
void writeCloseNamespace (
157
- PigeonInternalOptions generatorOptions,
157
+ T generatorOptions,
158
158
Root root,
159
159
Indent indent, {
160
160
required String dartPackageName,
@@ -164,7 +164,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
164
164
///
165
165
/// This method is not required, and does not need to be overridden.
166
166
void writeGeneralUtilities (
167
- PigeonInternalOptions generatorOptions,
167
+ T generatorOptions,
168
168
Root root,
169
169
Indent indent, {
170
170
required String dartPackageName,
@@ -174,7 +174,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
174
174
///
175
175
/// Can be overridden to add extra code before/after enums.
176
176
void writeEnums (
177
- PigeonInternalOptions generatorOptions,
177
+ T generatorOptions,
178
178
Root root,
179
179
Indent indent, {
180
180
required String dartPackageName,
@@ -192,7 +192,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
192
192
193
193
/// Writes a single Enum to [indent] . This is needed in most generators.
194
194
void writeEnum (
195
- PigeonInternalOptions generatorOptions,
195
+ T generatorOptions,
196
196
Root root,
197
197
Indent indent,
198
198
Enum anEnum, {
@@ -203,7 +203,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
203
203
///
204
204
/// Can be overridden to add extra code before/after apis.
205
205
void writeDataClasses (
206
- PigeonInternalOptions generatorOptions,
206
+ T generatorOptions,
207
207
Root root,
208
208
Indent indent, {
209
209
required String dartPackageName,
@@ -221,15 +221,15 @@ abstract class StructuredGenerator<PigeonInternalOptions>
221
221
222
222
/// Writes the custom codec to [indent] .
223
223
void writeGeneralCodec (
224
- PigeonInternalOptions generatorOptions,
224
+ T generatorOptions,
225
225
Root root,
226
226
Indent indent, {
227
227
required String dartPackageName,
228
228
});
229
229
230
230
/// Writes a single data class to [indent] .
231
231
void writeDataClass (
232
- PigeonInternalOptions generatorOptions,
232
+ T generatorOptions,
233
233
Root root,
234
234
Indent indent,
235
235
Class classDefinition, {
@@ -238,7 +238,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
238
238
239
239
/// Writes a single class encode method to [indent] .
240
240
void writeClassEncode (
241
- PigeonInternalOptions generatorOptions,
241
+ T generatorOptions,
242
242
Root root,
243
243
Indent indent,
244
244
Class classDefinition, {
@@ -247,7 +247,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
247
247
248
248
/// Writes a single class decode method to [indent] .
249
249
void writeClassDecode (
250
- PigeonInternalOptions generatorOptions,
250
+ T generatorOptions,
251
251
Root root,
252
252
Indent indent,
253
253
Class classDefinition, {
@@ -256,7 +256,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
256
256
257
257
/// Writes a single class decode method to [indent] .
258
258
void writeClassEquality (
259
- PigeonInternalOptions generatorOptions,
259
+ T generatorOptions,
260
260
Root root,
261
261
Indent indent,
262
262
Class classDefinition, {
@@ -267,7 +267,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
267
267
///
268
268
/// Can be overridden to add extra code before/after classes.
269
269
void writeApis (
270
- PigeonInternalOptions generatorOptions,
270
+ T generatorOptions,
271
271
Root root,
272
272
Indent indent, {
273
273
required String dartPackageName,
@@ -312,7 +312,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
312
312
313
313
/// Writes a single Flutter Api to [indent] .
314
314
void writeFlutterApi (
315
- PigeonInternalOptions generatorOptions,
315
+ T generatorOptions,
316
316
Root root,
317
317
Indent indent,
318
318
AstFlutterApi api, {
@@ -321,7 +321,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
321
321
322
322
/// Writes a single Host Api to [indent] .
323
323
void writeHostApi (
324
- PigeonInternalOptions generatorOptions,
324
+ T generatorOptions,
325
325
Root root,
326
326
Indent indent,
327
327
AstHostApi api, {
@@ -330,7 +330,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
330
330
331
331
/// Writes the implementation of an `InstanceManager` to [indent] .
332
332
void writeInstanceManager (
333
- PigeonInternalOptions generatorOptions,
333
+ T generatorOptions,
334
334
Root root,
335
335
Indent indent, {
336
336
required String dartPackageName,
@@ -339,7 +339,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
339
339
/// Writes the implementation of the API for the `InstanceManager` to
340
340
/// [indent] .
341
341
void writeInstanceManagerApi (
342
- PigeonInternalOptions generatorOptions,
342
+ T generatorOptions,
343
343
Root root,
344
344
Indent indent, {
345
345
required String dartPackageName,
@@ -356,14 +356,14 @@ abstract class StructuredGenerator<PigeonInternalOptions>
356
356
/// needs to create its own codec (it has methods/fields/constructor that use
357
357
/// a data class) it should extend this codec and not `StandardMessageCodec` .
358
358
void writeProxyApiBaseCodec (
359
- PigeonInternalOptions generatorOptions,
359
+ T generatorOptions,
360
360
Root root,
361
361
Indent indent,
362
362
) {}
363
363
364
364
/// Writes a single Proxy Api to [indent] .
365
365
void writeProxyApi (
366
- PigeonInternalOptions generatorOptions,
366
+ T generatorOptions,
367
367
Root root,
368
368
Indent indent,
369
369
AstProxyApi api, {
@@ -372,7 +372,7 @@ abstract class StructuredGenerator<PigeonInternalOptions>
372
372
373
373
/// Writes a single event channel Api to [indent] .
374
374
void writeEventChannelApi (
375
- PigeonInternalOptions generatorOptions,
375
+ T generatorOptions,
376
376
Root root,
377
377
Indent indent,
378
378
AstEventChannelApi api, {
0 commit comments