Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(841)

Side by Side Diff: pkg/analyzer/lib/src/summary/format.dart

Issue 1576663002: Use FlatBuffers for summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/summary_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // This file has been automatically generated. Please do not edit it manually. 5 // This file has been automatically generated. Please do not edit it manually.
6 // To regenerate the file, use the script "pkg/analyzer/tool/generate_files". 6 // To regenerate the file, use the script "pkg/analyzer/tool/generate_files".
7 7
8 library analyzer.src.summary.format; 8 library analyzer.src.summary.format;
9 9
10 import 'dart:convert';
11 import 'base.dart' as base; 10 import 'base.dart' as base;
11 import 'flat_buffers.dart' as fb;
12 12
13 /** 13 /**
14 * Enum used to indicate the kind of entity referred to by a 14 * Enum used to indicate the kind of entity referred to by a
15 * [PrelinkedReference]. 15 * [PrelinkedReference].
16 */ 16 */
17 enum PrelinkedReferenceKind { 17 enum PrelinkedReferenceKind {
18 classOrEnum, 18 classOrEnum,
19 typedef, 19 typedef,
20 other, 20 other,
21 prefix, 21 prefix,
(...skipping 12 matching lines...) Expand all
34 34
35 /** 35 /**
36 * Enum used to indicate the kind of a parameter. 36 * Enum used to indicate the kind of a parameter.
37 */ 37 */
38 enum UnlinkedParamKind { 38 enum UnlinkedParamKind {
39 required, 39 required,
40 positional, 40 positional,
41 named, 41 named,
42 } 42 }
43 43
44 /** 44 class PrelinkedDependencyBuilder {
45 * Information about a dependency that exists between one library and another 45 bool _finished = false;
46 * due to an "import" declaration. 46
47 */
48 class PrelinkedDependency extends base.SummaryClass {
49 String _uri; 47 String _uri;
50 48
51 PrelinkedDependency.fromJson(Map json) 49 bool _uriIsSet = false;
Paul Berry 2016/01/09 14:57:41 Personally I would remove booleans like these (and
scheglov 2016/01/09 18:55:33 Done.
52 : _uri = json["uri"];
53
54 @override
55 Map<String, Object> toMap() => {
56 "uri": uri,
57 };
58
59 /**
60 * The relative URI used to import one library from the other.
61 */
62 String get uri => _uri ?? '';
63 }
64
65 class PrelinkedDependencyBuilder {
66 final Map _json = {};
67
68 bool _finished = false;
69 50
70 PrelinkedDependencyBuilder(base.BuilderContext context); 51 PrelinkedDependencyBuilder(base.BuilderContext context);
71 52
72 /** 53 /**
73 * The relative URI used to import one library from the other. 54 * The relative URI used to import one library from the other.
74 */ 55 */
75 void set uri(String _value) { 56 void set uri(String _value) {
76 assert(!_finished); 57 assert(!_finished);
77 assert(!_json.containsKey("uri")); 58 assert(!_uriIsSet);
78 if (_value != null) { 59 _uriIsSet = true;
79 _json["uri"] = _value; 60 _uri = _value;
80 }
81 } 61 }
82 62
83 Map finish() { 63 fb.Offset finish(fb.Builder fbBuilder) {
84 assert(!_finished); 64 assert(!_finished);
85 _finished = true; 65 _finished = true;
86 return _json; 66 fb.Offset offset_uri;
67 if (_uri != null) {
68 offset_uri = fbBuilder.writeString(_uri);
69 }
70 fbBuilder.startTable();
71 if (offset_uri != null) {
72 fbBuilder.addOffset(0, offset_uri);
73 }
74 return fbBuilder.endTable();
87 } 75 }
88 } 76 }
89 77
90 PrelinkedDependencyBuilder encodePrelinkedDependency(base.BuilderContext builder Context, {String uri}) { 78 PrelinkedDependencyBuilder encodePrelinkedDependency(base.BuilderContext builder Context, {String uri}) {
91 PrelinkedDependencyBuilder builder = new PrelinkedDependencyBuilder(builderCon text); 79 PrelinkedDependencyBuilder builder = new PrelinkedDependencyBuilder(builderCon text);
92 builder.uri = uri; 80 builder.uri = uri;
93 return builder; 81 return builder;
94 } 82 }
95 83
96 /** 84 /**
97 * Pre-linked summary of a library. 85 * Information about a dependency that exists between one library and another
86 * due to an "import" declaration.
98 */ 87 */
99 class PrelinkedLibrary extends base.SummaryClass { 88 abstract class PrelinkedDependency extends base.SummaryClass {
100 List<PrelinkedUnit> _units;
101 List<PrelinkedDependency> _dependencies;
102 List<int> _importDependencies;
103 89
104 PrelinkedLibrary.fromJson(Map json) 90 /**
105 : _units = json["units"]?.map((x) => new PrelinkedUnit.fromJson(x))?.toList( ), 91 * The relative URI used to import one library from the other.
106 _dependencies = json["dependencies"]?.map((x) => new PrelinkedDependency.f romJson(x))?.toList(), 92 */
107 _importDependencies = json["importDependencies"]; 93 String get uri;
94 }
95
96 class _PrelinkedDependencyReader extends fb.TableReader<_PrelinkedDependencyRead er> implements PrelinkedDependency {
97 final fb.BufferPointer _bp;
98
99 const _PrelinkedDependencyReader([this._bp]);
108 100
109 @override 101 @override
110 Map<String, Object> toMap() => { 102 _PrelinkedDependencyReader createReader(fb.BufferPointer bp) => new _Prelinked DependencyReader(bp);
111 "units": units,
112 "dependencies": dependencies,
113 "importDependencies": importDependencies,
114 };
115 103
116 PrelinkedLibrary.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8 .decode(buffer))); 104 @override
105 Map<String, Object> toMap() => {};
Paul Berry 2016/01/09 14:57:41 Looks like generation of this method got broken by
scheglov 2016/01/09 18:55:33 Done.
117 106
118 /** 107 @override
119 * The pre-linked summary of all the compilation units constituting the 108 String get uri => const fb.StringReader().vTableGet(_bp, 0, '');
120 * library. The summary of the defining compilation unit is listed first,
121 * followed by the summary of each part, in the order of the `part`
122 * declarations in the defining compilation unit.
123 */
124 List<PrelinkedUnit> get units => _units ?? const <PrelinkedUnit>[];
125
126 /**
127 * The libraries that this library depends on (either via an explicit import
128 * statement or via the implicit dependencies on `dart:core` and
129 * `dart:async`). The first element of this array is a pseudo-dependency
130 * representing the library itself (it is also used for "dynamic").
131 *
132 * TODO(paulberry): consider removing this entirely and just using
133 * [UnlinkedLibrary.imports].
134 */
135 List<PrelinkedDependency> get dependencies => _dependencies ?? const <Prelinke dDependency>[];
136
137 /**
138 * For each import in [UnlinkedUnit.imports], an index into [dependencies]
139 * of the library being imported.
140 *
141 * TODO(paulberry): if [dependencies] is removed, this can be removed as
142 * well, since there will effectively be a one-to-one mapping.
143 */
144 List<int> get importDependencies => _importDependencies ?? const <int>[];
145 } 109 }
146 110
147 class PrelinkedLibraryBuilder { 111 class PrelinkedLibraryBuilder {
148 final Map _json = {}; 112 bool _finished = false;
149 113
150 bool _finished = false; 114 List<PrelinkedUnitBuilder> _units;
115 List<PrelinkedDependencyBuilder> _dependencies;
116 List<int> _importDependencies;
117
118 bool _unitsIsSet = false;
119 bool _dependenciesIsSet = false;
120 bool _importDependenciesIsSet = false;
151 121
152 PrelinkedLibraryBuilder(base.BuilderContext context); 122 PrelinkedLibraryBuilder(base.BuilderContext context);
153 123
154 /** 124 /**
155 * The pre-linked summary of all the compilation units constituting the 125 * The pre-linked summary of all the compilation units constituting the
156 * library. The summary of the defining compilation unit is listed first, 126 * library. The summary of the defining compilation unit is listed first,
157 * followed by the summary of each part, in the order of the `part` 127 * followed by the summary of each part, in the order of the `part`
158 * declarations in the defining compilation unit. 128 * declarations in the defining compilation unit.
159 */ 129 */
160 void set units(List<PrelinkedUnitBuilder> _value) { 130 void set units(List<PrelinkedUnitBuilder> _value) {
161 assert(!_finished); 131 assert(!_finished);
162 assert(!_json.containsKey("units")); 132 assert(!_unitsIsSet);
163 if (!(_value == null || _value.isEmpty)) { 133 _unitsIsSet = true;
164 _json["units"] = _value.map((b) => b.finish()).toList(); 134 _units = _value;
165 }
166 } 135 }
167 136
168 /** 137 /**
169 * The libraries that this library depends on (either via an explicit import 138 * The libraries that this library depends on (either via an explicit import
170 * statement or via the implicit dependencies on `dart:core` and 139 * statement or via the implicit dependencies on `dart:core` and
171 * `dart:async`). The first element of this array is a pseudo-dependency 140 * `dart:async`). The first element of this array is a pseudo-dependency
172 * representing the library itself (it is also used for "dynamic"). 141 * representing the library itself (it is also used for "dynamic").
173 * 142 *
174 * TODO(paulberry): consider removing this entirely and just using 143 * TODO(paulberry): consider removing this entirely and just using
175 * [UnlinkedLibrary.imports]. 144 * [UnlinkedLibrary.imports].
176 */ 145 */
177 void set dependencies(List<PrelinkedDependencyBuilder> _value) { 146 void set dependencies(List<PrelinkedDependencyBuilder> _value) {
178 assert(!_finished); 147 assert(!_finished);
179 assert(!_json.containsKey("dependencies")); 148 assert(!_dependenciesIsSet);
180 if (!(_value == null || _value.isEmpty)) { 149 _dependenciesIsSet = true;
181 _json["dependencies"] = _value.map((b) => b.finish()).toList(); 150 _dependencies = _value;
182 }
183 } 151 }
184 152
185 /** 153 /**
186 * For each import in [UnlinkedUnit.imports], an index into [dependencies] 154 * For each import in [UnlinkedUnit.imports], an index into [dependencies]
187 * of the library being imported. 155 * of the library being imported.
188 * 156 *
189 * TODO(paulberry): if [dependencies] is removed, this can be removed as 157 * TODO(paulberry): if [dependencies] is removed, this can be removed as
190 * well, since there will effectively be a one-to-one mapping. 158 * well, since there will effectively be a one-to-one mapping.
191 */ 159 */
192 void set importDependencies(List<int> _value) { 160 void set importDependencies(List<int> _value) {
193 assert(!_finished); 161 assert(!_finished);
194 assert(!_json.containsKey("importDependencies")); 162 assert(!_importDependenciesIsSet);
195 if (!(_value == null || _value.isEmpty)) { 163 _importDependenciesIsSet = true;
196 _json["importDependencies"] = _value.toList(); 164 _importDependencies = _value;
197 }
198 } 165 }
199 166
200 List<int> toBuffer() => UTF8.encode(JSON.encode(finish())); 167 List<int> toBuffer() {
168 fb.Builder fbBuilder = new fb.Builder();
169 return fbBuilder.finish(finish(fbBuilder));
170 }
201 171
202 Map finish() { 172 fb.Offset finish(fb.Builder fbBuilder) {
203 assert(!_finished); 173 assert(!_finished);
204 _finished = true; 174 _finished = true;
205 return _json; 175 fb.Offset offset_units;
176 fb.Offset offset_dependencies;
177 fb.Offset offset_importDependencies;
178 if (!(_units == null || _units.isEmpty)) {
179 offset_units = fbBuilder.writeList(_units.map((b) => b.finish(fbBuilder)). toList());
180 }
181 if (!(_dependencies == null || _dependencies.isEmpty)) {
182 offset_dependencies = fbBuilder.writeList(_dependencies.map((b) => b.finis h(fbBuilder)).toList());
183 }
184 if (!(_importDependencies == null || _importDependencies.isEmpty)) {
185 offset_importDependencies = fbBuilder.writeListInt32(_importDependencies);
186 }
187 fbBuilder.startTable();
188 if (offset_units != null) {
189 fbBuilder.addOffset(0, offset_units);
190 }
191 if (offset_dependencies != null) {
192 fbBuilder.addOffset(1, offset_dependencies);
193 }
194 if (offset_importDependencies != null) {
195 fbBuilder.addOffset(2, offset_importDependencies);
196 }
197 return fbBuilder.endTable();
206 } 198 }
207 } 199 }
208 200
209 PrelinkedLibraryBuilder encodePrelinkedLibrary(base.BuilderContext builderContex t, {List<PrelinkedUnitBuilder> units, List<PrelinkedDependencyBuilder> dependenc ies, List<int> importDependencies}) { 201 PrelinkedLibraryBuilder encodePrelinkedLibrary(base.BuilderContext builderContex t, {List<PrelinkedUnitBuilder> units, List<PrelinkedDependencyBuilder> dependenc ies, List<int> importDependencies}) {
210 PrelinkedLibraryBuilder builder = new PrelinkedLibraryBuilder(builderContext); 202 PrelinkedLibraryBuilder builder = new PrelinkedLibraryBuilder(builderContext);
211 builder.units = units; 203 builder.units = units;
212 builder.dependencies = dependencies; 204 builder.dependencies = dependencies;
213 builder.importDependencies = importDependencies; 205 builder.importDependencies = importDependencies;
214 return builder; 206 return builder;
215 } 207 }
216 208
217 /** 209 /**
218 * Information about the resolution of an [UnlinkedReference]. 210 * Pre-linked summary of a library.
219 */ 211 */
220 class PrelinkedReference extends base.SummaryClass { 212 abstract class PrelinkedLibrary extends base.SummaryClass {
213 factory PrelinkedLibrary.fromBuffer(List<int> buffer) {
214 fb.BufferPointer rootRef = new fb.BufferPointer.fromBytes(buffer);
215 return const _PrelinkedLibraryReader().read(rootRef);
216 }
217
218 /**
219 * The pre-linked summary of all the compilation units constituting the
220 * library. The summary of the defining compilation unit is listed first,
221 * followed by the summary of each part, in the order of the `part`
222 * declarations in the defining compilation unit.
223 */
224 List<PrelinkedUnit> get units;
225
226 /**
227 * The libraries that this library depends on (either via an explicit import
228 * statement or via the implicit dependencies on `dart:core` and
229 * `dart:async`). The first element of this array is a pseudo-dependency
230 * representing the library itself (it is also used for "dynamic").
231 *
232 * TODO(paulberry): consider removing this entirely and just using
233 * [UnlinkedLibrary.imports].
234 */
235 List<PrelinkedDependency> get dependencies;
236
237 /**
238 * For each import in [UnlinkedUnit.imports], an index into [dependencies]
239 * of the library being imported.
240 *
241 * TODO(paulberry): if [dependencies] is removed, this can be removed as
242 * well, since there will effectively be a one-to-one mapping.
243 */
244 List<int> get importDependencies;
245 }
246
247 class _PrelinkedLibraryReader extends fb.TableReader<_PrelinkedLibraryReader> im plements PrelinkedLibrary {
248 final fb.BufferPointer _bp;
249
250 const _PrelinkedLibraryReader([this._bp]);
251
252 @override
253 _PrelinkedLibraryReader createReader(fb.BufferPointer bp) => new _PrelinkedLib raryReader(bp);
254
255 @override
256 Map<String, Object> toMap() => {};
257
258 @override
259 List<PrelinkedUnit> get units => const fb.ListReader<PrelinkedUnit>(const _Pre linkedUnitReader()).vTableGet(_bp, 0, const <PrelinkedUnit>[]);
260
261 @override
262 List<PrelinkedDependency> get dependencies => const fb.ListReader<PrelinkedDep endency>(const _PrelinkedDependencyReader()).vTableGet(_bp, 1, const <PrelinkedD ependency>[]);
263
264 @override
265 List<int> get importDependencies => const fb.ListReader<int>(const fb.Int32Rea der()).vTableGet(_bp, 2, const <int>[]);
266 }
267
268 class PrelinkedReferenceBuilder {
269 bool _finished = false;
270
221 int _dependency; 271 int _dependency;
222 PrelinkedReferenceKind _kind; 272 PrelinkedReferenceKind _kind;
223 int _unit; 273 int _unit;
224 int _numTypeParameters; 274 int _numTypeParameters;
225 275
226 PrelinkedReference.fromJson(Map json) 276 bool _dependencyIsSet = false;
227 : _dependency = json["dependency"], 277 bool _kindIsSet = false;
228 _kind = json["kind"] == null ? null : PrelinkedReferenceKind.values[json[" kind"]], 278 bool _unitIsSet = false;
229 _unit = json["unit"], 279 bool _numTypeParametersIsSet = false;
230 _numTypeParameters = json["numTypeParameters"];
231
232 @override
233 Map<String, Object> toMap() => {
234 "dependency": dependency,
235 "kind": kind,
236 "unit": unit,
237 "numTypeParameters": numTypeParameters,
238 };
239
240 /**
241 * Index into [PrelinkedLibrary.dependencies] indicating which imported librar y
242 * declares the entity being referred to.
243 */
244 int get dependency => _dependency ?? 0;
245
246 /**
247 * The kind of the entity being referred to. For the pseudo-type `dynamic`,
248 * the kind is [PrelinkedReferenceKind.classOrEnum].
249 */
250 PrelinkedReferenceKind get kind => _kind ?? PrelinkedReferenceKind.classOrEnum ;
251
252 /**
253 * Integer index indicating which unit in the imported library contains the
254 * definition of the entity. As with indices into [PrelinkedLibrary.units],
255 * zero represents the defining compilation unit, and nonzero values
256 * represent parts in the order of the corresponding `part` declarations.
257 */
258 int get unit => _unit ?? 0;
259
260 /**
261 * If the entity being referred to is generic, the number of type parameters
262 * it accepts. Otherwise zero.
263 */
264 int get numTypeParameters => _numTypeParameters ?? 0;
265 }
266
267 class PrelinkedReferenceBuilder {
268 final Map _json = {};
269
270 bool _finished = false;
271 280
272 PrelinkedReferenceBuilder(base.BuilderContext context); 281 PrelinkedReferenceBuilder(base.BuilderContext context);
273 282
274 /** 283 /**
275 * Index into [PrelinkedLibrary.dependencies] indicating which imported librar y 284 * Index into [PrelinkedLibrary.dependencies] indicating which imported librar y
276 * declares the entity being referred to. 285 * declares the entity being referred to.
277 */ 286 */
278 void set dependency(int _value) { 287 void set dependency(int _value) {
279 assert(!_finished); 288 assert(!_finished);
280 assert(!_json.containsKey("dependency")); 289 assert(!_dependencyIsSet);
281 if (_value != null) { 290 _dependencyIsSet = true;
282 _json["dependency"] = _value; 291 _dependency = _value;
283 }
284 } 292 }
285 293
286 /** 294 /**
287 * The kind of the entity being referred to. For the pseudo-type `dynamic`, 295 * The kind of the entity being referred to. For the pseudo-type `dynamic`,
288 * the kind is [PrelinkedReferenceKind.classOrEnum]. 296 * the kind is [PrelinkedReferenceKind.classOrEnum].
289 */ 297 */
290 void set kind(PrelinkedReferenceKind _value) { 298 void set kind(PrelinkedReferenceKind _value) {
291 assert(!_finished); 299 assert(!_finished);
292 assert(!_json.containsKey("kind")); 300 assert(!_kindIsSet);
293 if (!(_value == null || _value == PrelinkedReferenceKind.classOrEnum)) { 301 _kindIsSet = true;
294 _json["kind"] = _value.index; 302 _kind = _value;
295 }
296 } 303 }
297 304
298 /** 305 /**
299 * Integer index indicating which unit in the imported library contains the 306 * Integer index indicating which unit in the imported library contains the
300 * definition of the entity. As with indices into [PrelinkedLibrary.units], 307 * definition of the entity. As with indices into [PrelinkedLibrary.units],
301 * zero represents the defining compilation unit, and nonzero values 308 * zero represents the defining compilation unit, and nonzero values
302 * represent parts in the order of the corresponding `part` declarations. 309 * represent parts in the order of the corresponding `part` declarations.
303 */ 310 */
304 void set unit(int _value) { 311 void set unit(int _value) {
305 assert(!_finished); 312 assert(!_finished);
306 assert(!_json.containsKey("unit")); 313 assert(!_unitIsSet);
307 if (_value != null) { 314 _unitIsSet = true;
308 _json["unit"] = _value; 315 _unit = _value;
309 }
310 } 316 }
311 317
312 /** 318 /**
313 * If the entity being referred to is generic, the number of type parameters 319 * If the entity being referred to is generic, the number of type parameters
314 * it accepts. Otherwise zero. 320 * it accepts. Otherwise zero.
315 */ 321 */
316 void set numTypeParameters(int _value) { 322 void set numTypeParameters(int _value) {
317 assert(!_finished); 323 assert(!_finished);
318 assert(!_json.containsKey("numTypeParameters")); 324 assert(!_numTypeParametersIsSet);
319 if (_value != null) { 325 _numTypeParametersIsSet = true;
320 _json["numTypeParameters"] = _value; 326 _numTypeParameters = _value;
321 }
322 } 327 }
323 328
324 Map finish() { 329 fb.Offset finish(fb.Builder fbBuilder) {
325 assert(!_finished); 330 assert(!_finished);
326 _finished = true; 331 _finished = true;
327 return _json; 332 fbBuilder.startTable();
333 if (_dependency != null && _dependency != 0) {
334 fbBuilder.addInt32(0, _dependency);
335 }
336 if (_kind != null && _kind != PrelinkedReferenceKind.classOrEnum) {
337 fbBuilder.addInt32(1, _kind.index);
338 }
339 if (_unit != null && _unit != 0) {
340 fbBuilder.addInt32(2, _unit);
341 }
342 if (_numTypeParameters != null && _numTypeParameters != 0) {
343 fbBuilder.addInt32(3, _numTypeParameters);
344 }
345 return fbBuilder.endTable();
328 } 346 }
329 } 347 }
330 348
331 PrelinkedReferenceBuilder encodePrelinkedReference(base.BuilderContext builderCo ntext, {int dependency, PrelinkedReferenceKind kind, int unit, int numTypeParame ters}) { 349 PrelinkedReferenceBuilder encodePrelinkedReference(base.BuilderContext builderCo ntext, {int dependency, PrelinkedReferenceKind kind, int unit, int numTypeParame ters}) {
332 PrelinkedReferenceBuilder builder = new PrelinkedReferenceBuilder(builderConte xt); 350 PrelinkedReferenceBuilder builder = new PrelinkedReferenceBuilder(builderConte xt);
333 builder.dependency = dependency; 351 builder.dependency = dependency;
334 builder.kind = kind; 352 builder.kind = kind;
335 builder.unit = unit; 353 builder.unit = unit;
336 builder.numTypeParameters = numTypeParameters; 354 builder.numTypeParameters = numTypeParameters;
337 return builder; 355 return builder;
338 } 356 }
339 357
340 /** 358 /**
341 * Pre-linked summary of a compilation unit. 359 * Information about the resolution of an [UnlinkedReference].
342 */ 360 */
343 class PrelinkedUnit extends base.SummaryClass { 361 abstract class PrelinkedReference extends base.SummaryClass {
344 List<PrelinkedReference> _references;
345 362
346 PrelinkedUnit.fromJson(Map json) 363 /**
347 : _references = json["references"]?.map((x) => new PrelinkedReference.fromJs on(x))?.toList(); 364 * Index into [PrelinkedLibrary.dependencies] indicating which imported librar y
365 * declares the entity being referred to.
366 */
367 int get dependency;
368
369 /**
370 * The kind of the entity being referred to. For the pseudo-type `dynamic`,
371 * the kind is [PrelinkedReferenceKind.classOrEnum].
372 */
373 PrelinkedReferenceKind get kind;
374
375 /**
376 * Integer index indicating which unit in the imported library contains the
377 * definition of the entity. As with indices into [PrelinkedLibrary.units],
378 * zero represents the defining compilation unit, and nonzero values
379 * represent parts in the order of the corresponding `part` declarations.
380 */
381 int get unit;
382
383 /**
384 * If the entity being referred to is generic, the number of type parameters
385 * it accepts. Otherwise zero.
386 */
387 int get numTypeParameters;
388 }
389
390 class _PrelinkedReferenceReader extends fb.TableReader<_PrelinkedReferenceReader > implements PrelinkedReference {
391 final fb.BufferPointer _bp;
392
393 const _PrelinkedReferenceReader([this._bp]);
348 394
349 @override 395 @override
350 Map<String, Object> toMap() => { 396 _PrelinkedReferenceReader createReader(fb.BufferPointer bp) => new _PrelinkedR eferenceReader(bp);
351 "references": references,
352 };
353 397
354 /** 398 @override
355 * For each reference in [UnlinkedUnit.references], information about how 399 Map<String, Object> toMap() => {};
356 * that reference is resolved. 400
357 */ 401 @override
358 List<PrelinkedReference> get references => _references ?? const <PrelinkedRefe rence>[]; 402 int get dependency => const fb.Int32Reader().vTableGet(_bp, 0, 0);
403
404 @override
405 PrelinkedReferenceKind get kind {
406 int index = const fb.Int32Reader().vTableGet(_bp, 1, 0);
407 return PrelinkedReferenceKind.values[index];
408 }
409
410 @override
411 int get unit => const fb.Int32Reader().vTableGet(_bp, 2, 0);
412
413 @override
414 int get numTypeParameters => const fb.Int32Reader().vTableGet(_bp, 3, 0);
359 } 415 }
360 416
361 class PrelinkedUnitBuilder { 417 class PrelinkedUnitBuilder {
362 final Map _json = {}; 418 bool _finished = false;
363 419
364 bool _finished = false; 420 List<PrelinkedReferenceBuilder> _references;
421
422 bool _referencesIsSet = false;
365 423
366 PrelinkedUnitBuilder(base.BuilderContext context); 424 PrelinkedUnitBuilder(base.BuilderContext context);
367 425
368 /** 426 /**
369 * For each reference in [UnlinkedUnit.references], information about how 427 * For each reference in [UnlinkedUnit.references], information about how
370 * that reference is resolved. 428 * that reference is resolved.
371 */ 429 */
372 void set references(List<PrelinkedReferenceBuilder> _value) { 430 void set references(List<PrelinkedReferenceBuilder> _value) {
373 assert(!_finished); 431 assert(!_finished);
374 assert(!_json.containsKey("references")); 432 assert(!_referencesIsSet);
375 if (!(_value == null || _value.isEmpty)) { 433 _referencesIsSet = true;
376 _json["references"] = _value.map((b) => b.finish()).toList(); 434 _references = _value;
377 }
378 } 435 }
379 436
380 Map finish() { 437 fb.Offset finish(fb.Builder fbBuilder) {
381 assert(!_finished); 438 assert(!_finished);
382 _finished = true; 439 _finished = true;
383 return _json; 440 fb.Offset offset_references;
441 if (!(_references == null || _references.isEmpty)) {
442 offset_references = fbBuilder.writeList(_references.map((b) => b.finish(fb Builder)).toList());
443 }
444 fbBuilder.startTable();
445 if (offset_references != null) {
446 fbBuilder.addOffset(0, offset_references);
447 }
448 return fbBuilder.endTable();
384 } 449 }
385 } 450 }
386 451
387 PrelinkedUnitBuilder encodePrelinkedUnit(base.BuilderContext builderContext, {Li st<PrelinkedReferenceBuilder> references}) { 452 PrelinkedUnitBuilder encodePrelinkedUnit(base.BuilderContext builderContext, {Li st<PrelinkedReferenceBuilder> references}) {
388 PrelinkedUnitBuilder builder = new PrelinkedUnitBuilder(builderContext); 453 PrelinkedUnitBuilder builder = new PrelinkedUnitBuilder(builderContext);
389 builder.references = references; 454 builder.references = references;
390 return builder; 455 return builder;
391 } 456 }
392 457
393 /** 458 /**
394 * Information about SDK. 459 * Pre-linked summary of a compilation unit.
395 */ 460 */
396 class SdkBundle extends base.SummaryClass { 461 abstract class PrelinkedUnit extends base.SummaryClass {
397 List<String> _prelinkedLibraryUris;
398 List<PrelinkedLibrary> _prelinkedLibraries;
399 List<String> _unlinkedUnitUris;
400 List<UnlinkedUnit> _unlinkedUnits;
401 462
402 SdkBundle.fromJson(Map json) 463 /**
403 : _prelinkedLibraryUris = json["prelinkedLibraryUris"], 464 * For each reference in [UnlinkedUnit.references], information about how
404 _prelinkedLibraries = json["prelinkedLibraries"]?.map((x) => new Prelinked Library.fromJson(x))?.toList(), 465 * that reference is resolved.
405 _unlinkedUnitUris = json["unlinkedUnitUris"], 466 */
406 _unlinkedUnits = json["unlinkedUnits"]?.map((x) => new UnlinkedUnit.fromJs on(x))?.toList(); 467 List<PrelinkedReference> get references;
468 }
469
470 class _PrelinkedUnitReader extends fb.TableReader<_PrelinkedUnitReader> implemen ts PrelinkedUnit {
471 final fb.BufferPointer _bp;
472
473 const _PrelinkedUnitReader([this._bp]);
407 474
408 @override 475 @override
409 Map<String, Object> toMap() => { 476 _PrelinkedUnitReader createReader(fb.BufferPointer bp) => new _PrelinkedUnitRe ader(bp);
410 "prelinkedLibraryUris": prelinkedLibraryUris,
411 "prelinkedLibraries": prelinkedLibraries,
412 "unlinkedUnitUris": unlinkedUnitUris,
413 "unlinkedUnits": unlinkedUnits,
414 };
415 477
416 SdkBundle.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8.decode (buffer))); 478 @override
479 Map<String, Object> toMap() => {};
417 480
418 /** 481 @override
419 * The list of URIs of items in [prelinkedLibraries], e.g. `dart:core`. 482 List<PrelinkedReference> get references => const fb.ListReader<PrelinkedRefere nce>(const _PrelinkedReferenceReader()).vTableGet(_bp, 0, const <PrelinkedRefere nce>[]);
420 */
421 List<String> get prelinkedLibraryUris => _prelinkedLibraryUris ?? const <Strin g>[];
422
423 /**
424 * Pre-linked libraries.
425 */
426 List<PrelinkedLibrary> get prelinkedLibraries => _prelinkedLibraries ?? const <PrelinkedLibrary>[];
427
428 /**
429 * The list of URIs of items in [unlinkedUnits], e.g. `dart:core/bool.dart`.
430 */
431 List<String> get unlinkedUnitUris => _unlinkedUnitUris ?? const <String>[];
432
433 /**
434 * Unlinked information for the compilation units constituting the SDK.
435 */
436 List<UnlinkedUnit> get unlinkedUnits => _unlinkedUnits ?? const <UnlinkedUnit> [];
437 } 483 }
438 484
439 class SdkBundleBuilder { 485 class SdkBundleBuilder {
440 final Map _json = {}; 486 bool _finished = false;
441 487
442 bool _finished = false; 488 List<String> _prelinkedLibraryUris;
489 List<PrelinkedLibraryBuilder> _prelinkedLibraries;
490 List<String> _unlinkedUnitUris;
491 List<UnlinkedUnitBuilder> _unlinkedUnits;
492
493 bool _prelinkedLibraryUrisIsSet = false;
494 bool _prelinkedLibrariesIsSet = false;
495 bool _unlinkedUnitUrisIsSet = false;
496 bool _unlinkedUnitsIsSet = false;
443 497
444 SdkBundleBuilder(base.BuilderContext context); 498 SdkBundleBuilder(base.BuilderContext context);
445 499
446 /** 500 /**
447 * The list of URIs of items in [prelinkedLibraries], e.g. `dart:core`. 501 * The list of URIs of items in [prelinkedLibraries], e.g. `dart:core`.
448 */ 502 */
449 void set prelinkedLibraryUris(List<String> _value) { 503 void set prelinkedLibraryUris(List<String> _value) {
450 assert(!_finished); 504 assert(!_finished);
451 assert(!_json.containsKey("prelinkedLibraryUris")); 505 assert(!_prelinkedLibraryUrisIsSet);
452 if (!(_value == null || _value.isEmpty)) { 506 _prelinkedLibraryUrisIsSet = true;
453 _json["prelinkedLibraryUris"] = _value.toList(); 507 _prelinkedLibraryUris = _value;
454 }
455 } 508 }
456 509
457 /** 510 /**
458 * Pre-linked libraries. 511 * Pre-linked libraries.
459 */ 512 */
460 void set prelinkedLibraries(List<PrelinkedLibraryBuilder> _value) { 513 void set prelinkedLibraries(List<PrelinkedLibraryBuilder> _value) {
461 assert(!_finished); 514 assert(!_finished);
462 assert(!_json.containsKey("prelinkedLibraries")); 515 assert(!_prelinkedLibrariesIsSet);
463 if (!(_value == null || _value.isEmpty)) { 516 _prelinkedLibrariesIsSet = true;
464 _json["prelinkedLibraries"] = _value.map((b) => b.finish()).toList(); 517 _prelinkedLibraries = _value;
465 }
466 } 518 }
467 519
468 /** 520 /**
469 * The list of URIs of items in [unlinkedUnits], e.g. `dart:core/bool.dart`. 521 * The list of URIs of items in [unlinkedUnits], e.g. `dart:core/bool.dart`.
470 */ 522 */
471 void set unlinkedUnitUris(List<String> _value) { 523 void set unlinkedUnitUris(List<String> _value) {
472 assert(!_finished); 524 assert(!_finished);
473 assert(!_json.containsKey("unlinkedUnitUris")); 525 assert(!_unlinkedUnitUrisIsSet);
474 if (!(_value == null || _value.isEmpty)) { 526 _unlinkedUnitUrisIsSet = true;
475 _json["unlinkedUnitUris"] = _value.toList(); 527 _unlinkedUnitUris = _value;
476 }
477 } 528 }
478 529
479 /** 530 /**
480 * Unlinked information for the compilation units constituting the SDK. 531 * Unlinked information for the compilation units constituting the SDK.
481 */ 532 */
482 void set unlinkedUnits(List<UnlinkedUnitBuilder> _value) { 533 void set unlinkedUnits(List<UnlinkedUnitBuilder> _value) {
483 assert(!_finished); 534 assert(!_finished);
484 assert(!_json.containsKey("unlinkedUnits")); 535 assert(!_unlinkedUnitsIsSet);
485 if (!(_value == null || _value.isEmpty)) { 536 _unlinkedUnitsIsSet = true;
486 _json["unlinkedUnits"] = _value.map((b) => b.finish()).toList(); 537 _unlinkedUnits = _value;
487 }
488 } 538 }
489 539
490 List<int> toBuffer() => UTF8.encode(JSON.encode(finish())); 540 List<int> toBuffer() {
541 fb.Builder fbBuilder = new fb.Builder();
542 return fbBuilder.finish(finish(fbBuilder));
543 }
491 544
492 Map finish() { 545 fb.Offset finish(fb.Builder fbBuilder) {
493 assert(!_finished); 546 assert(!_finished);
494 _finished = true; 547 _finished = true;
495 return _json; 548 fb.Offset offset_prelinkedLibraryUris;
549 fb.Offset offset_prelinkedLibraries;
550 fb.Offset offset_unlinkedUnitUris;
551 fb.Offset offset_unlinkedUnits;
552 if (!(_prelinkedLibraryUris == null || _prelinkedLibraryUris.isEmpty)) {
553 offset_prelinkedLibraryUris = fbBuilder.writeList(_prelinkedLibraryUris.ma p((b) => fbBuilder.writeString(b)).toList());
554 }
555 if (!(_prelinkedLibraries == null || _prelinkedLibraries.isEmpty)) {
556 offset_prelinkedLibraries = fbBuilder.writeList(_prelinkedLibraries.map((b ) => b.finish(fbBuilder)).toList());
557 }
558 if (!(_unlinkedUnitUris == null || _unlinkedUnitUris.isEmpty)) {
559 offset_unlinkedUnitUris = fbBuilder.writeList(_unlinkedUnitUris.map((b) => fbBuilder.writeString(b)).toList());
560 }
561 if (!(_unlinkedUnits == null || _unlinkedUnits.isEmpty)) {
562 offset_unlinkedUnits = fbBuilder.writeList(_unlinkedUnits.map((b) => b.fin ish(fbBuilder)).toList());
563 }
564 fbBuilder.startTable();
565 if (offset_prelinkedLibraryUris != null) {
566 fbBuilder.addOffset(0, offset_prelinkedLibraryUris);
567 }
568 if (offset_prelinkedLibraries != null) {
569 fbBuilder.addOffset(1, offset_prelinkedLibraries);
570 }
571 if (offset_unlinkedUnitUris != null) {
572 fbBuilder.addOffset(2, offset_unlinkedUnitUris);
573 }
574 if (offset_unlinkedUnits != null) {
575 fbBuilder.addOffset(3, offset_unlinkedUnits);
576 }
577 return fbBuilder.endTable();
496 } 578 }
497 } 579 }
498 580
499 SdkBundleBuilder encodeSdkBundle(base.BuilderContext builderContext, {List<Strin g> prelinkedLibraryUris, List<PrelinkedLibraryBuilder> prelinkedLibraries, List< String> unlinkedUnitUris, List<UnlinkedUnitBuilder> unlinkedUnits}) { 581 SdkBundleBuilder encodeSdkBundle(base.BuilderContext builderContext, {List<Strin g> prelinkedLibraryUris, List<PrelinkedLibraryBuilder> prelinkedLibraries, List< String> unlinkedUnitUris, List<UnlinkedUnitBuilder> unlinkedUnits}) {
500 SdkBundleBuilder builder = new SdkBundleBuilder(builderContext); 582 SdkBundleBuilder builder = new SdkBundleBuilder(builderContext);
501 builder.prelinkedLibraryUris = prelinkedLibraryUris; 583 builder.prelinkedLibraryUris = prelinkedLibraryUris;
502 builder.prelinkedLibraries = prelinkedLibraries; 584 builder.prelinkedLibraries = prelinkedLibraries;
503 builder.unlinkedUnitUris = unlinkedUnitUris; 585 builder.unlinkedUnitUris = unlinkedUnitUris;
504 builder.unlinkedUnits = unlinkedUnits; 586 builder.unlinkedUnits = unlinkedUnits;
505 return builder; 587 return builder;
506 } 588 }
507 589
508 /** 590 /**
509 * Unlinked summary information about a class declaration. 591 * Information about SDK.
510 */ 592 */
511 class UnlinkedClass extends base.SummaryClass { 593 abstract class SdkBundle extends base.SummaryClass {
594 factory SdkBundle.fromBuffer(List<int> buffer) {
595 fb.BufferPointer rootRef = new fb.BufferPointer.fromBytes(buffer);
596 return const _SdkBundleReader().read(rootRef);
597 }
598
599 /**
600 * The list of URIs of items in [prelinkedLibraries], e.g. `dart:core`.
601 */
602 List<String> get prelinkedLibraryUris;
603
604 /**
605 * Pre-linked libraries.
606 */
607 List<PrelinkedLibrary> get prelinkedLibraries;
608
609 /**
610 * The list of URIs of items in [unlinkedUnits], e.g. `dart:core/bool.dart`.
611 */
612 List<String> get unlinkedUnitUris;
613
614 /**
615 * Unlinked information for the compilation units constituting the SDK.
616 */
617 List<UnlinkedUnit> get unlinkedUnits;
618 }
619
620 class _SdkBundleReader extends fb.TableReader<_SdkBundleReader> implements SdkBu ndle {
621 final fb.BufferPointer _bp;
622
623 const _SdkBundleReader([this._bp]);
624
625 @override
626 _SdkBundleReader createReader(fb.BufferPointer bp) => new _SdkBundleReader(bp) ;
627
628 @override
629 Map<String, Object> toMap() => {};
630
631 @override
632 List<String> get prelinkedLibraryUris => const fb.ListReader<String>(const fb. StringReader()).vTableGet(_bp, 0, const <String>[]);
633
634 @override
635 List<PrelinkedLibrary> get prelinkedLibraries => const fb.ListReader<Prelinked Library>(const _PrelinkedLibraryReader()).vTableGet(_bp, 1, const <PrelinkedLibr ary>[]);
636
637 @override
638 List<String> get unlinkedUnitUris => const fb.ListReader<String>(const fb.Stri ngReader()).vTableGet(_bp, 2, const <String>[]);
639
640 @override
641 List<UnlinkedUnit> get unlinkedUnits => const fb.ListReader<UnlinkedUnit>(cons t _UnlinkedUnitReader()).vTableGet(_bp, 3, const <UnlinkedUnit>[]);
642 }
643
644 class UnlinkedClassBuilder {
645 bool _finished = false;
646
512 String _name; 647 String _name;
513 int _nameOffset; 648 int _nameOffset;
514 UnlinkedDocumentationComment _documentationComment; 649 UnlinkedDocumentationCommentBuilder _documentationComment;
515 List<UnlinkedTypeParam> _typeParameters; 650 List<UnlinkedTypeParamBuilder> _typeParameters;
516 UnlinkedTypeRef _supertype; 651 UnlinkedTypeRefBuilder _supertype;
517 List<UnlinkedTypeRef> _mixins; 652 List<UnlinkedTypeRefBuilder> _mixins;
518 List<UnlinkedTypeRef> _interfaces; 653 List<UnlinkedTypeRefBuilder> _interfaces;
519 List<UnlinkedVariable> _fields; 654 List<UnlinkedVariableBuilder> _fields;
520 List<UnlinkedExecutable> _executables; 655 List<UnlinkedExecutableBuilder> _executables;
521 bool _isAbstract; 656 bool _isAbstract;
522 bool _isMixinApplication; 657 bool _isMixinApplication;
523 bool _hasNoSupertype; 658 bool _hasNoSupertype;
524 659
525 UnlinkedClass.fromJson(Map json) 660 bool _nameIsSet = false;
526 : _name = json["name"], 661 bool _nameOffsetIsSet = false;
527 _nameOffset = json["nameOffset"], 662 bool _documentationCommentIsSet = false;
528 _documentationComment = json["documentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["documentationComment"]), 663 bool _typeParametersIsSet = false;
529 _typeParameters = json["typeParameters"]?.map((x) => new UnlinkedTypeParam .fromJson(x))?.toList(), 664 bool _supertypeIsSet = false;
530 _supertype = json["supertype"] == null ? null : new UnlinkedTypeRef.fromJs on(json["supertype"]), 665 bool _mixinsIsSet = false;
531 _mixins = json["mixins"]?.map((x) => new UnlinkedTypeRef.fromJson(x))?.toL ist(), 666 bool _interfacesIsSet = false;
532 _interfaces = json["interfaces"]?.map((x) => new UnlinkedTypeRef.fromJson( x))?.toList(), 667 bool _fieldsIsSet = false;
533 _fields = json["fields"]?.map((x) => new UnlinkedVariable.fromJson(x))?.to List(), 668 bool _executablesIsSet = false;
534 _executables = json["executables"]?.map((x) => new UnlinkedExecutable.from Json(x))?.toList(), 669 bool _isAbstractIsSet = false;
535 _isAbstract = json["isAbstract"], 670 bool _isMixinApplicationIsSet = false;
536 _isMixinApplication = json["isMixinApplication"], 671 bool _hasNoSupertypeIsSet = false;
537 _hasNoSupertype = json["hasNoSupertype"];
538
539 @override
540 Map<String, Object> toMap() => {
541 "name": name,
542 "nameOffset": nameOffset,
543 "documentationComment": documentationComment,
544 "typeParameters": typeParameters,
545 "supertype": supertype,
546 "mixins": mixins,
547 "interfaces": interfaces,
548 "fields": fields,
549 "executables": executables,
550 "isAbstract": isAbstract,
551 "isMixinApplication": isMixinApplication,
552 "hasNoSupertype": hasNoSupertype,
553 };
554
555 /**
556 * Name of the class.
557 */
558 String get name => _name ?? '';
559
560 /**
561 * Offset of the class name relative to the beginning of the file.
562 */
563 int get nameOffset => _nameOffset ?? 0;
564
565 /**
566 * Documentation comment for the class, or `null` if there is no
567 * documentation comment.
568 */
569 UnlinkedDocumentationComment get documentationComment => _documentationComment ;
570
571 /**
572 * Type parameters of the class, if any.
573 */
574 List<UnlinkedTypeParam> get typeParameters => _typeParameters ?? const <Unlink edTypeParam>[];
575
576 /**
577 * Supertype of the class, or `null` if either (a) the class doesn't
578 * explicitly declare a supertype (and hence has supertype `Object`), or (b)
579 * the class *is* `Object` (and hence has no supertype).
580 */
581 UnlinkedTypeRef get supertype => _supertype;
582
583 /**
584 * Mixins appearing in a `with` clause, if any.
585 */
586 List<UnlinkedTypeRef> get mixins => _mixins ?? const <UnlinkedTypeRef>[];
587
588 /**
589 * Interfaces appearing in an `implements` clause, if any.
590 */
591 List<UnlinkedTypeRef> get interfaces => _interfaces ?? const <UnlinkedTypeRef> [];
592
593 /**
594 * Field declarations contained in the class.
595 */
596 List<UnlinkedVariable> get fields => _fields ?? const <UnlinkedVariable>[];
597
598 /**
599 * Executable objects (methods, getters, and setters) contained in the class.
600 */
601 List<UnlinkedExecutable> get executables => _executables ?? const <UnlinkedExe cutable>[];
602
603 /**
604 * Indicates whether the class is declared with the `abstract` keyword.
605 */
606 bool get isAbstract => _isAbstract ?? false;
607
608 /**
609 * Indicates whether the class is declared using mixin application syntax.
610 */
611 bool get isMixinApplication => _isMixinApplication ?? false;
612
613 /**
614 * Indicates whether this class is the core "Object" class (and hence has no
615 * supertype)
616 */
617 bool get hasNoSupertype => _hasNoSupertype ?? false;
618 }
619
620 class UnlinkedClassBuilder {
621 final Map _json = {};
622
623 bool _finished = false;
624 672
625 UnlinkedClassBuilder(base.BuilderContext context); 673 UnlinkedClassBuilder(base.BuilderContext context);
626 674
627 /** 675 /**
628 * Name of the class. 676 * Name of the class.
629 */ 677 */
630 void set name(String _value) { 678 void set name(String _value) {
631 assert(!_finished); 679 assert(!_finished);
632 assert(!_json.containsKey("name")); 680 assert(!_nameIsSet);
633 if (_value != null) { 681 _nameIsSet = true;
634 _json["name"] = _value; 682 _name = _value;
635 }
636 } 683 }
637 684
638 /** 685 /**
639 * Offset of the class name relative to the beginning of the file. 686 * Offset of the class name relative to the beginning of the file.
640 */ 687 */
641 void set nameOffset(int _value) { 688 void set nameOffset(int _value) {
642 assert(!_finished); 689 assert(!_finished);
643 assert(!_json.containsKey("nameOffset")); 690 assert(!_nameOffsetIsSet);
644 if (_value != null) { 691 _nameOffsetIsSet = true;
645 _json["nameOffset"] = _value; 692 _nameOffset = _value;
646 }
647 } 693 }
648 694
649 /** 695 /**
650 * Documentation comment for the class, or `null` if there is no 696 * Documentation comment for the class, or `null` if there is no
651 * documentation comment. 697 * documentation comment.
652 */ 698 */
653 void set documentationComment(UnlinkedDocumentationCommentBuilder _value) { 699 void set documentationComment(UnlinkedDocumentationCommentBuilder _value) {
654 assert(!_finished); 700 assert(!_finished);
655 assert(!_json.containsKey("documentationComment")); 701 assert(!_documentationCommentIsSet);
656 if (_value != null) { 702 _documentationCommentIsSet = true;
657 _json["documentationComment"] = _value.finish(); 703 _documentationComment = _value;
658 }
659 } 704 }
660 705
661 /** 706 /**
662 * Type parameters of the class, if any. 707 * Type parameters of the class, if any.
663 */ 708 */
664 void set typeParameters(List<UnlinkedTypeParamBuilder> _value) { 709 void set typeParameters(List<UnlinkedTypeParamBuilder> _value) {
665 assert(!_finished); 710 assert(!_finished);
666 assert(!_json.containsKey("typeParameters")); 711 assert(!_typeParametersIsSet);
667 if (!(_value == null || _value.isEmpty)) { 712 _typeParametersIsSet = true;
668 _json["typeParameters"] = _value.map((b) => b.finish()).toList(); 713 _typeParameters = _value;
669 }
670 } 714 }
671 715
672 /** 716 /**
673 * Supertype of the class, or `null` if either (a) the class doesn't 717 * Supertype of the class, or `null` if either (a) the class doesn't
674 * explicitly declare a supertype (and hence has supertype `Object`), or (b) 718 * explicitly declare a supertype (and hence has supertype `Object`), or (b)
675 * the class *is* `Object` (and hence has no supertype). 719 * the class *is* `Object` (and hence has no supertype).
676 */ 720 */
677 void set supertype(UnlinkedTypeRefBuilder _value) { 721 void set supertype(UnlinkedTypeRefBuilder _value) {
678 assert(!_finished); 722 assert(!_finished);
679 assert(!_json.containsKey("supertype")); 723 assert(!_supertypeIsSet);
680 if (_value != null) { 724 _supertypeIsSet = true;
681 _json["supertype"] = _value.finish(); 725 _supertype = _value;
682 }
683 } 726 }
684 727
685 /** 728 /**
686 * Mixins appearing in a `with` clause, if any. 729 * Mixins appearing in a `with` clause, if any.
687 */ 730 */
688 void set mixins(List<UnlinkedTypeRefBuilder> _value) { 731 void set mixins(List<UnlinkedTypeRefBuilder> _value) {
689 assert(!_finished); 732 assert(!_finished);
690 assert(!_json.containsKey("mixins")); 733 assert(!_mixinsIsSet);
691 if (!(_value == null || _value.isEmpty)) { 734 _mixinsIsSet = true;
692 _json["mixins"] = _value.map((b) => b.finish()).toList(); 735 _mixins = _value;
693 }
694 } 736 }
695 737
696 /** 738 /**
697 * Interfaces appearing in an `implements` clause, if any. 739 * Interfaces appearing in an `implements` clause, if any.
698 */ 740 */
699 void set interfaces(List<UnlinkedTypeRefBuilder> _value) { 741 void set interfaces(List<UnlinkedTypeRefBuilder> _value) {
700 assert(!_finished); 742 assert(!_finished);
701 assert(!_json.containsKey("interfaces")); 743 assert(!_interfacesIsSet);
702 if (!(_value == null || _value.isEmpty)) { 744 _interfacesIsSet = true;
703 _json["interfaces"] = _value.map((b) => b.finish()).toList(); 745 _interfaces = _value;
704 }
705 } 746 }
706 747
707 /** 748 /**
708 * Field declarations contained in the class. 749 * Field declarations contained in the class.
709 */ 750 */
710 void set fields(List<UnlinkedVariableBuilder> _value) { 751 void set fields(List<UnlinkedVariableBuilder> _value) {
711 assert(!_finished); 752 assert(!_finished);
712 assert(!_json.containsKey("fields")); 753 assert(!_fieldsIsSet);
713 if (!(_value == null || _value.isEmpty)) { 754 _fieldsIsSet = true;
714 _json["fields"] = _value.map((b) => b.finish()).toList(); 755 _fields = _value;
715 }
716 } 756 }
717 757
718 /** 758 /**
719 * Executable objects (methods, getters, and setters) contained in the class. 759 * Executable objects (methods, getters, and setters) contained in the class.
720 */ 760 */
721 void set executables(List<UnlinkedExecutableBuilder> _value) { 761 void set executables(List<UnlinkedExecutableBuilder> _value) {
722 assert(!_finished); 762 assert(!_finished);
723 assert(!_json.containsKey("executables")); 763 assert(!_executablesIsSet);
724 if (!(_value == null || _value.isEmpty)) { 764 _executablesIsSet = true;
725 _json["executables"] = _value.map((b) => b.finish()).toList(); 765 _executables = _value;
726 }
727 } 766 }
728 767
729 /** 768 /**
730 * Indicates whether the class is declared with the `abstract` keyword. 769 * Indicates whether the class is declared with the `abstract` keyword.
731 */ 770 */
732 void set isAbstract(bool _value) { 771 void set isAbstract(bool _value) {
733 assert(!_finished); 772 assert(!_finished);
734 assert(!_json.containsKey("isAbstract")); 773 assert(!_isAbstractIsSet);
735 if (_value != null) { 774 _isAbstractIsSet = true;
736 _json["isAbstract"] = _value; 775 _isAbstract = _value;
737 }
738 } 776 }
739 777
740 /** 778 /**
741 * Indicates whether the class is declared using mixin application syntax. 779 * Indicates whether the class is declared using mixin application syntax.
742 */ 780 */
743 void set isMixinApplication(bool _value) { 781 void set isMixinApplication(bool _value) {
744 assert(!_finished); 782 assert(!_finished);
745 assert(!_json.containsKey("isMixinApplication")); 783 assert(!_isMixinApplicationIsSet);
746 if (_value != null) { 784 _isMixinApplicationIsSet = true;
747 _json["isMixinApplication"] = _value; 785 _isMixinApplication = _value;
748 }
749 } 786 }
750 787
751 /** 788 /**
752 * Indicates whether this class is the core "Object" class (and hence has no 789 * Indicates whether this class is the core "Object" class (and hence has no
753 * supertype) 790 * supertype)
754 */ 791 */
755 void set hasNoSupertype(bool _value) { 792 void set hasNoSupertype(bool _value) {
756 assert(!_finished); 793 assert(!_finished);
757 assert(!_json.containsKey("hasNoSupertype")); 794 assert(!_hasNoSupertypeIsSet);
758 if (_value != null) { 795 _hasNoSupertypeIsSet = true;
759 _json["hasNoSupertype"] = _value; 796 _hasNoSupertype = _value;
760 }
761 } 797 }
762 798
763 Map finish() { 799 fb.Offset finish(fb.Builder fbBuilder) {
764 assert(!_finished); 800 assert(!_finished);
765 _finished = true; 801 _finished = true;
766 return _json; 802 fb.Offset offset_name;
803 fb.Offset offset_documentationComment;
804 fb.Offset offset_typeParameters;
805 fb.Offset offset_supertype;
806 fb.Offset offset_mixins;
807 fb.Offset offset_interfaces;
808 fb.Offset offset_fields;
809 fb.Offset offset_executables;
810 if (_name != null) {
811 offset_name = fbBuilder.writeString(_name);
812 }
813 if (_documentationComment != null) {
814 offset_documentationComment = _documentationComment.finish(fbBuilder);
815 }
816 if (!(_typeParameters == null || _typeParameters.isEmpty)) {
817 offset_typeParameters = fbBuilder.writeList(_typeParameters.map((b) => b.f inish(fbBuilder)).toList());
818 }
819 if (_supertype != null) {
820 offset_supertype = _supertype.finish(fbBuilder);
821 }
822 if (!(_mixins == null || _mixins.isEmpty)) {
823 offset_mixins = fbBuilder.writeList(_mixins.map((b) => b.finish(fbBuilder) ).toList());
824 }
825 if (!(_interfaces == null || _interfaces.isEmpty)) {
826 offset_interfaces = fbBuilder.writeList(_interfaces.map((b) => b.finish(fb Builder)).toList());
827 }
828 if (!(_fields == null || _fields.isEmpty)) {
829 offset_fields = fbBuilder.writeList(_fields.map((b) => b.finish(fbBuilder) ).toList());
830 }
831 if (!(_executables == null || _executables.isEmpty)) {
832 offset_executables = fbBuilder.writeList(_executables.map((b) => b.finish( fbBuilder)).toList());
833 }
834 fbBuilder.startTable();
835 if (offset_name != null) {
836 fbBuilder.addOffset(0, offset_name);
837 }
838 if (_nameOffset != null && _nameOffset != 0) {
839 fbBuilder.addInt32(1, _nameOffset);
840 }
841 if (offset_documentationComment != null) {
842 fbBuilder.addOffset(2, offset_documentationComment);
843 }
844 if (offset_typeParameters != null) {
845 fbBuilder.addOffset(3, offset_typeParameters);
846 }
847 if (offset_supertype != null) {
848 fbBuilder.addOffset(4, offset_supertype);
849 }
850 if (offset_mixins != null) {
851 fbBuilder.addOffset(5, offset_mixins);
852 }
853 if (offset_interfaces != null) {
854 fbBuilder.addOffset(6, offset_interfaces);
855 }
856 if (offset_fields != null) {
857 fbBuilder.addOffset(7, offset_fields);
858 }
859 if (offset_executables != null) {
860 fbBuilder.addOffset(8, offset_executables);
861 }
862 if (_isAbstract == true) {
863 fbBuilder.addInt8(9, 1);
864 }
865 if (_isMixinApplication == true) {
866 fbBuilder.addInt8(10, 1);
867 }
868 if (_hasNoSupertype == true) {
869 fbBuilder.addInt8(11, 1);
870 }
871 return fbBuilder.endTable();
767 } 872 }
768 } 873 }
769 874
770 UnlinkedClassBuilder encodeUnlinkedClass(base.BuilderContext builderContext, {St ring name, int nameOffset, UnlinkedDocumentationCommentBuilder documentationComm ent, List<UnlinkedTypeParamBuilder> typeParameters, UnlinkedTypeRefBuilder super type, List<UnlinkedTypeRefBuilder> mixins, List<UnlinkedTypeRefBuilder> interfac es, List<UnlinkedVariableBuilder> fields, List<UnlinkedExecutableBuilder> execut ables, bool isAbstract, bool isMixinApplication, bool hasNoSupertype}) { 875 UnlinkedClassBuilder encodeUnlinkedClass(base.BuilderContext builderContext, {St ring name, int nameOffset, UnlinkedDocumentationCommentBuilder documentationComm ent, List<UnlinkedTypeParamBuilder> typeParameters, UnlinkedTypeRefBuilder super type, List<UnlinkedTypeRefBuilder> mixins, List<UnlinkedTypeRefBuilder> interfac es, List<UnlinkedVariableBuilder> fields, List<UnlinkedExecutableBuilder> execut ables, bool isAbstract, bool isMixinApplication, bool hasNoSupertype}) {
771 UnlinkedClassBuilder builder = new UnlinkedClassBuilder(builderContext); 876 UnlinkedClassBuilder builder = new UnlinkedClassBuilder(builderContext);
772 builder.name = name; 877 builder.name = name;
773 builder.nameOffset = nameOffset; 878 builder.nameOffset = nameOffset;
774 builder.documentationComment = documentationComment; 879 builder.documentationComment = documentationComment;
775 builder.typeParameters = typeParameters; 880 builder.typeParameters = typeParameters;
776 builder.supertype = supertype; 881 builder.supertype = supertype;
777 builder.mixins = mixins; 882 builder.mixins = mixins;
778 builder.interfaces = interfaces; 883 builder.interfaces = interfaces;
779 builder.fields = fields; 884 builder.fields = fields;
780 builder.executables = executables; 885 builder.executables = executables;
781 builder.isAbstract = isAbstract; 886 builder.isAbstract = isAbstract;
782 builder.isMixinApplication = isMixinApplication; 887 builder.isMixinApplication = isMixinApplication;
783 builder.hasNoSupertype = hasNoSupertype; 888 builder.hasNoSupertype = hasNoSupertype;
784 return builder; 889 return builder;
785 } 890 }
786 891
787 /** 892 /**
788 * Unlinked summary information about a `show` or `hide` combinator in an 893 * Unlinked summary information about a class declaration.
789 * import or export declaration.
790 */ 894 */
791 class UnlinkedCombinator extends base.SummaryClass { 895 abstract class UnlinkedClass extends base.SummaryClass {
896
897 /**
898 * Name of the class.
899 */
900 String get name;
901
902 /**
903 * Offset of the class name relative to the beginning of the file.
904 */
905 int get nameOffset;
906
907 /**
908 * Documentation comment for the class, or `null` if there is no
909 * documentation comment.
910 */
911 UnlinkedDocumentationComment get documentationComment;
912
913 /**
914 * Type parameters of the class, if any.
915 */
916 List<UnlinkedTypeParam> get typeParameters;
917
918 /**
919 * Supertype of the class, or `null` if either (a) the class doesn't
920 * explicitly declare a supertype (and hence has supertype `Object`), or (b)
921 * the class *is* `Object` (and hence has no supertype).
922 */
923 UnlinkedTypeRef get supertype;
924
925 /**
926 * Mixins appearing in a `with` clause, if any.
927 */
928 List<UnlinkedTypeRef> get mixins;
929
930 /**
931 * Interfaces appearing in an `implements` clause, if any.
932 */
933 List<UnlinkedTypeRef> get interfaces;
934
935 /**
936 * Field declarations contained in the class.
937 */
938 List<UnlinkedVariable> get fields;
939
940 /**
941 * Executable objects (methods, getters, and setters) contained in the class.
942 */
943 List<UnlinkedExecutable> get executables;
944
945 /**
946 * Indicates whether the class is declared with the `abstract` keyword.
947 */
948 bool get isAbstract;
949
950 /**
951 * Indicates whether the class is declared using mixin application syntax.
952 */
953 bool get isMixinApplication;
954
955 /**
956 * Indicates whether this class is the core "Object" class (and hence has no
957 * supertype)
958 */
959 bool get hasNoSupertype;
960 }
961
962 class _UnlinkedClassReader extends fb.TableReader<_UnlinkedClassReader> implemen ts UnlinkedClass {
963 final fb.BufferPointer _bp;
964
965 const _UnlinkedClassReader([this._bp]);
966
967 @override
968 _UnlinkedClassReader createReader(fb.BufferPointer bp) => new _UnlinkedClassRe ader(bp);
969
970 @override
971 Map<String, Object> toMap() => {};
972
973 @override
974 String get name => const fb.StringReader().vTableGet(_bp, 0, '');
975
976 @override
977 int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
978
979 @override
980 UnlinkedDocumentationComment get documentationComment => const _UnlinkedDocume ntationCommentReader().vTableGet(_bp, 2, null);
981
982 @override
983 List<UnlinkedTypeParam> get typeParameters => const fb.ListReader<UnlinkedType Param>(const _UnlinkedTypeParamReader()).vTableGet(_bp, 3, const <UnlinkedTypePa ram>[]);
984
985 @override
986 UnlinkedTypeRef get supertype => const _UnlinkedTypeRefReader().vTableGet(_bp, 4, null);
987
988 @override
989 List<UnlinkedTypeRef> get mixins => const fb.ListReader<UnlinkedTypeRef>(const _UnlinkedTypeRefReader()).vTableGet(_bp, 5, const <UnlinkedTypeRef>[]);
990
991 @override
992 List<UnlinkedTypeRef> get interfaces => const fb.ListReader<UnlinkedTypeRef>(c onst _UnlinkedTypeRefReader()).vTableGet(_bp, 6, const <UnlinkedTypeRef>[]);
993
994 @override
995 List<UnlinkedVariable> get fields => const fb.ListReader<UnlinkedVariable>(con st _UnlinkedVariableReader()).vTableGet(_bp, 7, const <UnlinkedVariable>[]);
996
997 @override
998 List<UnlinkedExecutable> get executables => const fb.ListReader<UnlinkedExecut able>(const _UnlinkedExecutableReader()).vTableGet(_bp, 8, const <UnlinkedExecut able>[]);
999
1000 @override
1001 bool get isAbstract => const fb.Int8Reader().vTableGet(_bp, 9, 0) == 1;
1002
1003 @override
1004 bool get isMixinApplication => const fb.Int8Reader().vTableGet(_bp, 10, 0) == 1;
1005
1006 @override
1007 bool get hasNoSupertype => const fb.Int8Reader().vTableGet(_bp, 11, 0) == 1;
1008 }
1009
1010 class UnlinkedCombinatorBuilder {
1011 bool _finished = false;
1012
792 List<String> _shows; 1013 List<String> _shows;
793 List<String> _hides; 1014 List<String> _hides;
794 1015
795 UnlinkedCombinator.fromJson(Map json) 1016 bool _showsIsSet = false;
796 : _shows = json["shows"], 1017 bool _hidesIsSet = false;
797 _hides = json["hides"];
798
799 @override
800 Map<String, Object> toMap() => {
801 "shows": shows,
802 "hides": hides,
803 };
804
805 /**
806 * List of names which are shown. Empty if this is a `hide` combinator.
807 */
808 List<String> get shows => _shows ?? const <String>[];
809
810 /**
811 * List of names which are hidden. Empty if this is a `show` combinator.
812 */
813 List<String> get hides => _hides ?? const <String>[];
814 }
815
816 class UnlinkedCombinatorBuilder {
817 final Map _json = {};
818
819 bool _finished = false;
820 1018
821 UnlinkedCombinatorBuilder(base.BuilderContext context); 1019 UnlinkedCombinatorBuilder(base.BuilderContext context);
822 1020
823 /** 1021 /**
824 * List of names which are shown. Empty if this is a `hide` combinator. 1022 * List of names which are shown. Empty if this is a `hide` combinator.
825 */ 1023 */
826 void set shows(List<String> _value) { 1024 void set shows(List<String> _value) {
827 assert(!_finished); 1025 assert(!_finished);
828 assert(!_json.containsKey("shows")); 1026 assert(!_showsIsSet);
829 if (!(_value == null || _value.isEmpty)) { 1027 _showsIsSet = true;
830 _json["shows"] = _value.toList(); 1028 _shows = _value;
831 }
832 } 1029 }
833 1030
834 /** 1031 /**
835 * List of names which are hidden. Empty if this is a `show` combinator. 1032 * List of names which are hidden. Empty if this is a `show` combinator.
836 */ 1033 */
837 void set hides(List<String> _value) { 1034 void set hides(List<String> _value) {
838 assert(!_finished); 1035 assert(!_finished);
839 assert(!_json.containsKey("hides")); 1036 assert(!_hidesIsSet);
840 if (!(_value == null || _value.isEmpty)) { 1037 _hidesIsSet = true;
841 _json["hides"] = _value.toList(); 1038 _hides = _value;
842 }
843 } 1039 }
844 1040
845 Map finish() { 1041 fb.Offset finish(fb.Builder fbBuilder) {
846 assert(!_finished); 1042 assert(!_finished);
847 _finished = true; 1043 _finished = true;
848 return _json; 1044 fb.Offset offset_shows;
1045 fb.Offset offset_hides;
1046 if (!(_shows == null || _shows.isEmpty)) {
1047 offset_shows = fbBuilder.writeList(_shows.map((b) => fbBuilder.writeString (b)).toList());
1048 }
1049 if (!(_hides == null || _hides.isEmpty)) {
1050 offset_hides = fbBuilder.writeList(_hides.map((b) => fbBuilder.writeString (b)).toList());
1051 }
1052 fbBuilder.startTable();
1053 if (offset_shows != null) {
1054 fbBuilder.addOffset(0, offset_shows);
1055 }
1056 if (offset_hides != null) {
1057 fbBuilder.addOffset(1, offset_hides);
1058 }
1059 return fbBuilder.endTable();
849 } 1060 }
850 } 1061 }
851 1062
852 UnlinkedCombinatorBuilder encodeUnlinkedCombinator(base.BuilderContext builderCo ntext, {List<String> shows, List<String> hides}) { 1063 UnlinkedCombinatorBuilder encodeUnlinkedCombinator(base.BuilderContext builderCo ntext, {List<String> shows, List<String> hides}) {
853 UnlinkedCombinatorBuilder builder = new UnlinkedCombinatorBuilder(builderConte xt); 1064 UnlinkedCombinatorBuilder builder = new UnlinkedCombinatorBuilder(builderConte xt);
854 builder.shows = shows; 1065 builder.shows = shows;
855 builder.hides = hides; 1066 builder.hides = hides;
856 return builder; 1067 return builder;
857 } 1068 }
858 1069
859 /** 1070 /**
860 * Unlinked summary information about a documentation comment. 1071 * Unlinked summary information about a `show` or `hide` combinator in an
1072 * import or export declaration.
861 */ 1073 */
862 class UnlinkedDocumentationComment extends base.SummaryClass { 1074 abstract class UnlinkedCombinator extends base.SummaryClass {
863 String _text;
864 1075
865 UnlinkedDocumentationComment.fromJson(Map json) 1076 /**
866 : _text = json["text"]; 1077 * List of names which are shown. Empty if this is a `hide` combinator.
1078 */
1079 List<String> get shows;
1080
1081 /**
1082 * List of names which are hidden. Empty if this is a `show` combinator.
1083 */
1084 List<String> get hides;
1085 }
1086
1087 class _UnlinkedCombinatorReader extends fb.TableReader<_UnlinkedCombinatorReader > implements UnlinkedCombinator {
1088 final fb.BufferPointer _bp;
1089
1090 const _UnlinkedCombinatorReader([this._bp]);
867 1091
868 @override 1092 @override
869 Map<String, Object> toMap() => { 1093 _UnlinkedCombinatorReader createReader(fb.BufferPointer bp) => new _UnlinkedCo mbinatorReader(bp);
870 "text": text,
871 };
872 1094
873 /** 1095 @override
874 * Text of the documentation comment, with '\r\n' replaced by '\n'. 1096 Map<String, Object> toMap() => {};
875 * 1097
876 * References appearing within the doc comment in square brackets are not 1098 @override
877 * specially encoded. 1099 List<String> get shows => const fb.ListReader<String>(const fb.StringReader()) .vTableGet(_bp, 0, const <String>[]);
878 */ 1100
879 String get text => _text ?? ''; 1101 @override
1102 List<String> get hides => const fb.ListReader<String>(const fb.StringReader()) .vTableGet(_bp, 1, const <String>[]);
880 } 1103 }
881 1104
882 class UnlinkedDocumentationCommentBuilder { 1105 class UnlinkedDocumentationCommentBuilder {
883 final Map _json = {}; 1106 bool _finished = false;
884 1107
885 bool _finished = false; 1108 String _text;
1109
1110 bool _textIsSet = false;
886 1111
887 UnlinkedDocumentationCommentBuilder(base.BuilderContext context); 1112 UnlinkedDocumentationCommentBuilder(base.BuilderContext context);
888 1113
889 /** 1114 /**
890 * Text of the documentation comment, with '\r\n' replaced by '\n'. 1115 * Text of the documentation comment, with '\r\n' replaced by '\n'.
891 * 1116 *
892 * References appearing within the doc comment in square brackets are not 1117 * References appearing within the doc comment in square brackets are not
893 * specially encoded. 1118 * specially encoded.
894 */ 1119 */
895 void set text(String _value) { 1120 void set text(String _value) {
896 assert(!_finished); 1121 assert(!_finished);
897 assert(!_json.containsKey("text")); 1122 assert(!_textIsSet);
898 if (_value != null) { 1123 _textIsSet = true;
899 _json["text"] = _value; 1124 _text = _value;
900 }
901 } 1125 }
902 1126
903 Map finish() { 1127 fb.Offset finish(fb.Builder fbBuilder) {
904 assert(!_finished); 1128 assert(!_finished);
905 _finished = true; 1129 _finished = true;
906 return _json; 1130 fb.Offset offset_text;
1131 if (_text != null) {
1132 offset_text = fbBuilder.writeString(_text);
1133 }
1134 fbBuilder.startTable();
1135 if (offset_text != null) {
1136 fbBuilder.addOffset(0, offset_text);
1137 }
1138 return fbBuilder.endTable();
907 } 1139 }
908 } 1140 }
909 1141
910 UnlinkedDocumentationCommentBuilder encodeUnlinkedDocumentationComment(base.Buil derContext builderContext, {String text}) { 1142 UnlinkedDocumentationCommentBuilder encodeUnlinkedDocumentationComment(base.Buil derContext builderContext, {String text}) {
911 UnlinkedDocumentationCommentBuilder builder = new UnlinkedDocumentationComment Builder(builderContext); 1143 UnlinkedDocumentationCommentBuilder builder = new UnlinkedDocumentationComment Builder(builderContext);
912 builder.text = text; 1144 builder.text = text;
913 return builder; 1145 return builder;
914 } 1146 }
915 1147
916 /** 1148 /**
917 * Unlinked summary information about an enum declaration. 1149 * Unlinked summary information about a documentation comment.
918 */ 1150 */
919 class UnlinkedEnum extends base.SummaryClass { 1151 abstract class UnlinkedDocumentationComment extends base.SummaryClass {
920 String _name;
921 int _nameOffset;
922 UnlinkedDocumentationComment _documentationComment;
923 List<UnlinkedEnumValue> _values;
924 1152
925 UnlinkedEnum.fromJson(Map json) 1153 /**
926 : _name = json["name"], 1154 * Text of the documentation comment, with '\r\n' replaced by '\n'.
927 _nameOffset = json["nameOffset"], 1155 *
928 _documentationComment = json["documentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["documentationComment"]), 1156 * References appearing within the doc comment in square brackets are not
929 _values = json["values"]?.map((x) => new UnlinkedEnumValue.fromJson(x))?.t oList(); 1157 * specially encoded.
1158 */
1159 String get text;
1160 }
1161
1162 class _UnlinkedDocumentationCommentReader extends fb.TableReader<_UnlinkedDocume ntationCommentReader> implements UnlinkedDocumentationComment {
1163 final fb.BufferPointer _bp;
1164
1165 const _UnlinkedDocumentationCommentReader([this._bp]);
930 1166
931 @override 1167 @override
932 Map<String, Object> toMap() => { 1168 _UnlinkedDocumentationCommentReader createReader(fb.BufferPointer bp) => new _ UnlinkedDocumentationCommentReader(bp);
933 "name": name,
934 "nameOffset": nameOffset,
935 "documentationComment": documentationComment,
936 "values": values,
937 };
938 1169
939 /** 1170 @override
940 * Name of the enum type. 1171 Map<String, Object> toMap() => {};
941 */
942 String get name => _name ?? '';
943 1172
944 /** 1173 @override
945 * Offset of the enum name relative to the beginning of the file. 1174 String get text => const fb.StringReader().vTableGet(_bp, 0, '');
946 */
947 int get nameOffset => _nameOffset ?? 0;
948
949 /**
950 * Documentation comment for the enum, or `null` if there is no documentation
951 * comment.
952 */
953 UnlinkedDocumentationComment get documentationComment => _documentationComment ;
954
955 /**
956 * Values listed in the enum declaration, in declaration order.
957 */
958 List<UnlinkedEnumValue> get values => _values ?? const <UnlinkedEnumValue>[];
959 } 1175 }
960 1176
961 class UnlinkedEnumBuilder { 1177 class UnlinkedEnumBuilder {
962 final Map _json = {}; 1178 bool _finished = false;
963 1179
964 bool _finished = false; 1180 String _name;
1181 int _nameOffset;
1182 UnlinkedDocumentationCommentBuilder _documentationComment;
1183 List<UnlinkedEnumValueBuilder> _values;
1184
1185 bool _nameIsSet = false;
1186 bool _nameOffsetIsSet = false;
1187 bool _documentationCommentIsSet = false;
1188 bool _valuesIsSet = false;
965 1189
966 UnlinkedEnumBuilder(base.BuilderContext context); 1190 UnlinkedEnumBuilder(base.BuilderContext context);
967 1191
968 /** 1192 /**
969 * Name of the enum type. 1193 * Name of the enum type.
970 */ 1194 */
971 void set name(String _value) { 1195 void set name(String _value) {
972 assert(!_finished); 1196 assert(!_finished);
973 assert(!_json.containsKey("name")); 1197 assert(!_nameIsSet);
974 if (_value != null) { 1198 _nameIsSet = true;
975 _json["name"] = _value; 1199 _name = _value;
976 }
977 } 1200 }
978 1201
979 /** 1202 /**
980 * Offset of the enum name relative to the beginning of the file. 1203 * Offset of the enum name relative to the beginning of the file.
981 */ 1204 */
982 void set nameOffset(int _value) { 1205 void set nameOffset(int _value) {
983 assert(!_finished); 1206 assert(!_finished);
984 assert(!_json.containsKey("nameOffset")); 1207 assert(!_nameOffsetIsSet);
985 if (_value != null) { 1208 _nameOffsetIsSet = true;
986 _json["nameOffset"] = _value; 1209 _nameOffset = _value;
987 }
988 } 1210 }
989 1211
990 /** 1212 /**
991 * Documentation comment for the enum, or `null` if there is no documentation 1213 * Documentation comment for the enum, or `null` if there is no documentation
992 * comment. 1214 * comment.
993 */ 1215 */
994 void set documentationComment(UnlinkedDocumentationCommentBuilder _value) { 1216 void set documentationComment(UnlinkedDocumentationCommentBuilder _value) {
995 assert(!_finished); 1217 assert(!_finished);
996 assert(!_json.containsKey("documentationComment")); 1218 assert(!_documentationCommentIsSet);
997 if (_value != null) { 1219 _documentationCommentIsSet = true;
998 _json["documentationComment"] = _value.finish(); 1220 _documentationComment = _value;
999 }
1000 } 1221 }
1001 1222
1002 /** 1223 /**
1003 * Values listed in the enum declaration, in declaration order. 1224 * Values listed in the enum declaration, in declaration order.
1004 */ 1225 */
1005 void set values(List<UnlinkedEnumValueBuilder> _value) { 1226 void set values(List<UnlinkedEnumValueBuilder> _value) {
1006 assert(!_finished); 1227 assert(!_finished);
1007 assert(!_json.containsKey("values")); 1228 assert(!_valuesIsSet);
1008 if (!(_value == null || _value.isEmpty)) { 1229 _valuesIsSet = true;
1009 _json["values"] = _value.map((b) => b.finish()).toList(); 1230 _values = _value;
1010 }
1011 } 1231 }
1012 1232
1013 Map finish() { 1233 fb.Offset finish(fb.Builder fbBuilder) {
1014 assert(!_finished); 1234 assert(!_finished);
1015 _finished = true; 1235 _finished = true;
1016 return _json; 1236 fb.Offset offset_name;
1237 fb.Offset offset_documentationComment;
1238 fb.Offset offset_values;
1239 if (_name != null) {
1240 offset_name = fbBuilder.writeString(_name);
1241 }
1242 if (_documentationComment != null) {
1243 offset_documentationComment = _documentationComment.finish(fbBuilder);
1244 }
1245 if (!(_values == null || _values.isEmpty)) {
1246 offset_values = fbBuilder.writeList(_values.map((b) => b.finish(fbBuilder) ).toList());
1247 }
1248 fbBuilder.startTable();
1249 if (offset_name != null) {
1250 fbBuilder.addOffset(0, offset_name);
1251 }
1252 if (_nameOffset != null && _nameOffset != 0) {
1253 fbBuilder.addInt32(1, _nameOffset);
1254 }
1255 if (offset_documentationComment != null) {
1256 fbBuilder.addOffset(2, offset_documentationComment);
1257 }
1258 if (offset_values != null) {
1259 fbBuilder.addOffset(3, offset_values);
1260 }
1261 return fbBuilder.endTable();
1017 } 1262 }
1018 } 1263 }
1019 1264
1020 UnlinkedEnumBuilder encodeUnlinkedEnum(base.BuilderContext builderContext, {Stri ng name, int nameOffset, UnlinkedDocumentationCommentBuilder documentationCommen t, List<UnlinkedEnumValueBuilder> values}) { 1265 UnlinkedEnumBuilder encodeUnlinkedEnum(base.BuilderContext builderContext, {Stri ng name, int nameOffset, UnlinkedDocumentationCommentBuilder documentationCommen t, List<UnlinkedEnumValueBuilder> values}) {
1021 UnlinkedEnumBuilder builder = new UnlinkedEnumBuilder(builderContext); 1266 UnlinkedEnumBuilder builder = new UnlinkedEnumBuilder(builderContext);
1022 builder.name = name; 1267 builder.name = name;
1023 builder.nameOffset = nameOffset; 1268 builder.nameOffset = nameOffset;
1024 builder.documentationComment = documentationComment; 1269 builder.documentationComment = documentationComment;
1025 builder.values = values; 1270 builder.values = values;
1026 return builder; 1271 return builder;
1027 } 1272 }
1028 1273
1029 /** 1274 /**
1030 * Unlinked summary information about a single enumerated value in an enum 1275 * Unlinked summary information about an enum declaration.
1031 * declaration.
1032 */ 1276 */
1033 class UnlinkedEnumValue extends base.SummaryClass { 1277 abstract class UnlinkedEnum extends base.SummaryClass {
1034 String _name;
1035 int _nameOffset;
1036 UnlinkedDocumentationComment _documentationComment;
1037 1278
1038 UnlinkedEnumValue.fromJson(Map json) 1279 /**
1039 : _name = json["name"], 1280 * Name of the enum type.
1040 _nameOffset = json["nameOffset"], 1281 */
1041 _documentationComment = json["documentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["documentationComment"]); 1282 String get name;
1283
1284 /**
1285 * Offset of the enum name relative to the beginning of the file.
1286 */
1287 int get nameOffset;
1288
1289 /**
1290 * Documentation comment for the enum, or `null` if there is no documentation
1291 * comment.
1292 */
1293 UnlinkedDocumentationComment get documentationComment;
1294
1295 /**
1296 * Values listed in the enum declaration, in declaration order.
1297 */
1298 List<UnlinkedEnumValue> get values;
1299 }
1300
1301 class _UnlinkedEnumReader extends fb.TableReader<_UnlinkedEnumReader> implements UnlinkedEnum {
1302 final fb.BufferPointer _bp;
1303
1304 const _UnlinkedEnumReader([this._bp]);
1042 1305
1043 @override 1306 @override
1044 Map<String, Object> toMap() => { 1307 _UnlinkedEnumReader createReader(fb.BufferPointer bp) => new _UnlinkedEnumRead er(bp);
1045 "name": name,
1046 "nameOffset": nameOffset,
1047 "documentationComment": documentationComment,
1048 };
1049 1308
1050 /** 1309 @override
1051 * Name of the enumerated value. 1310 Map<String, Object> toMap() => {};
1052 */
1053 String get name => _name ?? '';
1054 1311
1055 /** 1312 @override
1056 * Offset of the enum value name relative to the beginning of the file. 1313 String get name => const fb.StringReader().vTableGet(_bp, 0, '');
1057 */
1058 int get nameOffset => _nameOffset ?? 0;
1059 1314
1060 /** 1315 @override
1061 * Documentation comment for the enum value, or `null` if there is no 1316 int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
1062 * documentation comment. 1317
1063 */ 1318 @override
1064 UnlinkedDocumentationComment get documentationComment => _documentationComment ; 1319 UnlinkedDocumentationComment get documentationComment => const _UnlinkedDocume ntationCommentReader().vTableGet(_bp, 2, null);
1320
1321 @override
1322 List<UnlinkedEnumValue> get values => const fb.ListReader<UnlinkedEnumValue>(c onst _UnlinkedEnumValueReader()).vTableGet(_bp, 3, const <UnlinkedEnumValue>[]);
1065 } 1323 }
1066 1324
1067 class UnlinkedEnumValueBuilder { 1325 class UnlinkedEnumValueBuilder {
1068 final Map _json = {}; 1326 bool _finished = false;
1069 1327
1070 bool _finished = false; 1328 String _name;
1329 int _nameOffset;
1330 UnlinkedDocumentationCommentBuilder _documentationComment;
1331
1332 bool _nameIsSet = false;
1333 bool _nameOffsetIsSet = false;
1334 bool _documentationCommentIsSet = false;
1071 1335
1072 UnlinkedEnumValueBuilder(base.BuilderContext context); 1336 UnlinkedEnumValueBuilder(base.BuilderContext context);
1073 1337
1074 /** 1338 /**
1075 * Name of the enumerated value. 1339 * Name of the enumerated value.
1076 */ 1340 */
1077 void set name(String _value) { 1341 void set name(String _value) {
1078 assert(!_finished); 1342 assert(!_finished);
1079 assert(!_json.containsKey("name")); 1343 assert(!_nameIsSet);
1080 if (_value != null) { 1344 _nameIsSet = true;
1081 _json["name"] = _value; 1345 _name = _value;
1082 }
1083 } 1346 }
1084 1347
1085 /** 1348 /**
1086 * Offset of the enum value name relative to the beginning of the file. 1349 * Offset of the enum value name relative to the beginning of the file.
1087 */ 1350 */
1088 void set nameOffset(int _value) { 1351 void set nameOffset(int _value) {
1089 assert(!_finished); 1352 assert(!_finished);
1090 assert(!_json.containsKey("nameOffset")); 1353 assert(!_nameOffsetIsSet);
1091 if (_value != null) { 1354 _nameOffsetIsSet = true;
1092 _json["nameOffset"] = _value; 1355 _nameOffset = _value;
1093 }
1094 } 1356 }
1095 1357
1096 /** 1358 /**
1097 * Documentation comment for the enum value, or `null` if there is no 1359 * Documentation comment for the enum value, or `null` if there is no
1098 * documentation comment. 1360 * documentation comment.
1099 */ 1361 */
1100 void set documentationComment(UnlinkedDocumentationCommentBuilder _value) { 1362 void set documentationComment(UnlinkedDocumentationCommentBuilder _value) {
1101 assert(!_finished); 1363 assert(!_finished);
1102 assert(!_json.containsKey("documentationComment")); 1364 assert(!_documentationCommentIsSet);
1103 if (_value != null) { 1365 _documentationCommentIsSet = true;
1104 _json["documentationComment"] = _value.finish(); 1366 _documentationComment = _value;
1105 }
1106 } 1367 }
1107 1368
1108 Map finish() { 1369 fb.Offset finish(fb.Builder fbBuilder) {
1109 assert(!_finished); 1370 assert(!_finished);
1110 _finished = true; 1371 _finished = true;
1111 return _json; 1372 fb.Offset offset_name;
1373 fb.Offset offset_documentationComment;
1374 if (_name != null) {
1375 offset_name = fbBuilder.writeString(_name);
1376 }
1377 if (_documentationComment != null) {
1378 offset_documentationComment = _documentationComment.finish(fbBuilder);
1379 }
1380 fbBuilder.startTable();
1381 if (offset_name != null) {
1382 fbBuilder.addOffset(0, offset_name);
1383 }
1384 if (_nameOffset != null && _nameOffset != 0) {
1385 fbBuilder.addInt32(1, _nameOffset);
1386 }
1387 if (offset_documentationComment != null) {
1388 fbBuilder.addOffset(2, offset_documentationComment);
1389 }
1390 return fbBuilder.endTable();
1112 } 1391 }
1113 } 1392 }
1114 1393
1115 UnlinkedEnumValueBuilder encodeUnlinkedEnumValue(base.BuilderContext builderCont ext, {String name, int nameOffset, UnlinkedDocumentationCommentBuilder documenta tionComment}) { 1394 UnlinkedEnumValueBuilder encodeUnlinkedEnumValue(base.BuilderContext builderCont ext, {String name, int nameOffset, UnlinkedDocumentationCommentBuilder documenta tionComment}) {
1116 UnlinkedEnumValueBuilder builder = new UnlinkedEnumValueBuilder(builderContext ); 1395 UnlinkedEnumValueBuilder builder = new UnlinkedEnumValueBuilder(builderContext );
1117 builder.name = name; 1396 builder.name = name;
1118 builder.nameOffset = nameOffset; 1397 builder.nameOffset = nameOffset;
1119 builder.documentationComment = documentationComment; 1398 builder.documentationComment = documentationComment;
1120 return builder; 1399 return builder;
1121 } 1400 }
1122 1401
1123 /** 1402 /**
1124 * Unlinked summary information about a function, method, getter, or setter 1403 * Unlinked summary information about a single enumerated value in an enum
1125 * declaration. 1404 * declaration.
1126 */ 1405 */
1127 class UnlinkedExecutable extends base.SummaryClass { 1406 abstract class UnlinkedEnumValue extends base.SummaryClass {
1407
1408 /**
1409 * Name of the enumerated value.
1410 */
1411 String get name;
1412
1413 /**
1414 * Offset of the enum value name relative to the beginning of the file.
1415 */
1416 int get nameOffset;
1417
1418 /**
1419 * Documentation comment for the enum value, or `null` if there is no
1420 * documentation comment.
1421 */
1422 UnlinkedDocumentationComment get documentationComment;
1423 }
1424
1425 class _UnlinkedEnumValueReader extends fb.TableReader<_UnlinkedEnumValueReader> implements UnlinkedEnumValue {
1426 final fb.BufferPointer _bp;
1427
1428 const _UnlinkedEnumValueReader([this._bp]);
1429
1430 @override
1431 _UnlinkedEnumValueReader createReader(fb.BufferPointer bp) => new _UnlinkedEnu mValueReader(bp);
1432
1433 @override
1434 Map<String, Object> toMap() => {};
1435
1436 @override
1437 String get name => const fb.StringReader().vTableGet(_bp, 0, '');
1438
1439 @override
1440 int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
1441
1442 @override
1443 UnlinkedDocumentationComment get documentationComment => const _UnlinkedDocume ntationCommentReader().vTableGet(_bp, 2, null);
1444 }
1445
1446 class UnlinkedExecutableBuilder {
1447 bool _finished = false;
1448
1128 String _name; 1449 String _name;
1129 int _nameOffset; 1450 int _nameOffset;
1130 UnlinkedDocumentationComment _documentationComment; 1451 UnlinkedDocumentationCommentBuilder _documentationComment;
1131 List<UnlinkedTypeParam> _typeParameters; 1452 List<UnlinkedTypeParamBuilder> _typeParameters;
1132 UnlinkedTypeRef _returnType; 1453 UnlinkedTypeRefBuilder _returnType;
1133 List<UnlinkedParam> _parameters; 1454 List<UnlinkedParamBuilder> _parameters;
1134 UnlinkedExecutableKind _kind; 1455 UnlinkedExecutableKind _kind;
1135 bool _isAbstract; 1456 bool _isAbstract;
1136 bool _isStatic; 1457 bool _isStatic;
1137 bool _isConst; 1458 bool _isConst;
1138 bool _isFactory; 1459 bool _isFactory;
1139 bool _hasImplicitReturnType; 1460 bool _hasImplicitReturnType;
1140 bool _isExternal; 1461 bool _isExternal;
1141 1462
1142 UnlinkedExecutable.fromJson(Map json) 1463 bool _nameIsSet = false;
1143 : _name = json["name"], 1464 bool _nameOffsetIsSet = false;
1144 _nameOffset = json["nameOffset"], 1465 bool _documentationCommentIsSet = false;
1145 _documentationComment = json["documentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["documentationComment"]), 1466 bool _typeParametersIsSet = false;
1146 _typeParameters = json["typeParameters"]?.map((x) => new UnlinkedTypeParam .fromJson(x))?.toList(), 1467 bool _returnTypeIsSet = false;
1147 _returnType = json["returnType"] == null ? null : new UnlinkedTypeRef.from Json(json["returnType"]), 1468 bool _parametersIsSet = false;
1148 _parameters = json["parameters"]?.map((x) => new UnlinkedParam.fromJson(x) )?.toList(), 1469 bool _kindIsSet = false;
1149 _kind = json["kind"] == null ? null : UnlinkedExecutableKind.values[json[" kind"]], 1470 bool _isAbstractIsSet = false;
1150 _isAbstract = json["isAbstract"], 1471 bool _isStaticIsSet = false;
1151 _isStatic = json["isStatic"], 1472 bool _isConstIsSet = false;
1152 _isConst = json["isConst"], 1473 bool _isFactoryIsSet = false;
1153 _isFactory = json["isFactory"], 1474 bool _hasImplicitReturnTypeIsSet = false;
1154 _hasImplicitReturnType = json["hasImplicitReturnType"], 1475 bool _isExternalIsSet = false;
1155 _isExternal = json["isExternal"];
1156
1157 @override
1158 Map<String, Object> toMap() => {
1159 "name": name,
1160 "nameOffset": nameOffset,
1161 "documentationComment": documentationComment,
1162 "typeParameters": typeParameters,
1163 "returnType": returnType,
1164 "parameters": parameters,
1165 "kind": kind,
1166 "isAbstract": isAbstract,
1167 "isStatic": isStatic,
1168 "isConst": isConst,
1169 "isFactory": isFactory,
1170 "hasImplicitReturnType": hasImplicitReturnType,
1171 "isExternal": isExternal,
1172 };
1173
1174 /**
1175 * Name of the executable. For setters, this includes the trailing "=". For
1176 * named constructors, this excludes the class name and excludes the ".".
1177 * For unnamed constructors, this is the empty string.
1178 */
1179 String get name => _name ?? '';
1180
1181 /**
1182 * Offset of the executable name relative to the beginning of the file. For
1183 * named constructors, this excludes the class name and excludes the ".".
1184 * For unnamed constructors, this is the offset of the class name (i.e. the
1185 * offset of the second "C" in "class C { C(); }").
1186 */
1187 int get nameOffset => _nameOffset ?? 0;
1188
1189 /**
1190 * Documentation comment for the executable, or `null` if there is no
1191 * documentation comment.
1192 */
1193 UnlinkedDocumentationComment get documentationComment => _documentationComment ;
1194
1195 /**
1196 * Type parameters of the executable, if any. Empty if support for generic
1197 * method syntax is disabled.
1198 */
1199 List<UnlinkedTypeParam> get typeParameters => _typeParameters ?? const <Unlink edTypeParam>[];
1200
1201 /**
1202 * Declared return type of the executable. Absent if the return type is
1203 * `void` or the executable is a constructor. Note that when strong mode is
1204 * enabled, the actual return type may be different due to type inference.
1205 */
1206 UnlinkedTypeRef get returnType => _returnType;
1207
1208 /**
1209 * Parameters of the executable, if any. Note that getters have no
1210 * parameters (hence this will be the empty list), and setters have a single
1211 * parameter.
1212 */
1213 List<UnlinkedParam> get parameters => _parameters ?? const <UnlinkedParam>[];
1214
1215 /**
1216 * The kind of the executable (function/method, getter, setter, or
1217 * constructor).
1218 */
1219 UnlinkedExecutableKind get kind => _kind ?? UnlinkedExecutableKind.functionOrM ethod;
1220
1221 /**
1222 * Indicates whether the executable is declared using the `abstract` keyword.
1223 */
1224 bool get isAbstract => _isAbstract ?? false;
1225
1226 /**
1227 * Indicates whether the executable is declared using the `static` keyword.
1228 *
1229 * Note that for top level executables, this flag is false, since they are
1230 * not declared using the `static` keyword (even though they are considered
1231 * static for semantic purposes).
1232 */
1233 bool get isStatic => _isStatic ?? false;
1234
1235 /**
1236 * Indicates whether the executable is declared using the `const` keyword.
1237 */
1238 bool get isConst => _isConst ?? false;
1239
1240 /**
1241 * Indicates whether the executable is declared using the `factory` keyword.
1242 */
1243 bool get isFactory => _isFactory ?? false;
1244
1245 /**
1246 * Indicates whether the executable lacks an explicit return type
1247 * declaration. False for constructors and setters.
1248 */
1249 bool get hasImplicitReturnType => _hasImplicitReturnType ?? false;
1250
1251 /**
1252 * Indicates whether the executable is declared using the `external` keyword.
1253 */
1254 bool get isExternal => _isExternal ?? false;
1255 }
1256
1257 class UnlinkedExecutableBuilder {
1258 final Map _json = {};
1259
1260 bool _finished = false;
1261 1476
1262 UnlinkedExecutableBuilder(base.BuilderContext context); 1477 UnlinkedExecutableBuilder(base.BuilderContext context);
1263 1478
1264 /** 1479 /**
1265 * Name of the executable. For setters, this includes the trailing "=". For 1480 * Name of the executable. For setters, this includes the trailing "=". For
1266 * named constructors, this excludes the class name and excludes the ".". 1481 * named constructors, this excludes the class name and excludes the ".".
1267 * For unnamed constructors, this is the empty string. 1482 * For unnamed constructors, this is the empty string.
1268 */ 1483 */
1269 void set name(String _value) { 1484 void set name(String _value) {
1270 assert(!_finished); 1485 assert(!_finished);
1271 assert(!_json.containsKey("name")); 1486 assert(!_nameIsSet);
1272 if (_value != null) { 1487 _nameIsSet = true;
1273 _json["name"] = _value; 1488 _name = _value;
1274 }
1275 } 1489 }
1276 1490
1277 /** 1491 /**
1278 * Offset of the executable name relative to the beginning of the file. For 1492 * Offset of the executable name relative to the beginning of the file. For
1279 * named constructors, this excludes the class name and excludes the ".". 1493 * named constructors, this excludes the class name and excludes the ".".
1280 * For unnamed constructors, this is the offset of the class name (i.e. the 1494 * For unnamed constructors, this is the offset of the class name (i.e. the
1281 * offset of the second "C" in "class C { C(); }"). 1495 * offset of the second "C" in "class C { C(); }").
1282 */ 1496 */
1283 void set nameOffset(int _value) { 1497 void set nameOffset(int _value) {
1284 assert(!_finished); 1498 assert(!_finished);
1285 assert(!_json.containsKey("nameOffset")); 1499 assert(!_nameOffsetIsSet);
1286 if (_value != null) { 1500 _nameOffsetIsSet = true;
1287 _json["nameOffset"] = _value; 1501 _nameOffset = _value;
1288 }
1289 } 1502 }
1290 1503
1291 /** 1504 /**
1292 * Documentation comment for the executable, or `null` if there is no 1505 * Documentation comment for the executable, or `null` if there is no
1293 * documentation comment. 1506 * documentation comment.
1294 */ 1507 */
1295 void set documentationComment(UnlinkedDocumentationCommentBuilder _value) { 1508 void set documentationComment(UnlinkedDocumentationCommentBuilder _value) {
1296 assert(!_finished); 1509 assert(!_finished);
1297 assert(!_json.containsKey("documentationComment")); 1510 assert(!_documentationCommentIsSet);
1298 if (_value != null) { 1511 _documentationCommentIsSet = true;
1299 _json["documentationComment"] = _value.finish(); 1512 _documentationComment = _value;
1300 }
1301 } 1513 }
1302 1514
1303 /** 1515 /**
1304 * Type parameters of the executable, if any. Empty if support for generic 1516 * Type parameters of the executable, if any. Empty if support for generic
1305 * method syntax is disabled. 1517 * method syntax is disabled.
1306 */ 1518 */
1307 void set typeParameters(List<UnlinkedTypeParamBuilder> _value) { 1519 void set typeParameters(List<UnlinkedTypeParamBuilder> _value) {
1308 assert(!_finished); 1520 assert(!_finished);
1309 assert(!_json.containsKey("typeParameters")); 1521 assert(!_typeParametersIsSet);
1310 if (!(_value == null || _value.isEmpty)) { 1522 _typeParametersIsSet = true;
1311 _json["typeParameters"] = _value.map((b) => b.finish()).toList(); 1523 _typeParameters = _value;
1312 }
1313 } 1524 }
1314 1525
1315 /** 1526 /**
1316 * Declared return type of the executable. Absent if the return type is 1527 * Declared return type of the executable. Absent if the return type is
1317 * `void` or the executable is a constructor. Note that when strong mode is 1528 * `void` or the executable is a constructor. Note that when strong mode is
1318 * enabled, the actual return type may be different due to type inference. 1529 * enabled, the actual return type may be different due to type inference.
1319 */ 1530 */
1320 void set returnType(UnlinkedTypeRefBuilder _value) { 1531 void set returnType(UnlinkedTypeRefBuilder _value) {
1321 assert(!_finished); 1532 assert(!_finished);
1322 assert(!_json.containsKey("returnType")); 1533 assert(!_returnTypeIsSet);
1323 if (_value != null) { 1534 _returnTypeIsSet = true;
1324 _json["returnType"] = _value.finish(); 1535 _returnType = _value;
1325 }
1326 } 1536 }
1327 1537
1328 /** 1538 /**
1329 * Parameters of the executable, if any. Note that getters have no 1539 * Parameters of the executable, if any. Note that getters have no
1330 * parameters (hence this will be the empty list), and setters have a single 1540 * parameters (hence this will be the empty list), and setters have a single
1331 * parameter. 1541 * parameter.
1332 */ 1542 */
1333 void set parameters(List<UnlinkedParamBuilder> _value) { 1543 void set parameters(List<UnlinkedParamBuilder> _value) {
1334 assert(!_finished); 1544 assert(!_finished);
1335 assert(!_json.containsKey("parameters")); 1545 assert(!_parametersIsSet);
1336 if (!(_value == null || _value.isEmpty)) { 1546 _parametersIsSet = true;
1337 _json["parameters"] = _value.map((b) => b.finish()).toList(); 1547 _parameters = _value;
1338 }
1339 } 1548 }
1340 1549
1341 /** 1550 /**
1342 * The kind of the executable (function/method, getter, setter, or 1551 * The kind of the executable (function/method, getter, setter, or
1343 * constructor). 1552 * constructor).
1344 */ 1553 */
1345 void set kind(UnlinkedExecutableKind _value) { 1554 void set kind(UnlinkedExecutableKind _value) {
1346 assert(!_finished); 1555 assert(!_finished);
1347 assert(!_json.containsKey("kind")); 1556 assert(!_kindIsSet);
1348 if (!(_value == null || _value == UnlinkedExecutableKind.functionOrMethod)) { 1557 _kindIsSet = true;
1349 _json["kind"] = _value.index; 1558 _kind = _value;
1350 }
1351 } 1559 }
1352 1560
1353 /** 1561 /**
1354 * Indicates whether the executable is declared using the `abstract` keyword. 1562 * Indicates whether the executable is declared using the `abstract` keyword.
1355 */ 1563 */
1356 void set isAbstract(bool _value) { 1564 void set isAbstract(bool _value) {
1357 assert(!_finished); 1565 assert(!_finished);
1358 assert(!_json.containsKey("isAbstract")); 1566 assert(!_isAbstractIsSet);
1359 if (_value != null) { 1567 _isAbstractIsSet = true;
1360 _json["isAbstract"] = _value; 1568 _isAbstract = _value;
1361 }
1362 } 1569 }
1363 1570
1364 /** 1571 /**
1365 * Indicates whether the executable is declared using the `static` keyword. 1572 * Indicates whether the executable is declared using the `static` keyword.
1366 * 1573 *
1367 * Note that for top level executables, this flag is false, since they are 1574 * Note that for top level executables, this flag is false, since they are
1368 * not declared using the `static` keyword (even though they are considered 1575 * not declared using the `static` keyword (even though they are considered
1369 * static for semantic purposes). 1576 * static for semantic purposes).
1370 */ 1577 */
1371 void set isStatic(bool _value) { 1578 void set isStatic(bool _value) {
1372 assert(!_finished); 1579 assert(!_finished);
1373 assert(!_json.containsKey("isStatic")); 1580 assert(!_isStaticIsSet);
1374 if (_value != null) { 1581 _isStaticIsSet = true;
1375 _json["isStatic"] = _value; 1582 _isStatic = _value;
1376 }
1377 } 1583 }
1378 1584
1379 /** 1585 /**
1380 * Indicates whether the executable is declared using the `const` keyword. 1586 * Indicates whether the executable is declared using the `const` keyword.
1381 */ 1587 */
1382 void set isConst(bool _value) { 1588 void set isConst(bool _value) {
1383 assert(!_finished); 1589 assert(!_finished);
1384 assert(!_json.containsKey("isConst")); 1590 assert(!_isConstIsSet);
1385 if (_value != null) { 1591 _isConstIsSet = true;
1386 _json["isConst"] = _value; 1592 _isConst = _value;
1387 }
1388 } 1593 }
1389 1594
1390 /** 1595 /**
1391 * Indicates whether the executable is declared using the `factory` keyword. 1596 * Indicates whether the executable is declared using the `factory` keyword.
1392 */ 1597 */
1393 void set isFactory(bool _value) { 1598 void set isFactory(bool _value) {
1394 assert(!_finished); 1599 assert(!_finished);
1395 assert(!_json.containsKey("isFactory")); 1600 assert(!_isFactoryIsSet);
1396 if (_value != null) { 1601 _isFactoryIsSet = true;
1397 _json["isFactory"] = _value; 1602 _isFactory = _value;
1398 }
1399 } 1603 }
1400 1604
1401 /** 1605 /**
1402 * Indicates whether the executable lacks an explicit return type 1606 * Indicates whether the executable lacks an explicit return type
1403 * declaration. False for constructors and setters. 1607 * declaration. False for constructors and setters.
1404 */ 1608 */
1405 void set hasImplicitReturnType(bool _value) { 1609 void set hasImplicitReturnType(bool _value) {
1406 assert(!_finished); 1610 assert(!_finished);
1407 assert(!_json.containsKey("hasImplicitReturnType")); 1611 assert(!_hasImplicitReturnTypeIsSet);
1408 if (_value != null) { 1612 _hasImplicitReturnTypeIsSet = true;
1409 _json["hasImplicitReturnType"] = _value; 1613 _hasImplicitReturnType = _value;
1410 }
1411 } 1614 }
1412 1615
1413 /** 1616 /**
1414 * Indicates whether the executable is declared using the `external` keyword. 1617 * Indicates whether the executable is declared using the `external` keyword.
1415 */ 1618 */
1416 void set isExternal(bool _value) { 1619 void set isExternal(bool _value) {
1417 assert(!_finished); 1620 assert(!_finished);
1418 assert(!_json.containsKey("isExternal")); 1621 assert(!_isExternalIsSet);
1419 if (_value != null) { 1622 _isExternalIsSet = true;
1420 _json["isExternal"] = _value; 1623 _isExternal = _value;
1421 }
1422 } 1624 }
1423 1625
1424 Map finish() { 1626 fb.Offset finish(fb.Builder fbBuilder) {
1425 assert(!_finished); 1627 assert(!_finished);
1426 _finished = true; 1628 _finished = true;
1427 return _json; 1629 fb.Offset offset_name;
1630 fb.Offset offset_documentationComment;
1631 fb.Offset offset_typeParameters;
1632 fb.Offset offset_returnType;
1633 fb.Offset offset_parameters;
1634 if (_name != null) {
1635 offset_name = fbBuilder.writeString(_name);
1636 }
1637 if (_documentationComment != null) {
1638 offset_documentationComment = _documentationComment.finish(fbBuilder);
1639 }
1640 if (!(_typeParameters == null || _typeParameters.isEmpty)) {
1641 offset_typeParameters = fbBuilder.writeList(_typeParameters.map((b) => b.f inish(fbBuilder)).toList());
1642 }
1643 if (_returnType != null) {
1644 offset_returnType = _returnType.finish(fbBuilder);
1645 }
1646 if (!(_parameters == null || _parameters.isEmpty)) {
1647 offset_parameters = fbBuilder.writeList(_parameters.map((b) => b.finish(fb Builder)).toList());
1648 }
1649 fbBuilder.startTable();
1650 if (offset_name != null) {
1651 fbBuilder.addOffset(0, offset_name);
1652 }
1653 if (_nameOffset != null && _nameOffset != 0) {
1654 fbBuilder.addInt32(1, _nameOffset);
1655 }
1656 if (offset_documentationComment != null) {
1657 fbBuilder.addOffset(2, offset_documentationComment);
1658 }
1659 if (offset_typeParameters != null) {
1660 fbBuilder.addOffset(3, offset_typeParameters);
1661 }
1662 if (offset_returnType != null) {
1663 fbBuilder.addOffset(4, offset_returnType);
1664 }
1665 if (offset_parameters != null) {
1666 fbBuilder.addOffset(5, offset_parameters);
1667 }
1668 if (_kind != null && _kind != UnlinkedExecutableKind.functionOrMethod) {
1669 fbBuilder.addInt32(6, _kind.index);
1670 }
1671 if (_isAbstract == true) {
1672 fbBuilder.addInt8(7, 1);
1673 }
1674 if (_isStatic == true) {
1675 fbBuilder.addInt8(8, 1);
1676 }
1677 if (_isConst == true) {
1678 fbBuilder.addInt8(9, 1);
1679 }
1680 if (_isFactory == true) {
1681 fbBuilder.addInt8(10, 1);
1682 }
1683 if (_hasImplicitReturnType == true) {
1684 fbBuilder.addInt8(11, 1);
1685 }
1686 if (_isExternal == true) {
1687 fbBuilder.addInt8(12, 1);
1688 }
1689 return fbBuilder.endTable();
1428 } 1690 }
1429 } 1691 }
1430 1692
1431 UnlinkedExecutableBuilder encodeUnlinkedExecutable(base.BuilderContext builderCo ntext, {String name, int nameOffset, UnlinkedDocumentationCommentBuilder documen tationComment, List<UnlinkedTypeParamBuilder> typeParameters, UnlinkedTypeRefBui lder returnType, List<UnlinkedParamBuilder> parameters, UnlinkedExecutableKind k ind, bool isAbstract, bool isStatic, bool isConst, bool isFactory, bool hasImpli citReturnType, bool isExternal}) { 1693 UnlinkedExecutableBuilder encodeUnlinkedExecutable(base.BuilderContext builderCo ntext, {String name, int nameOffset, UnlinkedDocumentationCommentBuilder documen tationComment, List<UnlinkedTypeParamBuilder> typeParameters, UnlinkedTypeRefBui lder returnType, List<UnlinkedParamBuilder> parameters, UnlinkedExecutableKind k ind, bool isAbstract, bool isStatic, bool isConst, bool isFactory, bool hasImpli citReturnType, bool isExternal}) {
1432 UnlinkedExecutableBuilder builder = new UnlinkedExecutableBuilder(builderConte xt); 1694 UnlinkedExecutableBuilder builder = new UnlinkedExecutableBuilder(builderConte xt);
1433 builder.name = name; 1695 builder.name = name;
1434 builder.nameOffset = nameOffset; 1696 builder.nameOffset = nameOffset;
1435 builder.documentationComment = documentationComment; 1697 builder.documentationComment = documentationComment;
1436 builder.typeParameters = typeParameters; 1698 builder.typeParameters = typeParameters;
1437 builder.returnType = returnType; 1699 builder.returnType = returnType;
1438 builder.parameters = parameters; 1700 builder.parameters = parameters;
1439 builder.kind = kind; 1701 builder.kind = kind;
1440 builder.isAbstract = isAbstract; 1702 builder.isAbstract = isAbstract;
1441 builder.isStatic = isStatic; 1703 builder.isStatic = isStatic;
1442 builder.isConst = isConst; 1704 builder.isConst = isConst;
1443 builder.isFactory = isFactory; 1705 builder.isFactory = isFactory;
1444 builder.hasImplicitReturnType = hasImplicitReturnType; 1706 builder.hasImplicitReturnType = hasImplicitReturnType;
1445 builder.isExternal = isExternal; 1707 builder.isExternal = isExternal;
1446 return builder; 1708 return builder;
1447 } 1709 }
1448 1710
1449 /** 1711 /**
1450 * Unlinked summary information about an export declaration (stored outside 1712 * Unlinked summary information about a function, method, getter, or setter
1451 * [UnlinkedPublicNamespace]). 1713 * declaration.
1452 */ 1714 */
1453 class UnlinkedExportNonPublic extends base.SummaryClass { 1715 abstract class UnlinkedExecutable extends base.SummaryClass {
1716
1717 /**
1718 * Name of the executable. For setters, this includes the trailing "=". For
1719 * named constructors, this excludes the class name and excludes the ".".
1720 * For unnamed constructors, this is the empty string.
1721 */
1722 String get name;
1723
1724 /**
1725 * Offset of the executable name relative to the beginning of the file. For
1726 * named constructors, this excludes the class name and excludes the ".".
1727 * For unnamed constructors, this is the offset of the class name (i.e. the
1728 * offset of the second "C" in "class C { C(); }").
1729 */
1730 int get nameOffset;
1731
1732 /**
1733 * Documentation comment for the executable, or `null` if there is no
1734 * documentation comment.
1735 */
1736 UnlinkedDocumentationComment get documentationComment;
1737
1738 /**
1739 * Type parameters of the executable, if any. Empty if support for generic
1740 * method syntax is disabled.
1741 */
1742 List<UnlinkedTypeParam> get typeParameters;
1743
1744 /**
1745 * Declared return type of the executable. Absent if the return type is
1746 * `void` or the executable is a constructor. Note that when strong mode is
1747 * enabled, the actual return type may be different due to type inference.
1748 */
1749 UnlinkedTypeRef get returnType;
1750
1751 /**
1752 * Parameters of the executable, if any. Note that getters have no
1753 * parameters (hence this will be the empty list), and setters have a single
1754 * parameter.
1755 */
1756 List<UnlinkedParam> get parameters;
1757
1758 /**
1759 * The kind of the executable (function/method, getter, setter, or
1760 * constructor).
1761 */
1762 UnlinkedExecutableKind get kind;
1763
1764 /**
1765 * Indicates whether the executable is declared using the `abstract` keyword.
1766 */
1767 bool get isAbstract;
1768
1769 /**
1770 * Indicates whether the executable is declared using the `static` keyword.
1771 *
1772 * Note that for top level executables, this flag is false, since they are
1773 * not declared using the `static` keyword (even though they are considered
1774 * static for semantic purposes).
1775 */
1776 bool get isStatic;
1777
1778 /**
1779 * Indicates whether the executable is declared using the `const` keyword.
1780 */
1781 bool get isConst;
1782
1783 /**
1784 * Indicates whether the executable is declared using the `factory` keyword.
1785 */
1786 bool get isFactory;
1787
1788 /**
1789 * Indicates whether the executable lacks an explicit return type
1790 * declaration. False for constructors and setters.
1791 */
1792 bool get hasImplicitReturnType;
1793
1794 /**
1795 * Indicates whether the executable is declared using the `external` keyword.
1796 */
1797 bool get isExternal;
1798 }
1799
1800 class _UnlinkedExecutableReader extends fb.TableReader<_UnlinkedExecutableReader > implements UnlinkedExecutable {
1801 final fb.BufferPointer _bp;
1802
1803 const _UnlinkedExecutableReader([this._bp]);
1804
1805 @override
1806 _UnlinkedExecutableReader createReader(fb.BufferPointer bp) => new _UnlinkedEx ecutableReader(bp);
1807
1808 @override
1809 Map<String, Object> toMap() => {};
1810
1811 @override
1812 String get name => const fb.StringReader().vTableGet(_bp, 0, '');
1813
1814 @override
1815 int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
1816
1817 @override
1818 UnlinkedDocumentationComment get documentationComment => const _UnlinkedDocume ntationCommentReader().vTableGet(_bp, 2, null);
1819
1820 @override
1821 List<UnlinkedTypeParam> get typeParameters => const fb.ListReader<UnlinkedType Param>(const _UnlinkedTypeParamReader()).vTableGet(_bp, 3, const <UnlinkedTypePa ram>[]);
1822
1823 @override
1824 UnlinkedTypeRef get returnType => const _UnlinkedTypeRefReader().vTableGet(_bp , 4, null);
1825
1826 @override
1827 List<UnlinkedParam> get parameters => const fb.ListReader<UnlinkedParam>(const _UnlinkedParamReader()).vTableGet(_bp, 5, const <UnlinkedParam>[]);
1828
1829 @override
1830 UnlinkedExecutableKind get kind {
1831 int index = const fb.Int32Reader().vTableGet(_bp, 6, 0);
1832 return UnlinkedExecutableKind.values[index];
1833 }
1834
1835 @override
1836 bool get isAbstract => const fb.Int8Reader().vTableGet(_bp, 7, 0) == 1;
1837
1838 @override
1839 bool get isStatic => const fb.Int8Reader().vTableGet(_bp, 8, 0) == 1;
1840
1841 @override
1842 bool get isConst => const fb.Int8Reader().vTableGet(_bp, 9, 0) == 1;
1843
1844 @override
1845 bool get isFactory => const fb.Int8Reader().vTableGet(_bp, 10, 0) == 1;
1846
1847 @override
1848 bool get hasImplicitReturnType => const fb.Int8Reader().vTableGet(_bp, 11, 0) == 1;
1849
1850 @override
1851 bool get isExternal => const fb.Int8Reader().vTableGet(_bp, 12, 0) == 1;
1852 }
1853
1854 class UnlinkedExportNonPublicBuilder {
1855 bool _finished = false;
1856
1454 int _offset; 1857 int _offset;
1455 int _uriOffset; 1858 int _uriOffset;
1456 int _uriEnd; 1859 int _uriEnd;
1457 1860
1458 UnlinkedExportNonPublic.fromJson(Map json) 1861 bool _offsetIsSet = false;
1459 : _offset = json["offset"], 1862 bool _uriOffsetIsSet = false;
1460 _uriOffset = json["uriOffset"], 1863 bool _uriEndIsSet = false;
1461 _uriEnd = json["uriEnd"];
1462
1463 @override
1464 Map<String, Object> toMap() => {
1465 "offset": offset,
1466 "uriOffset": uriOffset,
1467 "uriEnd": uriEnd,
1468 };
1469
1470 /**
1471 * Offset of the "export" keyword.
1472 */
1473 int get offset => _offset ?? 0;
1474
1475 /**
1476 * Offset of the URI string (including quotes) relative to the beginning of
1477 * the file.
1478 */
1479 int get uriOffset => _uriOffset ?? 0;
1480
1481 /**
1482 * End of the URI string (including quotes) relative to the beginning of the
1483 * file.
1484 */
1485 int get uriEnd => _uriEnd ?? 0;
1486 }
1487
1488 class UnlinkedExportNonPublicBuilder {
1489 final Map _json = {};
1490
1491 bool _finished = false;
1492 1864
1493 UnlinkedExportNonPublicBuilder(base.BuilderContext context); 1865 UnlinkedExportNonPublicBuilder(base.BuilderContext context);
1494 1866
1495 /** 1867 /**
1496 * Offset of the "export" keyword. 1868 * Offset of the "export" keyword.
1497 */ 1869 */
1498 void set offset(int _value) { 1870 void set offset(int _value) {
1499 assert(!_finished); 1871 assert(!_finished);
1500 assert(!_json.containsKey("offset")); 1872 assert(!_offsetIsSet);
1501 if (_value != null) { 1873 _offsetIsSet = true;
1502 _json["offset"] = _value; 1874 _offset = _value;
1503 }
1504 } 1875 }
1505 1876
1506 /** 1877 /**
1507 * Offset of the URI string (including quotes) relative to the beginning of 1878 * Offset of the URI string (including quotes) relative to the beginning of
1508 * the file. 1879 * the file.
1509 */ 1880 */
1510 void set uriOffset(int _value) { 1881 void set uriOffset(int _value) {
1511 assert(!_finished); 1882 assert(!_finished);
1512 assert(!_json.containsKey("uriOffset")); 1883 assert(!_uriOffsetIsSet);
1513 if (_value != null) { 1884 _uriOffsetIsSet = true;
1514 _json["uriOffset"] = _value; 1885 _uriOffset = _value;
1515 }
1516 } 1886 }
1517 1887
1518 /** 1888 /**
1519 * End of the URI string (including quotes) relative to the beginning of the 1889 * End of the URI string (including quotes) relative to the beginning of the
1520 * file. 1890 * file.
1521 */ 1891 */
1522 void set uriEnd(int _value) { 1892 void set uriEnd(int _value) {
1523 assert(!_finished); 1893 assert(!_finished);
1524 assert(!_json.containsKey("uriEnd")); 1894 assert(!_uriEndIsSet);
1525 if (_value != null) { 1895 _uriEndIsSet = true;
1526 _json["uriEnd"] = _value; 1896 _uriEnd = _value;
1527 }
1528 } 1897 }
1529 1898
1530 Map finish() { 1899 fb.Offset finish(fb.Builder fbBuilder) {
1531 assert(!_finished); 1900 assert(!_finished);
1532 _finished = true; 1901 _finished = true;
1533 return _json; 1902 fbBuilder.startTable();
1903 if (_offset != null && _offset != 0) {
1904 fbBuilder.addInt32(0, _offset);
1905 }
1906 if (_uriOffset != null && _uriOffset != 0) {
1907 fbBuilder.addInt32(1, _uriOffset);
1908 }
1909 if (_uriEnd != null && _uriEnd != 0) {
1910 fbBuilder.addInt32(2, _uriEnd);
1911 }
1912 return fbBuilder.endTable();
1534 } 1913 }
1535 } 1914 }
1536 1915
1537 UnlinkedExportNonPublicBuilder encodeUnlinkedExportNonPublic(base.BuilderContext builderContext, {int offset, int uriOffset, int uriEnd}) { 1916 UnlinkedExportNonPublicBuilder encodeUnlinkedExportNonPublic(base.BuilderContext builderContext, {int offset, int uriOffset, int uriEnd}) {
1538 UnlinkedExportNonPublicBuilder builder = new UnlinkedExportNonPublicBuilder(bu ilderContext); 1917 UnlinkedExportNonPublicBuilder builder = new UnlinkedExportNonPublicBuilder(bu ilderContext);
1539 builder.offset = offset; 1918 builder.offset = offset;
1540 builder.uriOffset = uriOffset; 1919 builder.uriOffset = uriOffset;
1541 builder.uriEnd = uriEnd; 1920 builder.uriEnd = uriEnd;
1542 return builder; 1921 return builder;
1543 } 1922 }
1544 1923
1545 /** 1924 /**
1546 * Unlinked summary information about an export declaration (stored inside 1925 * Unlinked summary information about an export declaration (stored outside
1547 * [UnlinkedPublicNamespace]). 1926 * [UnlinkedPublicNamespace]).
1548 */ 1927 */
1549 class UnlinkedExportPublic extends base.SummaryClass { 1928 abstract class UnlinkedExportNonPublic extends base.SummaryClass {
1550 String _uri;
1551 List<UnlinkedCombinator> _combinators;
1552 1929
1553 UnlinkedExportPublic.fromJson(Map json) 1930 /**
1554 : _uri = json["uri"], 1931 * Offset of the "export" keyword.
1555 _combinators = json["combinators"]?.map((x) => new UnlinkedCombinator.from Json(x))?.toList(); 1932 */
1933 int get offset;
1934
1935 /**
1936 * Offset of the URI string (including quotes) relative to the beginning of
1937 * the file.
1938 */
1939 int get uriOffset;
1940
1941 /**
1942 * End of the URI string (including quotes) relative to the beginning of the
1943 * file.
1944 */
1945 int get uriEnd;
1946 }
1947
1948 class _UnlinkedExportNonPublicReader extends fb.TableReader<_UnlinkedExportNonPu blicReader> implements UnlinkedExportNonPublic {
1949 final fb.BufferPointer _bp;
1950
1951 const _UnlinkedExportNonPublicReader([this._bp]);
1556 1952
1557 @override 1953 @override
1558 Map<String, Object> toMap() => { 1954 _UnlinkedExportNonPublicReader createReader(fb.BufferPointer bp) => new _Unlin kedExportNonPublicReader(bp);
1559 "uri": uri,
1560 "combinators": combinators,
1561 };
1562 1955
1563 /** 1956 @override
1564 * URI used in the source code to reference the exported library. 1957 Map<String, Object> toMap() => {};
1565 */
1566 String get uri => _uri ?? '';
1567 1958
1568 /** 1959 @override
1569 * Combinators contained in this import declaration. 1960 int get offset => const fb.Int32Reader().vTableGet(_bp, 0, 0);
1570 */ 1961
1571 List<UnlinkedCombinator> get combinators => _combinators ?? const <UnlinkedCom binator>[]; 1962 @override
1963 int get uriOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
1964
1965 @override
1966 int get uriEnd => const fb.Int32Reader().vTableGet(_bp, 2, 0);
1572 } 1967 }
1573 1968
1574 class UnlinkedExportPublicBuilder { 1969 class UnlinkedExportPublicBuilder {
1575 final Map _json = {}; 1970 bool _finished = false;
1576 1971
1577 bool _finished = false; 1972 String _uri;
1973 List<UnlinkedCombinatorBuilder> _combinators;
1974
1975 bool _uriIsSet = false;
1976 bool _combinatorsIsSet = false;
1578 1977
1579 UnlinkedExportPublicBuilder(base.BuilderContext context); 1978 UnlinkedExportPublicBuilder(base.BuilderContext context);
1580 1979
1581 /** 1980 /**
1582 * URI used in the source code to reference the exported library. 1981 * URI used in the source code to reference the exported library.
1583 */ 1982 */
1584 void set uri(String _value) { 1983 void set uri(String _value) {
1585 assert(!_finished); 1984 assert(!_finished);
1586 assert(!_json.containsKey("uri")); 1985 assert(!_uriIsSet);
1587 if (_value != null) { 1986 _uriIsSet = true;
1588 _json["uri"] = _value; 1987 _uri = _value;
1589 }
1590 } 1988 }
1591 1989
1592 /** 1990 /**
1593 * Combinators contained in this import declaration. 1991 * Combinators contained in this import declaration.
1594 */ 1992 */
1595 void set combinators(List<UnlinkedCombinatorBuilder> _value) { 1993 void set combinators(List<UnlinkedCombinatorBuilder> _value) {
1596 assert(!_finished); 1994 assert(!_finished);
1597 assert(!_json.containsKey("combinators")); 1995 assert(!_combinatorsIsSet);
1598 if (!(_value == null || _value.isEmpty)) { 1996 _combinatorsIsSet = true;
1599 _json["combinators"] = _value.map((b) => b.finish()).toList(); 1997 _combinators = _value;
1600 }
1601 } 1998 }
1602 1999
1603 Map finish() { 2000 fb.Offset finish(fb.Builder fbBuilder) {
1604 assert(!_finished); 2001 assert(!_finished);
1605 _finished = true; 2002 _finished = true;
1606 return _json; 2003 fb.Offset offset_uri;
2004 fb.Offset offset_combinators;
2005 if (_uri != null) {
2006 offset_uri = fbBuilder.writeString(_uri);
2007 }
2008 if (!(_combinators == null || _combinators.isEmpty)) {
2009 offset_combinators = fbBuilder.writeList(_combinators.map((b) => b.finish( fbBuilder)).toList());
2010 }
2011 fbBuilder.startTable();
2012 if (offset_uri != null) {
2013 fbBuilder.addOffset(0, offset_uri);
2014 }
2015 if (offset_combinators != null) {
2016 fbBuilder.addOffset(1, offset_combinators);
2017 }
2018 return fbBuilder.endTable();
1607 } 2019 }
1608 } 2020 }
1609 2021
1610 UnlinkedExportPublicBuilder encodeUnlinkedExportPublic(base.BuilderContext build erContext, {String uri, List<UnlinkedCombinatorBuilder> combinators}) { 2022 UnlinkedExportPublicBuilder encodeUnlinkedExportPublic(base.BuilderContext build erContext, {String uri, List<UnlinkedCombinatorBuilder> combinators}) {
1611 UnlinkedExportPublicBuilder builder = new UnlinkedExportPublicBuilder(builderC ontext); 2023 UnlinkedExportPublicBuilder builder = new UnlinkedExportPublicBuilder(builderC ontext);
1612 builder.uri = uri; 2024 builder.uri = uri;
1613 builder.combinators = combinators; 2025 builder.combinators = combinators;
1614 return builder; 2026 return builder;
1615 } 2027 }
1616 2028
1617 /** 2029 /**
1618 * Unlinked summary information about an import declaration. 2030 * Unlinked summary information about an export declaration (stored inside
2031 * [UnlinkedPublicNamespace]).
1619 */ 2032 */
1620 class UnlinkedImport extends base.SummaryClass { 2033 abstract class UnlinkedExportPublic extends base.SummaryClass {
2034
2035 /**
2036 * URI used in the source code to reference the exported library.
2037 */
2038 String get uri;
2039
2040 /**
2041 * Combinators contained in this import declaration.
2042 */
2043 List<UnlinkedCombinator> get combinators;
2044 }
2045
2046 class _UnlinkedExportPublicReader extends fb.TableReader<_UnlinkedExportPublicRe ader> implements UnlinkedExportPublic {
2047 final fb.BufferPointer _bp;
2048
2049 const _UnlinkedExportPublicReader([this._bp]);
2050
2051 @override
2052 _UnlinkedExportPublicReader createReader(fb.BufferPointer bp) => new _Unlinked ExportPublicReader(bp);
2053
2054 @override
2055 Map<String, Object> toMap() => {};
2056
2057 @override
2058 String get uri => const fb.StringReader().vTableGet(_bp, 0, '');
2059
2060 @override
2061 List<UnlinkedCombinator> get combinators => const fb.ListReader<UnlinkedCombin ator>(const _UnlinkedCombinatorReader()).vTableGet(_bp, 1, const <UnlinkedCombin ator>[]);
2062 }
2063
2064 class UnlinkedImportBuilder {
2065 bool _finished = false;
2066
1621 String _uri; 2067 String _uri;
1622 int _offset; 2068 int _offset;
1623 int _prefixReference; 2069 int _prefixReference;
1624 List<UnlinkedCombinator> _combinators; 2070 List<UnlinkedCombinatorBuilder> _combinators;
1625 bool _isDeferred; 2071 bool _isDeferred;
1626 bool _isImplicit; 2072 bool _isImplicit;
1627 int _uriOffset; 2073 int _uriOffset;
1628 int _uriEnd; 2074 int _uriEnd;
1629 int _prefixOffset; 2075 int _prefixOffset;
1630 2076
1631 UnlinkedImport.fromJson(Map json) 2077 bool _uriIsSet = false;
1632 : _uri = json["uri"], 2078 bool _offsetIsSet = false;
1633 _offset = json["offset"], 2079 bool _prefixReferenceIsSet = false;
1634 _prefixReference = json["prefixReference"], 2080 bool _combinatorsIsSet = false;
1635 _combinators = json["combinators"]?.map((x) => new UnlinkedCombinator.from Json(x))?.toList(), 2081 bool _isDeferredIsSet = false;
1636 _isDeferred = json["isDeferred"], 2082 bool _isImplicitIsSet = false;
1637 _isImplicit = json["isImplicit"], 2083 bool _uriOffsetIsSet = false;
1638 _uriOffset = json["uriOffset"], 2084 bool _uriEndIsSet = false;
1639 _uriEnd = json["uriEnd"], 2085 bool _prefixOffsetIsSet = false;
1640 _prefixOffset = json["prefixOffset"];
1641
1642 @override
1643 Map<String, Object> toMap() => {
1644 "uri": uri,
1645 "offset": offset,
1646 "prefixReference": prefixReference,
1647 "combinators": combinators,
1648 "isDeferred": isDeferred,
1649 "isImplicit": isImplicit,
1650 "uriOffset": uriOffset,
1651 "uriEnd": uriEnd,
1652 "prefixOffset": prefixOffset,
1653 };
1654
1655 /**
1656 * URI used in the source code to reference the imported library.
1657 */
1658 String get uri => _uri ?? '';
1659
1660 /**
1661 * If [isImplicit] is false, offset of the "import" keyword. If [isImplicit]
1662 * is true, zero.
1663 */
1664 int get offset => _offset ?? 0;
1665
1666 /**
1667 * Index into [UnlinkedUnit.references] of the prefix declared by this
1668 * import declaration, or zero if this import declaration declares no prefix.
1669 *
1670 * Note that multiple imports can declare the same prefix.
1671 */
1672 int get prefixReference => _prefixReference ?? 0;
1673
1674 /**
1675 * Combinators contained in this import declaration.
1676 */
1677 List<UnlinkedCombinator> get combinators => _combinators ?? const <UnlinkedCom binator>[];
1678
1679 /**
1680 * Indicates whether the import declaration uses the `deferred` keyword.
1681 */
1682 bool get isDeferred => _isDeferred ?? false;
1683
1684 /**
1685 * Indicates whether the import declaration is implicit.
1686 */
1687 bool get isImplicit => _isImplicit ?? false;
1688
1689 /**
1690 * Offset of the URI string (including quotes) relative to the beginning of
1691 * the file. If [isImplicit] is true, zero.
1692 */
1693 int get uriOffset => _uriOffset ?? 0;
1694
1695 /**
1696 * End of the URI string (including quotes) relative to the beginning of the
1697 * file. If [isImplicit] is true, zero.
1698 */
1699 int get uriEnd => _uriEnd ?? 0;
1700
1701 /**
1702 * Offset of the prefix name relative to the beginning of the file, or zero
1703 * if there is no prefix.
1704 */
1705 int get prefixOffset => _prefixOffset ?? 0;
1706 }
1707
1708 class UnlinkedImportBuilder {
1709 final Map _json = {};
1710
1711 bool _finished = false;
1712 2086
1713 UnlinkedImportBuilder(base.BuilderContext context); 2087 UnlinkedImportBuilder(base.BuilderContext context);
1714 2088
1715 /** 2089 /**
1716 * URI used in the source code to reference the imported library. 2090 * URI used in the source code to reference the imported library.
1717 */ 2091 */
1718 void set uri(String _value) { 2092 void set uri(String _value) {
1719 assert(!_finished); 2093 assert(!_finished);
1720 assert(!_json.containsKey("uri")); 2094 assert(!_uriIsSet);
1721 if (_value != null) { 2095 _uriIsSet = true;
1722 _json["uri"] = _value; 2096 _uri = _value;
1723 }
1724 } 2097 }
1725 2098
1726 /** 2099 /**
1727 * If [isImplicit] is false, offset of the "import" keyword. If [isImplicit] 2100 * If [isImplicit] is false, offset of the "import" keyword. If [isImplicit]
1728 * is true, zero. 2101 * is true, zero.
1729 */ 2102 */
1730 void set offset(int _value) { 2103 void set offset(int _value) {
1731 assert(!_finished); 2104 assert(!_finished);
1732 assert(!_json.containsKey("offset")); 2105 assert(!_offsetIsSet);
1733 if (_value != null) { 2106 _offsetIsSet = true;
1734 _json["offset"] = _value; 2107 _offset = _value;
1735 }
1736 } 2108 }
1737 2109
1738 /** 2110 /**
1739 * Index into [UnlinkedUnit.references] of the prefix declared by this 2111 * Index into [UnlinkedUnit.references] of the prefix declared by this
1740 * import declaration, or zero if this import declaration declares no prefix. 2112 * import declaration, or zero if this import declaration declares no prefix.
1741 * 2113 *
1742 * Note that multiple imports can declare the same prefix. 2114 * Note that multiple imports can declare the same prefix.
1743 */ 2115 */
1744 void set prefixReference(int _value) { 2116 void set prefixReference(int _value) {
1745 assert(!_finished); 2117 assert(!_finished);
1746 assert(!_json.containsKey("prefixReference")); 2118 assert(!_prefixReferenceIsSet);
1747 if (_value != null) { 2119 _prefixReferenceIsSet = true;
1748 _json["prefixReference"] = _value; 2120 _prefixReference = _value;
1749 }
1750 } 2121 }
1751 2122
1752 /** 2123 /**
1753 * Combinators contained in this import declaration. 2124 * Combinators contained in this import declaration.
1754 */ 2125 */
1755 void set combinators(List<UnlinkedCombinatorBuilder> _value) { 2126 void set combinators(List<UnlinkedCombinatorBuilder> _value) {
1756 assert(!_finished); 2127 assert(!_finished);
1757 assert(!_json.containsKey("combinators")); 2128 assert(!_combinatorsIsSet);
1758 if (!(_value == null || _value.isEmpty)) { 2129 _combinatorsIsSet = true;
1759 _json["combinators"] = _value.map((b) => b.finish()).toList(); 2130 _combinators = _value;
1760 }
1761 } 2131 }
1762 2132
1763 /** 2133 /**
1764 * Indicates whether the import declaration uses the `deferred` keyword. 2134 * Indicates whether the import declaration uses the `deferred` keyword.
1765 */ 2135 */
1766 void set isDeferred(bool _value) { 2136 void set isDeferred(bool _value) {
1767 assert(!_finished); 2137 assert(!_finished);
1768 assert(!_json.containsKey("isDeferred")); 2138 assert(!_isDeferredIsSet);
1769 if (_value != null) { 2139 _isDeferredIsSet = true;
1770 _json["isDeferred"] = _value; 2140 _isDeferred = _value;
1771 }
1772 } 2141 }
1773 2142
1774 /** 2143 /**
1775 * Indicates whether the import declaration is implicit. 2144 * Indicates whether the import declaration is implicit.
1776 */ 2145 */
1777 void set isImplicit(bool _value) { 2146 void set isImplicit(bool _value) {
1778 assert(!_finished); 2147 assert(!_finished);
1779 assert(!_json.containsKey("isImplicit")); 2148 assert(!_isImplicitIsSet);
1780 if (_value != null) { 2149 _isImplicitIsSet = true;
1781 _json["isImplicit"] = _value; 2150 _isImplicit = _value;
1782 }
1783 } 2151 }
1784 2152
1785 /** 2153 /**
1786 * Offset of the URI string (including quotes) relative to the beginning of 2154 * Offset of the URI string (including quotes) relative to the beginning of
1787 * the file. If [isImplicit] is true, zero. 2155 * the file. If [isImplicit] is true, zero.
1788 */ 2156 */
1789 void set uriOffset(int _value) { 2157 void set uriOffset(int _value) {
1790 assert(!_finished); 2158 assert(!_finished);
1791 assert(!_json.containsKey("uriOffset")); 2159 assert(!_uriOffsetIsSet);
1792 if (_value != null) { 2160 _uriOffsetIsSet = true;
1793 _json["uriOffset"] = _value; 2161 _uriOffset = _value;
1794 }
1795 } 2162 }
1796 2163
1797 /** 2164 /**
1798 * End of the URI string (including quotes) relative to the beginning of the 2165 * End of the URI string (including quotes) relative to the beginning of the
1799 * file. If [isImplicit] is true, zero. 2166 * file. If [isImplicit] is true, zero.
1800 */ 2167 */
1801 void set uriEnd(int _value) { 2168 void set uriEnd(int _value) {
1802 assert(!_finished); 2169 assert(!_finished);
1803 assert(!_json.containsKey("uriEnd")); 2170 assert(!_uriEndIsSet);
1804 if (_value != null) { 2171 _uriEndIsSet = true;
1805 _json["uriEnd"] = _value; 2172 _uriEnd = _value;
1806 }
1807 } 2173 }
1808 2174
1809 /** 2175 /**
1810 * Offset of the prefix name relative to the beginning of the file, or zero 2176 * Offset of the prefix name relative to the beginning of the file, or zero
1811 * if there is no prefix. 2177 * if there is no prefix.
1812 */ 2178 */
1813 void set prefixOffset(int _value) { 2179 void set prefixOffset(int _value) {
1814 assert(!_finished); 2180 assert(!_finished);
1815 assert(!_json.containsKey("prefixOffset")); 2181 assert(!_prefixOffsetIsSet);
1816 if (_value != null) { 2182 _prefixOffsetIsSet = true;
1817 _json["prefixOffset"] = _value; 2183 _prefixOffset = _value;
1818 }
1819 } 2184 }
1820 2185
1821 Map finish() { 2186 fb.Offset finish(fb.Builder fbBuilder) {
1822 assert(!_finished); 2187 assert(!_finished);
1823 _finished = true; 2188 _finished = true;
1824 return _json; 2189 fb.Offset offset_uri;
2190 fb.Offset offset_combinators;
2191 if (_uri != null) {
2192 offset_uri = fbBuilder.writeString(_uri);
2193 }
2194 if (!(_combinators == null || _combinators.isEmpty)) {
2195 offset_combinators = fbBuilder.writeList(_combinators.map((b) => b.finish( fbBuilder)).toList());
2196 }
2197 fbBuilder.startTable();
2198 if (offset_uri != null) {
2199 fbBuilder.addOffset(0, offset_uri);
2200 }
2201 if (_offset != null && _offset != 0) {
2202 fbBuilder.addInt32(1, _offset);
2203 }
2204 if (_prefixReference != null && _prefixReference != 0) {
2205 fbBuilder.addInt32(2, _prefixReference);
2206 }
2207 if (offset_combinators != null) {
2208 fbBuilder.addOffset(3, offset_combinators);
2209 }
2210 if (_isDeferred == true) {
2211 fbBuilder.addInt8(4, 1);
2212 }
2213 if (_isImplicit == true) {
2214 fbBuilder.addInt8(5, 1);
2215 }
2216 if (_uriOffset != null && _uriOffset != 0) {
2217 fbBuilder.addInt32(6, _uriOffset);
2218 }
2219 if (_uriEnd != null && _uriEnd != 0) {
2220 fbBuilder.addInt32(7, _uriEnd);
2221 }
2222 if (_prefixOffset != null && _prefixOffset != 0) {
2223 fbBuilder.addInt32(8, _prefixOffset);
2224 }
2225 return fbBuilder.endTable();
1825 } 2226 }
1826 } 2227 }
1827 2228
1828 UnlinkedImportBuilder encodeUnlinkedImport(base.BuilderContext builderContext, { String uri, int offset, int prefixReference, List<UnlinkedCombinatorBuilder> com binators, bool isDeferred, bool isImplicit, int uriOffset, int uriEnd, int prefi xOffset}) { 2229 UnlinkedImportBuilder encodeUnlinkedImport(base.BuilderContext builderContext, { String uri, int offset, int prefixReference, List<UnlinkedCombinatorBuilder> com binators, bool isDeferred, bool isImplicit, int uriOffset, int uriEnd, int prefi xOffset}) {
1829 UnlinkedImportBuilder builder = new UnlinkedImportBuilder(builderContext); 2230 UnlinkedImportBuilder builder = new UnlinkedImportBuilder(builderContext);
1830 builder.uri = uri; 2231 builder.uri = uri;
1831 builder.offset = offset; 2232 builder.offset = offset;
1832 builder.prefixReference = prefixReference; 2233 builder.prefixReference = prefixReference;
1833 builder.combinators = combinators; 2234 builder.combinators = combinators;
1834 builder.isDeferred = isDeferred; 2235 builder.isDeferred = isDeferred;
1835 builder.isImplicit = isImplicit; 2236 builder.isImplicit = isImplicit;
1836 builder.uriOffset = uriOffset; 2237 builder.uriOffset = uriOffset;
1837 builder.uriEnd = uriEnd; 2238 builder.uriEnd = uriEnd;
1838 builder.prefixOffset = prefixOffset; 2239 builder.prefixOffset = prefixOffset;
1839 return builder; 2240 return builder;
1840 } 2241 }
1841 2242
1842 /** 2243 /**
1843 * Unlinked summary information about a function parameter. 2244 * Unlinked summary information about an import declaration.
1844 */ 2245 */
1845 class UnlinkedParam extends base.SummaryClass { 2246 abstract class UnlinkedImport extends base.SummaryClass {
2247
2248 /**
2249 * URI used in the source code to reference the imported library.
2250 */
2251 String get uri;
2252
2253 /**
2254 * If [isImplicit] is false, offset of the "import" keyword. If [isImplicit]
2255 * is true, zero.
2256 */
2257 int get offset;
2258
2259 /**
2260 * Index into [UnlinkedUnit.references] of the prefix declared by this
2261 * import declaration, or zero if this import declaration declares no prefix.
2262 *
2263 * Note that multiple imports can declare the same prefix.
2264 */
2265 int get prefixReference;
2266
2267 /**
2268 * Combinators contained in this import declaration.
2269 */
2270 List<UnlinkedCombinator> get combinators;
2271
2272 /**
2273 * Indicates whether the import declaration uses the `deferred` keyword.
2274 */
2275 bool get isDeferred;
2276
2277 /**
2278 * Indicates whether the import declaration is implicit.
2279 */
2280 bool get isImplicit;
2281
2282 /**
2283 * Offset of the URI string (including quotes) relative to the beginning of
2284 * the file. If [isImplicit] is true, zero.
2285 */
2286 int get uriOffset;
2287
2288 /**
2289 * End of the URI string (including quotes) relative to the beginning of the
2290 * file. If [isImplicit] is true, zero.
2291 */
2292 int get uriEnd;
2293
2294 /**
2295 * Offset of the prefix name relative to the beginning of the file, or zero
2296 * if there is no prefix.
2297 */
2298 int get prefixOffset;
2299 }
2300
2301 class _UnlinkedImportReader extends fb.TableReader<_UnlinkedImportReader> implem ents UnlinkedImport {
2302 final fb.BufferPointer _bp;
2303
2304 const _UnlinkedImportReader([this._bp]);
2305
2306 @override
2307 _UnlinkedImportReader createReader(fb.BufferPointer bp) => new _UnlinkedImport Reader(bp);
2308
2309 @override
2310 Map<String, Object> toMap() => {};
2311
2312 @override
2313 String get uri => const fb.StringReader().vTableGet(_bp, 0, '');
2314
2315 @override
2316 int get offset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
2317
2318 @override
2319 int get prefixReference => const fb.Int32Reader().vTableGet(_bp, 2, 0);
2320
2321 @override
2322 List<UnlinkedCombinator> get combinators => const fb.ListReader<UnlinkedCombin ator>(const _UnlinkedCombinatorReader()).vTableGet(_bp, 3, const <UnlinkedCombin ator>[]);
2323
2324 @override
2325 bool get isDeferred => const fb.Int8Reader().vTableGet(_bp, 4, 0) == 1;
2326
2327 @override
2328 bool get isImplicit => const fb.Int8Reader().vTableGet(_bp, 5, 0) == 1;
2329
2330 @override
2331 int get uriOffset => const fb.Int32Reader().vTableGet(_bp, 6, 0);
2332
2333 @override
2334 int get uriEnd => const fb.Int32Reader().vTableGet(_bp, 7, 0);
2335
2336 @override
2337 int get prefixOffset => const fb.Int32Reader().vTableGet(_bp, 8, 0);
2338 }
2339
2340 class UnlinkedParamBuilder {
2341 bool _finished = false;
2342
1846 String _name; 2343 String _name;
1847 int _nameOffset; 2344 int _nameOffset;
1848 UnlinkedTypeRef _type; 2345 UnlinkedTypeRefBuilder _type;
1849 List<UnlinkedParam> _parameters; 2346 List<UnlinkedParamBuilder> _parameters;
1850 UnlinkedParamKind _kind; 2347 UnlinkedParamKind _kind;
1851 bool _isFunctionTyped; 2348 bool _isFunctionTyped;
1852 bool _isInitializingFormal; 2349 bool _isInitializingFormal;
1853 bool _hasImplicitType; 2350 bool _hasImplicitType;
1854 2351
1855 UnlinkedParam.fromJson(Map json) 2352 bool _nameIsSet = false;
1856 : _name = json["name"], 2353 bool _nameOffsetIsSet = false;
1857 _nameOffset = json["nameOffset"], 2354 bool _typeIsSet = false;
1858 _type = json["type"] == null ? null : new UnlinkedTypeRef.fromJson(json["t ype"]), 2355 bool _parametersIsSet = false;
1859 _parameters = json["parameters"]?.map((x) => new UnlinkedParam.fromJson(x) )?.toList(), 2356 bool _kindIsSet = false;
1860 _kind = json["kind"] == null ? null : UnlinkedParamKind.values[json["kind" ]], 2357 bool _isFunctionTypedIsSet = false;
1861 _isFunctionTyped = json["isFunctionTyped"], 2358 bool _isInitializingFormalIsSet = false;
1862 _isInitializingFormal = json["isInitializingFormal"], 2359 bool _hasImplicitTypeIsSet = false;
1863 _hasImplicitType = json["hasImplicitType"];
1864
1865 @override
1866 Map<String, Object> toMap() => {
1867 "name": name,
1868 "nameOffset": nameOffset,
1869 "type": type,
1870 "parameters": parameters,
1871 "kind": kind,
1872 "isFunctionTyped": isFunctionTyped,
1873 "isInitializingFormal": isInitializingFormal,
1874 "hasImplicitType": hasImplicitType,
1875 };
1876
1877 /**
1878 * Name of the parameter.
1879 */
1880 String get name => _name ?? '';
1881
1882 /**
1883 * Offset of the parameter name relative to the beginning of the file.
1884 */
1885 int get nameOffset => _nameOffset ?? 0;
1886
1887 /**
1888 * If [isFunctionTyped] is `true`, the declared return type. If
1889 * [isFunctionTyped] is `false`, the declared type. Absent if
1890 * [isFunctionTyped] is `true` and the declared return type is `void`. Note
1891 * that when strong mode is enabled, the actual type may be different due to
1892 * type inference.
1893 */
1894 UnlinkedTypeRef get type => _type;
1895
1896 /**
1897 * If [isFunctionTyped] is `true`, the parameters of the function type.
1898 */
1899 List<UnlinkedParam> get parameters => _parameters ?? const <UnlinkedParam>[];
1900
1901 /**
1902 * Kind of the parameter.
1903 */
1904 UnlinkedParamKind get kind => _kind ?? UnlinkedParamKind.required;
1905
1906 /**
1907 * Indicates whether this is a function-typed parameter.
1908 */
1909 bool get isFunctionTyped => _isFunctionTyped ?? false;
1910
1911 /**
1912 * Indicates whether this is an initializing formal parameter (i.e. it is
1913 * declared using `this.` syntax).
1914 */
1915 bool get isInitializingFormal => _isInitializingFormal ?? false;
1916
1917 /**
1918 * Indicates whether this parameter lacks an explicit type declaration.
1919 * Always false for a function-typed parameter.
1920 */
1921 bool get hasImplicitType => _hasImplicitType ?? false;
1922 }
1923
1924 class UnlinkedParamBuilder {
1925 final Map _json = {};
1926
1927 bool _finished = false;
1928 2360
1929 UnlinkedParamBuilder(base.BuilderContext context); 2361 UnlinkedParamBuilder(base.BuilderContext context);
1930 2362
1931 /** 2363 /**
1932 * Name of the parameter. 2364 * Name of the parameter.
1933 */ 2365 */
1934 void set name(String _value) { 2366 void set name(String _value) {
1935 assert(!_finished); 2367 assert(!_finished);
1936 assert(!_json.containsKey("name")); 2368 assert(!_nameIsSet);
1937 if (_value != null) { 2369 _nameIsSet = true;
1938 _json["name"] = _value; 2370 _name = _value;
1939 }
1940 } 2371 }
1941 2372
1942 /** 2373 /**
1943 * Offset of the parameter name relative to the beginning of the file. 2374 * Offset of the parameter name relative to the beginning of the file.
1944 */ 2375 */
1945 void set nameOffset(int _value) { 2376 void set nameOffset(int _value) {
1946 assert(!_finished); 2377 assert(!_finished);
1947 assert(!_json.containsKey("nameOffset")); 2378 assert(!_nameOffsetIsSet);
1948 if (_value != null) { 2379 _nameOffsetIsSet = true;
1949 _json["nameOffset"] = _value; 2380 _nameOffset = _value;
1950 }
1951 } 2381 }
1952 2382
1953 /** 2383 /**
1954 * If [isFunctionTyped] is `true`, the declared return type. If 2384 * If [isFunctionTyped] is `true`, the declared return type. If
1955 * [isFunctionTyped] is `false`, the declared type. Absent if 2385 * [isFunctionTyped] is `false`, the declared type. Absent if
1956 * [isFunctionTyped] is `true` and the declared return type is `void`. Note 2386 * [isFunctionTyped] is `true` and the declared return type is `void`. Note
1957 * that when strong mode is enabled, the actual type may be different due to 2387 * that when strong mode is enabled, the actual type may be different due to
1958 * type inference. 2388 * type inference.
1959 */ 2389 */
1960 void set type(UnlinkedTypeRefBuilder _value) { 2390 void set type(UnlinkedTypeRefBuilder _value) {
1961 assert(!_finished); 2391 assert(!_finished);
1962 assert(!_json.containsKey("type")); 2392 assert(!_typeIsSet);
1963 if (_value != null) { 2393 _typeIsSet = true;
1964 _json["type"] = _value.finish(); 2394 _type = _value;
1965 }
1966 } 2395 }
1967 2396
1968 /** 2397 /**
1969 * If [isFunctionTyped] is `true`, the parameters of the function type. 2398 * If [isFunctionTyped] is `true`, the parameters of the function type.
1970 */ 2399 */
1971 void set parameters(List<UnlinkedParamBuilder> _value) { 2400 void set parameters(List<UnlinkedParamBuilder> _value) {
1972 assert(!_finished); 2401 assert(!_finished);
1973 assert(!_json.containsKey("parameters")); 2402 assert(!_parametersIsSet);
1974 if (!(_value == null || _value.isEmpty)) { 2403 _parametersIsSet = true;
1975 _json["parameters"] = _value.map((b) => b.finish()).toList(); 2404 _parameters = _value;
1976 }
1977 } 2405 }
1978 2406
1979 /** 2407 /**
1980 * Kind of the parameter. 2408 * Kind of the parameter.
1981 */ 2409 */
1982 void set kind(UnlinkedParamKind _value) { 2410 void set kind(UnlinkedParamKind _value) {
1983 assert(!_finished); 2411 assert(!_finished);
1984 assert(!_json.containsKey("kind")); 2412 assert(!_kindIsSet);
1985 if (!(_value == null || _value == UnlinkedParamKind.required)) { 2413 _kindIsSet = true;
1986 _json["kind"] = _value.index; 2414 _kind = _value;
1987 }
1988 } 2415 }
1989 2416
1990 /** 2417 /**
1991 * Indicates whether this is a function-typed parameter. 2418 * Indicates whether this is a function-typed parameter.
1992 */ 2419 */
1993 void set isFunctionTyped(bool _value) { 2420 void set isFunctionTyped(bool _value) {
1994 assert(!_finished); 2421 assert(!_finished);
1995 assert(!_json.containsKey("isFunctionTyped")); 2422 assert(!_isFunctionTypedIsSet);
1996 if (_value != null) { 2423 _isFunctionTypedIsSet = true;
1997 _json["isFunctionTyped"] = _value; 2424 _isFunctionTyped = _value;
1998 }
1999 } 2425 }
2000 2426
2001 /** 2427 /**
2002 * Indicates whether this is an initializing formal parameter (i.e. it is 2428 * Indicates whether this is an initializing formal parameter (i.e. it is
2003 * declared using `this.` syntax). 2429 * declared using `this.` syntax).
2004 */ 2430 */
2005 void set isInitializingFormal(bool _value) { 2431 void set isInitializingFormal(bool _value) {
2006 assert(!_finished); 2432 assert(!_finished);
2007 assert(!_json.containsKey("isInitializingFormal")); 2433 assert(!_isInitializingFormalIsSet);
2008 if (_value != null) { 2434 _isInitializingFormalIsSet = true;
2009 _json["isInitializingFormal"] = _value; 2435 _isInitializingFormal = _value;
2010 }
2011 } 2436 }
2012 2437
2013 /** 2438 /**
2014 * Indicates whether this parameter lacks an explicit type declaration. 2439 * Indicates whether this parameter lacks an explicit type declaration.
2015 * Always false for a function-typed parameter. 2440 * Always false for a function-typed parameter.
2016 */ 2441 */
2017 void set hasImplicitType(bool _value) { 2442 void set hasImplicitType(bool _value) {
2018 assert(!_finished); 2443 assert(!_finished);
2019 assert(!_json.containsKey("hasImplicitType")); 2444 assert(!_hasImplicitTypeIsSet);
2020 if (_value != null) { 2445 _hasImplicitTypeIsSet = true;
2021 _json["hasImplicitType"] = _value; 2446 _hasImplicitType = _value;
2022 }
2023 } 2447 }
2024 2448
2025 Map finish() { 2449 fb.Offset finish(fb.Builder fbBuilder) {
2026 assert(!_finished); 2450 assert(!_finished);
2027 _finished = true; 2451 _finished = true;
2028 return _json; 2452 fb.Offset offset_name;
2453 fb.Offset offset_type;
2454 fb.Offset offset_parameters;
2455 if (_name != null) {
2456 offset_name = fbBuilder.writeString(_name);
2457 }
2458 if (_type != null) {
2459 offset_type = _type.finish(fbBuilder);
2460 }
2461 if (!(_parameters == null || _parameters.isEmpty)) {
2462 offset_parameters = fbBuilder.writeList(_parameters.map((b) => b.finish(fb Builder)).toList());
2463 }
2464 fbBuilder.startTable();
2465 if (offset_name != null) {
2466 fbBuilder.addOffset(0, offset_name);
2467 }
2468 if (_nameOffset != null && _nameOffset != 0) {
2469 fbBuilder.addInt32(1, _nameOffset);
2470 }
2471 if (offset_type != null) {
2472 fbBuilder.addOffset(2, offset_type);
2473 }
2474 if (offset_parameters != null) {
2475 fbBuilder.addOffset(3, offset_parameters);
2476 }
2477 if (_kind != null && _kind != UnlinkedParamKind.required) {
2478 fbBuilder.addInt32(4, _kind.index);
2479 }
2480 if (_isFunctionTyped == true) {
2481 fbBuilder.addInt8(5, 1);
2482 }
2483 if (_isInitializingFormal == true) {
2484 fbBuilder.addInt8(6, 1);
2485 }
2486 if (_hasImplicitType == true) {
2487 fbBuilder.addInt8(7, 1);
2488 }
2489 return fbBuilder.endTable();
2029 } 2490 }
2030 } 2491 }
2031 2492
2032 UnlinkedParamBuilder encodeUnlinkedParam(base.BuilderContext builderContext, {St ring name, int nameOffset, UnlinkedTypeRefBuilder type, List<UnlinkedParamBuilde r> parameters, UnlinkedParamKind kind, bool isFunctionTyped, bool isInitializing Formal, bool hasImplicitType}) { 2493 UnlinkedParamBuilder encodeUnlinkedParam(base.BuilderContext builderContext, {St ring name, int nameOffset, UnlinkedTypeRefBuilder type, List<UnlinkedParamBuilde r> parameters, UnlinkedParamKind kind, bool isFunctionTyped, bool isInitializing Formal, bool hasImplicitType}) {
2033 UnlinkedParamBuilder builder = new UnlinkedParamBuilder(builderContext); 2494 UnlinkedParamBuilder builder = new UnlinkedParamBuilder(builderContext);
2034 builder.name = name; 2495 builder.name = name;
2035 builder.nameOffset = nameOffset; 2496 builder.nameOffset = nameOffset;
2036 builder.type = type; 2497 builder.type = type;
2037 builder.parameters = parameters; 2498 builder.parameters = parameters;
2038 builder.kind = kind; 2499 builder.kind = kind;
2039 builder.isFunctionTyped = isFunctionTyped; 2500 builder.isFunctionTyped = isFunctionTyped;
2040 builder.isInitializingFormal = isInitializingFormal; 2501 builder.isInitializingFormal = isInitializingFormal;
2041 builder.hasImplicitType = hasImplicitType; 2502 builder.hasImplicitType = hasImplicitType;
2042 return builder; 2503 return builder;
2043 } 2504 }
2044 2505
2045 /** 2506 /**
2046 * Unlinked summary information about a part declaration. 2507 * Unlinked summary information about a function parameter.
2047 */ 2508 */
2048 class UnlinkedPart extends base.SummaryClass { 2509 abstract class UnlinkedParam extends base.SummaryClass {
2510
2511 /**
2512 * Name of the parameter.
2513 */
2514 String get name;
2515
2516 /**
2517 * Offset of the parameter name relative to the beginning of the file.
2518 */
2519 int get nameOffset;
2520
2521 /**
2522 * If [isFunctionTyped] is `true`, the declared return type. If
2523 * [isFunctionTyped] is `false`, the declared type. Absent if
2524 * [isFunctionTyped] is `true` and the declared return type is `void`. Note
2525 * that when strong mode is enabled, the actual type may be different due to
2526 * type inference.
2527 */
2528 UnlinkedTypeRef get type;
2529
2530 /**
2531 * If [isFunctionTyped] is `true`, the parameters of the function type.
2532 */
2533 List<UnlinkedParam> get parameters;
2534
2535 /**
2536 * Kind of the parameter.
2537 */
2538 UnlinkedParamKind get kind;
2539
2540 /**
2541 * Indicates whether this is a function-typed parameter.
2542 */
2543 bool get isFunctionTyped;
2544
2545 /**
2546 * Indicates whether this is an initializing formal parameter (i.e. it is
2547 * declared using `this.` syntax).
2548 */
2549 bool get isInitializingFormal;
2550
2551 /**
2552 * Indicates whether this parameter lacks an explicit type declaration.
2553 * Always false for a function-typed parameter.
2554 */
2555 bool get hasImplicitType;
2556 }
2557
2558 class _UnlinkedParamReader extends fb.TableReader<_UnlinkedParamReader> implemen ts UnlinkedParam {
2559 final fb.BufferPointer _bp;
2560
2561 const _UnlinkedParamReader([this._bp]);
2562
2563 @override
2564 _UnlinkedParamReader createReader(fb.BufferPointer bp) => new _UnlinkedParamRe ader(bp);
2565
2566 @override
2567 Map<String, Object> toMap() => {};
2568
2569 @override
2570 String get name => const fb.StringReader().vTableGet(_bp, 0, '');
2571
2572 @override
2573 int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
2574
2575 @override
2576 UnlinkedTypeRef get type => const _UnlinkedTypeRefReader().vTableGet(_bp, 2, n ull);
2577
2578 @override
2579 List<UnlinkedParam> get parameters => const fb.ListReader<UnlinkedParam>(const _UnlinkedParamReader()).vTableGet(_bp, 3, const <UnlinkedParam>[]);
2580
2581 @override
2582 UnlinkedParamKind get kind {
2583 int index = const fb.Int32Reader().vTableGet(_bp, 4, 0);
2584 return UnlinkedParamKind.values[index];
2585 }
2586
2587 @override
2588 bool get isFunctionTyped => const fb.Int8Reader().vTableGet(_bp, 5, 0) == 1;
2589
2590 @override
2591 bool get isInitializingFormal => const fb.Int8Reader().vTableGet(_bp, 6, 0) == 1;
2592
2593 @override
2594 bool get hasImplicitType => const fb.Int8Reader().vTableGet(_bp, 7, 0) == 1;
2595 }
2596
2597 class UnlinkedPartBuilder {
2598 bool _finished = false;
2599
2049 int _uriOffset; 2600 int _uriOffset;
2050 int _uriEnd; 2601 int _uriEnd;
2051 2602
2052 UnlinkedPart.fromJson(Map json) 2603 bool _uriOffsetIsSet = false;
2053 : _uriOffset = json["uriOffset"], 2604 bool _uriEndIsSet = false;
2054 _uriEnd = json["uriEnd"];
2055
2056 @override
2057 Map<String, Object> toMap() => {
2058 "uriOffset": uriOffset,
2059 "uriEnd": uriEnd,
2060 };
2061
2062 /**
2063 * Offset of the URI string (including quotes) relative to the beginning of
2064 * the file.
2065 */
2066 int get uriOffset => _uriOffset ?? 0;
2067
2068 /**
2069 * End of the URI string (including quotes) relative to the beginning of the
2070 * file.
2071 */
2072 int get uriEnd => _uriEnd ?? 0;
2073 }
2074
2075 class UnlinkedPartBuilder {
2076 final Map _json = {};
2077
2078 bool _finished = false;
2079 2605
2080 UnlinkedPartBuilder(base.BuilderContext context); 2606 UnlinkedPartBuilder(base.BuilderContext context);
2081 2607
2082 /** 2608 /**
2083 * Offset of the URI string (including quotes) relative to the beginning of 2609 * Offset of the URI string (including quotes) relative to the beginning of
2084 * the file. 2610 * the file.
2085 */ 2611 */
2086 void set uriOffset(int _value) { 2612 void set uriOffset(int _value) {
2087 assert(!_finished); 2613 assert(!_finished);
2088 assert(!_json.containsKey("uriOffset")); 2614 assert(!_uriOffsetIsSet);
2089 if (_value != null) { 2615 _uriOffsetIsSet = true;
2090 _json["uriOffset"] = _value; 2616 _uriOffset = _value;
2091 }
2092 } 2617 }
2093 2618
2094 /** 2619 /**
2095 * End of the URI string (including quotes) relative to the beginning of the 2620 * End of the URI string (including quotes) relative to the beginning of the
2096 * file. 2621 * file.
2097 */ 2622 */
2098 void set uriEnd(int _value) { 2623 void set uriEnd(int _value) {
2099 assert(!_finished); 2624 assert(!_finished);
2100 assert(!_json.containsKey("uriEnd")); 2625 assert(!_uriEndIsSet);
2101 if (_value != null) { 2626 _uriEndIsSet = true;
2102 _json["uriEnd"] = _value; 2627 _uriEnd = _value;
2103 }
2104 } 2628 }
2105 2629
2106 Map finish() { 2630 fb.Offset finish(fb.Builder fbBuilder) {
2107 assert(!_finished); 2631 assert(!_finished);
2108 _finished = true; 2632 _finished = true;
2109 return _json; 2633 fbBuilder.startTable();
2634 if (_uriOffset != null && _uriOffset != 0) {
2635 fbBuilder.addInt32(0, _uriOffset);
2636 }
2637 if (_uriEnd != null && _uriEnd != 0) {
2638 fbBuilder.addInt32(1, _uriEnd);
2639 }
2640 return fbBuilder.endTable();
2110 } 2641 }
2111 } 2642 }
2112 2643
2113 UnlinkedPartBuilder encodeUnlinkedPart(base.BuilderContext builderContext, {int uriOffset, int uriEnd}) { 2644 UnlinkedPartBuilder encodeUnlinkedPart(base.BuilderContext builderContext, {int uriOffset, int uriEnd}) {
2114 UnlinkedPartBuilder builder = new UnlinkedPartBuilder(builderContext); 2645 UnlinkedPartBuilder builder = new UnlinkedPartBuilder(builderContext);
2115 builder.uriOffset = uriOffset; 2646 builder.uriOffset = uriOffset;
2116 builder.uriEnd = uriEnd; 2647 builder.uriEnd = uriEnd;
2117 return builder; 2648 return builder;
2118 } 2649 }
2119 2650
2120 /** 2651 /**
2121 * Unlinked summary information about a specific name contributed by a 2652 * Unlinked summary information about a part declaration.
2122 * compilation unit to a library's public namespace.
2123 *
2124 * TODO(paulberry): add a count of generic parameters, so that resynthesis
2125 * doesn't have to peek into the library to obtain this info.
2126 *
2127 * TODO(paulberry): for classes, add info about static members and
2128 * constructors, since this will be needed to prelink info about constants.
2129 *
2130 * TODO(paulberry): some of this information is redundant with information
2131 * elsewhere in the summary. Consider reducing the redundancy to reduce
2132 * summary size.
2133 */ 2653 */
2134 class UnlinkedPublicName extends base.SummaryClass { 2654 abstract class UnlinkedPart extends base.SummaryClass {
2655
2656 /**
2657 * Offset of the URI string (including quotes) relative to the beginning of
2658 * the file.
2659 */
2660 int get uriOffset;
2661
2662 /**
2663 * End of the URI string (including quotes) relative to the beginning of the
2664 * file.
2665 */
2666 int get uriEnd;
2667 }
2668
2669 class _UnlinkedPartReader extends fb.TableReader<_UnlinkedPartReader> implements UnlinkedPart {
2670 final fb.BufferPointer _bp;
2671
2672 const _UnlinkedPartReader([this._bp]);
2673
2674 @override
2675 _UnlinkedPartReader createReader(fb.BufferPointer bp) => new _UnlinkedPartRead er(bp);
2676
2677 @override
2678 Map<String, Object> toMap() => {};
2679
2680 @override
2681 int get uriOffset => const fb.Int32Reader().vTableGet(_bp, 0, 0);
2682
2683 @override
2684 int get uriEnd => const fb.Int32Reader().vTableGet(_bp, 1, 0);
2685 }
2686
2687 class UnlinkedPublicNameBuilder {
2688 bool _finished = false;
2689
2135 String _name; 2690 String _name;
2136 PrelinkedReferenceKind _kind; 2691 PrelinkedReferenceKind _kind;
2137 int _numTypeParameters; 2692 int _numTypeParameters;
2138 2693
2139 UnlinkedPublicName.fromJson(Map json) 2694 bool _nameIsSet = false;
2140 : _name = json["name"], 2695 bool _kindIsSet = false;
2141 _kind = json["kind"] == null ? null : PrelinkedReferenceKind.values[json[" kind"]], 2696 bool _numTypeParametersIsSet = false;
2142 _numTypeParameters = json["numTypeParameters"];
2143
2144 @override
2145 Map<String, Object> toMap() => {
2146 "name": name,
2147 "kind": kind,
2148 "numTypeParameters": numTypeParameters,
2149 };
2150
2151 /**
2152 * The name itself.
2153 */
2154 String get name => _name ?? '';
2155
2156 /**
2157 * The kind of object referred to by the name.
2158 */
2159 PrelinkedReferenceKind get kind => _kind ?? PrelinkedReferenceKind.classOrEnum ;
2160
2161 /**
2162 * If the entity being referred to is generic, the number of type parameters
2163 * it accepts. Otherwise zero.
2164 */
2165 int get numTypeParameters => _numTypeParameters ?? 0;
2166 }
2167
2168 class UnlinkedPublicNameBuilder {
2169 final Map _json = {};
2170
2171 bool _finished = false;
2172 2697
2173 UnlinkedPublicNameBuilder(base.BuilderContext context); 2698 UnlinkedPublicNameBuilder(base.BuilderContext context);
2174 2699
2175 /** 2700 /**
2176 * The name itself. 2701 * The name itself.
2177 */ 2702 */
2178 void set name(String _value) { 2703 void set name(String _value) {
2179 assert(!_finished); 2704 assert(!_finished);
2180 assert(!_json.containsKey("name")); 2705 assert(!_nameIsSet);
2181 if (_value != null) { 2706 _nameIsSet = true;
2182 _json["name"] = _value; 2707 _name = _value;
2183 }
2184 } 2708 }
2185 2709
2186 /** 2710 /**
2187 * The kind of object referred to by the name. 2711 * The kind of object referred to by the name.
2188 */ 2712 */
2189 void set kind(PrelinkedReferenceKind _value) { 2713 void set kind(PrelinkedReferenceKind _value) {
2190 assert(!_finished); 2714 assert(!_finished);
2191 assert(!_json.containsKey("kind")); 2715 assert(!_kindIsSet);
2192 if (!(_value == null || _value == PrelinkedReferenceKind.classOrEnum)) { 2716 _kindIsSet = true;
2193 _json["kind"] = _value.index; 2717 _kind = _value;
2194 }
2195 } 2718 }
2196 2719
2197 /** 2720 /**
2198 * If the entity being referred to is generic, the number of type parameters 2721 * If the entity being referred to is generic, the number of type parameters
2199 * it accepts. Otherwise zero. 2722 * it accepts. Otherwise zero.
2200 */ 2723 */
2201 void set numTypeParameters(int _value) { 2724 void set numTypeParameters(int _value) {
2202 assert(!_finished); 2725 assert(!_finished);
2203 assert(!_json.containsKey("numTypeParameters")); 2726 assert(!_numTypeParametersIsSet);
2204 if (_value != null) { 2727 _numTypeParametersIsSet = true;
2205 _json["numTypeParameters"] = _value; 2728 _numTypeParameters = _value;
2206 }
2207 } 2729 }
2208 2730
2209 Map finish() { 2731 fb.Offset finish(fb.Builder fbBuilder) {
2210 assert(!_finished); 2732 assert(!_finished);
2211 _finished = true; 2733 _finished = true;
2212 return _json; 2734 fb.Offset offset_name;
2735 if (_name != null) {
2736 offset_name = fbBuilder.writeString(_name);
2737 }
2738 fbBuilder.startTable();
2739 if (offset_name != null) {
2740 fbBuilder.addOffset(0, offset_name);
2741 }
2742 if (_kind != null && _kind != PrelinkedReferenceKind.classOrEnum) {
2743 fbBuilder.addInt32(1, _kind.index);
2744 }
2745 if (_numTypeParameters != null && _numTypeParameters != 0) {
2746 fbBuilder.addInt32(2, _numTypeParameters);
2747 }
2748 return fbBuilder.endTable();
2213 } 2749 }
2214 } 2750 }
2215 2751
2216 UnlinkedPublicNameBuilder encodeUnlinkedPublicName(base.BuilderContext builderCo ntext, {String name, PrelinkedReferenceKind kind, int numTypeParameters}) { 2752 UnlinkedPublicNameBuilder encodeUnlinkedPublicName(base.BuilderContext builderCo ntext, {String name, PrelinkedReferenceKind kind, int numTypeParameters}) {
2217 UnlinkedPublicNameBuilder builder = new UnlinkedPublicNameBuilder(builderConte xt); 2753 UnlinkedPublicNameBuilder builder = new UnlinkedPublicNameBuilder(builderConte xt);
2218 builder.name = name; 2754 builder.name = name;
2219 builder.kind = kind; 2755 builder.kind = kind;
2220 builder.numTypeParameters = numTypeParameters; 2756 builder.numTypeParameters = numTypeParameters;
2221 return builder; 2757 return builder;
2222 } 2758 }
2223 2759
2224 /** 2760 /**
2225 * Unlinked summary information about what a compilation unit contributes to a 2761 * Unlinked summary information about a specific name contributed by a
2226 * library's public namespace. This is the subset of [UnlinkedUnit] that is 2762 * compilation unit to a library's public namespace.
2227 * required from dependent libraries in order to perform prelinking. 2763 *
2764 * TODO(paulberry): add a count of generic parameters, so that resynthesis
2765 * doesn't have to peek into the library to obtain this info.
2766 *
2767 * TODO(paulberry): for classes, add info about static members and
2768 * constructors, since this will be needed to prelink info about constants.
2769 *
2770 * TODO(paulberry): some of this information is redundant with information
2771 * elsewhere in the summary. Consider reducing the redundancy to reduce
2772 * summary size.
2228 */ 2773 */
2229 class UnlinkedPublicNamespace extends base.SummaryClass { 2774 abstract class UnlinkedPublicName extends base.SummaryClass {
2230 List<UnlinkedPublicName> _names;
2231 List<UnlinkedExportPublic> _exports;
2232 List<String> _parts;
2233 2775
2234 UnlinkedPublicNamespace.fromJson(Map json) 2776 /**
2235 : _names = json["names"]?.map((x) => new UnlinkedPublicName.fromJson(x))?.to List(), 2777 * The name itself.
2236 _exports = json["exports"]?.map((x) => new UnlinkedExportPublic.fromJson(x ))?.toList(), 2778 */
2237 _parts = json["parts"]; 2779 String get name;
2780
2781 /**
2782 * The kind of object referred to by the name.
2783 */
2784 PrelinkedReferenceKind get kind;
2785
2786 /**
2787 * If the entity being referred to is generic, the number of type parameters
2788 * it accepts. Otherwise zero.
2789 */
2790 int get numTypeParameters;
2791 }
2792
2793 class _UnlinkedPublicNameReader extends fb.TableReader<_UnlinkedPublicNameReader > implements UnlinkedPublicName {
2794 final fb.BufferPointer _bp;
2795
2796 const _UnlinkedPublicNameReader([this._bp]);
2238 2797
2239 @override 2798 @override
2240 Map<String, Object> toMap() => { 2799 _UnlinkedPublicNameReader createReader(fb.BufferPointer bp) => new _UnlinkedPu blicNameReader(bp);
2241 "names": names,
2242 "exports": exports,
2243 "parts": parts,
2244 };
2245 2800
2246 UnlinkedPublicNamespace.fromBuffer(List<int> buffer) : this.fromJson(JSON.deco de(UTF8.decode(buffer))); 2801 @override
2802 Map<String, Object> toMap() => {};
2247 2803
2248 /** 2804 @override
2249 * Public names defined in the compilation unit. 2805 String get name => const fb.StringReader().vTableGet(_bp, 0, '');
2250 *
2251 * TODO(paulberry): consider sorting these names to reduce unnecessary
2252 * relinking.
2253 */
2254 List<UnlinkedPublicName> get names => _names ?? const <UnlinkedPublicName>[];
2255 2806
2256 /** 2807 @override
2257 * Export declarations in the compilation unit. 2808 PrelinkedReferenceKind get kind {
2258 */ 2809 int index = const fb.Int32Reader().vTableGet(_bp, 1, 0);
2259 List<UnlinkedExportPublic> get exports => _exports ?? const <UnlinkedExportPub lic>[]; 2810 return PrelinkedReferenceKind.values[index];
2811 }
2260 2812
2261 /** 2813 @override
2262 * URIs referenced by part declarations in the compilation unit. 2814 int get numTypeParameters => const fb.Int32Reader().vTableGet(_bp, 2, 0);
2263 */
2264 List<String> get parts => _parts ?? const <String>[];
2265 } 2815 }
2266 2816
2267 class UnlinkedPublicNamespaceBuilder { 2817 class UnlinkedPublicNamespaceBuilder {
2268 final Map _json = {}; 2818 bool _finished = false;
2269 2819
2270 bool _finished = false; 2820 List<UnlinkedPublicNameBuilder> _names;
2821 List<UnlinkedExportPublicBuilder> _exports;
2822 List<String> _parts;
2823
2824 bool _namesIsSet = false;
2825 bool _exportsIsSet = false;
2826 bool _partsIsSet = false;
2271 2827
2272 UnlinkedPublicNamespaceBuilder(base.BuilderContext context); 2828 UnlinkedPublicNamespaceBuilder(base.BuilderContext context);
2273 2829
2274 /** 2830 /**
2275 * Public names defined in the compilation unit. 2831 * Public names defined in the compilation unit.
2276 * 2832 *
2277 * TODO(paulberry): consider sorting these names to reduce unnecessary 2833 * TODO(paulberry): consider sorting these names to reduce unnecessary
2278 * relinking. 2834 * relinking.
2279 */ 2835 */
2280 void set names(List<UnlinkedPublicNameBuilder> _value) { 2836 void set names(List<UnlinkedPublicNameBuilder> _value) {
2281 assert(!_finished); 2837 assert(!_finished);
2282 assert(!_json.containsKey("names")); 2838 assert(!_namesIsSet);
2283 if (!(_value == null || _value.isEmpty)) { 2839 _namesIsSet = true;
2284 _json["names"] = _value.map((b) => b.finish()).toList(); 2840 _names = _value;
2285 }
2286 } 2841 }
2287 2842
2288 /** 2843 /**
2289 * Export declarations in the compilation unit. 2844 * Export declarations in the compilation unit.
2290 */ 2845 */
2291 void set exports(List<UnlinkedExportPublicBuilder> _value) { 2846 void set exports(List<UnlinkedExportPublicBuilder> _value) {
2292 assert(!_finished); 2847 assert(!_finished);
2293 assert(!_json.containsKey("exports")); 2848 assert(!_exportsIsSet);
2294 if (!(_value == null || _value.isEmpty)) { 2849 _exportsIsSet = true;
2295 _json["exports"] = _value.map((b) => b.finish()).toList(); 2850 _exports = _value;
2296 }
2297 } 2851 }
2298 2852
2299 /** 2853 /**
2300 * URIs referenced by part declarations in the compilation unit. 2854 * URIs referenced by part declarations in the compilation unit.
2301 */ 2855 */
2302 void set parts(List<String> _value) { 2856 void set parts(List<String> _value) {
2303 assert(!_finished); 2857 assert(!_finished);
2304 assert(!_json.containsKey("parts")); 2858 assert(!_partsIsSet);
2305 if (!(_value == null || _value.isEmpty)) { 2859 _partsIsSet = true;
2306 _json["parts"] = _value.toList(); 2860 _parts = _value;
2307 }
2308 } 2861 }
2309 2862
2310 List<int> toBuffer() => UTF8.encode(JSON.encode(finish())); 2863 List<int> toBuffer() {
2864 fb.Builder fbBuilder = new fb.Builder();
2865 return fbBuilder.finish(finish(fbBuilder));
2866 }
2311 2867
2312 Map finish() { 2868 fb.Offset finish(fb.Builder fbBuilder) {
2313 assert(!_finished); 2869 assert(!_finished);
2314 _finished = true; 2870 _finished = true;
2315 return _json; 2871 fb.Offset offset_names;
2872 fb.Offset offset_exports;
2873 fb.Offset offset_parts;
2874 if (!(_names == null || _names.isEmpty)) {
2875 offset_names = fbBuilder.writeList(_names.map((b) => b.finish(fbBuilder)). toList());
2876 }
2877 if (!(_exports == null || _exports.isEmpty)) {
2878 offset_exports = fbBuilder.writeList(_exports.map((b) => b.finish(fbBuilde r)).toList());
2879 }
2880 if (!(_parts == null || _parts.isEmpty)) {
2881 offset_parts = fbBuilder.writeList(_parts.map((b) => fbBuilder.writeString (b)).toList());
2882 }
2883 fbBuilder.startTable();
2884 if (offset_names != null) {
2885 fbBuilder.addOffset(0, offset_names);
2886 }
2887 if (offset_exports != null) {
2888 fbBuilder.addOffset(1, offset_exports);
2889 }
2890 if (offset_parts != null) {
2891 fbBuilder.addOffset(2, offset_parts);
2892 }
2893 return fbBuilder.endTable();
2316 } 2894 }
2317 } 2895 }
2318 2896
2319 UnlinkedPublicNamespaceBuilder encodeUnlinkedPublicNamespace(base.BuilderContext builderContext, {List<UnlinkedPublicNameBuilder> names, List<UnlinkedExportPubl icBuilder> exports, List<String> parts}) { 2897 UnlinkedPublicNamespaceBuilder encodeUnlinkedPublicNamespace(base.BuilderContext builderContext, {List<UnlinkedPublicNameBuilder> names, List<UnlinkedExportPubl icBuilder> exports, List<String> parts}) {
2320 UnlinkedPublicNamespaceBuilder builder = new UnlinkedPublicNamespaceBuilder(bu ilderContext); 2898 UnlinkedPublicNamespaceBuilder builder = new UnlinkedPublicNamespaceBuilder(bu ilderContext);
2321 builder.names = names; 2899 builder.names = names;
2322 builder.exports = exports; 2900 builder.exports = exports;
2323 builder.parts = parts; 2901 builder.parts = parts;
2324 return builder; 2902 return builder;
2325 } 2903 }
2326 2904
2327 /** 2905 /**
2328 * Unlinked summary information about a name referred to in one library that 2906 * Unlinked summary information about what a compilation unit contributes to a
2329 * might be defined in another. 2907 * library's public namespace. This is the subset of [UnlinkedUnit] that is
2908 * required from dependent libraries in order to perform prelinking.
2330 */ 2909 */
2331 class UnlinkedReference extends base.SummaryClass { 2910 abstract class UnlinkedPublicNamespace extends base.SummaryClass {
2911 factory UnlinkedPublicNamespace.fromBuffer(List<int> buffer) {
2912 fb.BufferPointer rootRef = new fb.BufferPointer.fromBytes(buffer);
2913 return const _UnlinkedPublicNamespaceReader().read(rootRef);
2914 }
2915
2916 /**
2917 * Public names defined in the compilation unit.
2918 *
2919 * TODO(paulberry): consider sorting these names to reduce unnecessary
2920 * relinking.
2921 */
2922 List<UnlinkedPublicName> get names;
2923
2924 /**
2925 * Export declarations in the compilation unit.
2926 */
2927 List<UnlinkedExportPublic> get exports;
2928
2929 /**
2930 * URIs referenced by part declarations in the compilation unit.
2931 */
2932 List<String> get parts;
2933 }
2934
2935 class _UnlinkedPublicNamespaceReader extends fb.TableReader<_UnlinkedPublicNames paceReader> implements UnlinkedPublicNamespace {
2936 final fb.BufferPointer _bp;
2937
2938 const _UnlinkedPublicNamespaceReader([this._bp]);
2939
2940 @override
2941 _UnlinkedPublicNamespaceReader createReader(fb.BufferPointer bp) => new _Unlin kedPublicNamespaceReader(bp);
2942
2943 @override
2944 Map<String, Object> toMap() => {};
2945
2946 @override
2947 List<UnlinkedPublicName> get names => const fb.ListReader<UnlinkedPublicName>( const _UnlinkedPublicNameReader()).vTableGet(_bp, 0, const <UnlinkedPublicName>[ ]);
2948
2949 @override
2950 List<UnlinkedExportPublic> get exports => const fb.ListReader<UnlinkedExportPu blic>(const _UnlinkedExportPublicReader()).vTableGet(_bp, 1, const <UnlinkedExpo rtPublic>[]);
2951
2952 @override
2953 List<String> get parts => const fb.ListReader<String>(const fb.StringReader()) .vTableGet(_bp, 2, const <String>[]);
2954 }
2955
2956 class UnlinkedReferenceBuilder {
2957 bool _finished = false;
2958
2332 String _name; 2959 String _name;
2333 int _prefixReference; 2960 int _prefixReference;
2334 2961
2335 UnlinkedReference.fromJson(Map json) 2962 bool _nameIsSet = false;
2336 : _name = json["name"], 2963 bool _prefixReferenceIsSet = false;
2337 _prefixReference = json["prefixReference"];
2338
2339 @override
2340 Map<String, Object> toMap() => {
2341 "name": name,
2342 "prefixReference": prefixReference,
2343 };
2344
2345 /**
2346 * Name of the entity being referred to. The empty string refers to the
2347 * pseudo-type `dynamic`.
2348 */
2349 String get name => _name ?? '';
2350
2351 /**
2352 * Prefix used to refer to the entity, or zero if no prefix is used. This is
2353 * an index into [UnlinkedUnit.references].
2354 */
2355 int get prefixReference => _prefixReference ?? 0;
2356 }
2357
2358 class UnlinkedReferenceBuilder {
2359 final Map _json = {};
2360
2361 bool _finished = false;
2362 2964
2363 UnlinkedReferenceBuilder(base.BuilderContext context); 2965 UnlinkedReferenceBuilder(base.BuilderContext context);
2364 2966
2365 /** 2967 /**
2366 * Name of the entity being referred to. The empty string refers to the 2968 * Name of the entity being referred to. The empty string refers to the
2367 * pseudo-type `dynamic`. 2969 * pseudo-type `dynamic`.
2368 */ 2970 */
2369 void set name(String _value) { 2971 void set name(String _value) {
2370 assert(!_finished); 2972 assert(!_finished);
2371 assert(!_json.containsKey("name")); 2973 assert(!_nameIsSet);
2372 if (_value != null) { 2974 _nameIsSet = true;
2373 _json["name"] = _value; 2975 _name = _value;
2374 }
2375 } 2976 }
2376 2977
2377 /** 2978 /**
2378 * Prefix used to refer to the entity, or zero if no prefix is used. This is 2979 * Prefix used to refer to the entity, or zero if no prefix is used. This is
2379 * an index into [UnlinkedUnit.references]. 2980 * an index into [UnlinkedUnit.references].
2380 */ 2981 */
2381 void set prefixReference(int _value) { 2982 void set prefixReference(int _value) {
2382 assert(!_finished); 2983 assert(!_finished);
2383 assert(!_json.containsKey("prefixReference")); 2984 assert(!_prefixReferenceIsSet);
2384 if (_value != null) { 2985 _prefixReferenceIsSet = true;
2385 _json["prefixReference"] = _value; 2986 _prefixReference = _value;
2386 }
2387 } 2987 }
2388 2988
2389 Map finish() { 2989 fb.Offset finish(fb.Builder fbBuilder) {
2390 assert(!_finished); 2990 assert(!_finished);
2391 _finished = true; 2991 _finished = true;
2392 return _json; 2992 fb.Offset offset_name;
2993 if (_name != null) {
2994 offset_name = fbBuilder.writeString(_name);
2995 }
2996 fbBuilder.startTable();
2997 if (offset_name != null) {
2998 fbBuilder.addOffset(0, offset_name);
2999 }
3000 if (_prefixReference != null && _prefixReference != 0) {
3001 fbBuilder.addInt32(1, _prefixReference);
3002 }
3003 return fbBuilder.endTable();
2393 } 3004 }
2394 } 3005 }
2395 3006
2396 UnlinkedReferenceBuilder encodeUnlinkedReference(base.BuilderContext builderCont ext, {String name, int prefixReference}) { 3007 UnlinkedReferenceBuilder encodeUnlinkedReference(base.BuilderContext builderCont ext, {String name, int prefixReference}) {
2397 UnlinkedReferenceBuilder builder = new UnlinkedReferenceBuilder(builderContext ); 3008 UnlinkedReferenceBuilder builder = new UnlinkedReferenceBuilder(builderContext );
2398 builder.name = name; 3009 builder.name = name;
2399 builder.prefixReference = prefixReference; 3010 builder.prefixReference = prefixReference;
2400 return builder; 3011 return builder;
2401 } 3012 }
2402 3013
2403 /** 3014 /**
2404 * Unlinked summary information about a typedef declaration. 3015 * Unlinked summary information about a name referred to in one library that
3016 * might be defined in another.
2405 */ 3017 */
2406 class UnlinkedTypedef extends base.SummaryClass { 3018 abstract class UnlinkedReference extends base.SummaryClass {
2407 String _name;
2408 int _nameOffset;
2409 UnlinkedDocumentationComment _documentationComment;
2410 List<UnlinkedTypeParam> _typeParameters;
2411 UnlinkedTypeRef _returnType;
2412 List<UnlinkedParam> _parameters;
2413 3019
2414 UnlinkedTypedef.fromJson(Map json) 3020 /**
2415 : _name = json["name"], 3021 * Name of the entity being referred to. The empty string refers to the
2416 _nameOffset = json["nameOffset"], 3022 * pseudo-type `dynamic`.
2417 _documentationComment = json["documentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["documentationComment"]), 3023 */
2418 _typeParameters = json["typeParameters"]?.map((x) => new UnlinkedTypeParam .fromJson(x))?.toList(), 3024 String get name;
2419 _returnType = json["returnType"] == null ? null : new UnlinkedTypeRef.from Json(json["returnType"]), 3025
2420 _parameters = json["parameters"]?.map((x) => new UnlinkedParam.fromJson(x) )?.toList(); 3026 /**
3027 * Prefix used to refer to the entity, or zero if no prefix is used. This is
3028 * an index into [UnlinkedUnit.references].
3029 */
3030 int get prefixReference;
3031 }
3032
3033 class _UnlinkedReferenceReader extends fb.TableReader<_UnlinkedReferenceReader> implements UnlinkedReference {
3034 final fb.BufferPointer _bp;
3035
3036 const _UnlinkedReferenceReader([this._bp]);
2421 3037
2422 @override 3038 @override
2423 Map<String, Object> toMap() => { 3039 _UnlinkedReferenceReader createReader(fb.BufferPointer bp) => new _UnlinkedRef erenceReader(bp);
2424 "name": name,
2425 "nameOffset": nameOffset,
2426 "documentationComment": documentationComment,
2427 "typeParameters": typeParameters,
2428 "returnType": returnType,
2429 "parameters": parameters,
2430 };
2431 3040
2432 /** 3041 @override
2433 * Name of the typedef. 3042 Map<String, Object> toMap() => {};
2434 */
2435 String get name => _name ?? '';
2436 3043
2437 /** 3044 @override
2438 * Offset of the typedef name relative to the beginning of the file. 3045 String get name => const fb.StringReader().vTableGet(_bp, 0, '');
2439 */
2440 int get nameOffset => _nameOffset ?? 0;
2441 3046
2442 /** 3047 @override
2443 * Documentation comment for the typedef, or `null` if there is no 3048 int get prefixReference => const fb.Int32Reader().vTableGet(_bp, 1, 0);
2444 * documentation comment.
2445 */
2446 UnlinkedDocumentationComment get documentationComment => _documentationComment ;
2447
2448 /**
2449 * Type parameters of the typedef, if any.
2450 */
2451 List<UnlinkedTypeParam> get typeParameters => _typeParameters ?? const <Unlink edTypeParam>[];
2452
2453 /**
2454 * Return type of the typedef. Absent if the return type is `void`.
2455 */
2456 UnlinkedTypeRef get returnType => _returnType;
2457
2458 /**
2459 * Parameters of the executable, if any.
2460 */
2461 List<UnlinkedParam> get parameters => _parameters ?? const <UnlinkedParam>[];
2462 } 3049 }
2463 3050
2464 class UnlinkedTypedefBuilder { 3051 class UnlinkedTypedefBuilder {
2465 final Map _json = {}; 3052 bool _finished = false;
2466 3053
2467 bool _finished = false; 3054 String _name;
3055 int _nameOffset;
3056 UnlinkedDocumentationCommentBuilder _documentationComment;
3057 List<UnlinkedTypeParamBuilder> _typeParameters;
3058 UnlinkedTypeRefBuilder _returnType;
3059 List<UnlinkedParamBuilder> _parameters;
3060
3061 bool _nameIsSet = false;
3062 bool _nameOffsetIsSet = false;
3063 bool _documentationCommentIsSet = false;
3064 bool _typeParametersIsSet = false;
3065 bool _returnTypeIsSet = false;
3066 bool _parametersIsSet = false;
2468 3067
2469 UnlinkedTypedefBuilder(base.BuilderContext context); 3068 UnlinkedTypedefBuilder(base.BuilderContext context);
2470 3069
2471 /** 3070 /**
2472 * Name of the typedef. 3071 * Name of the typedef.
2473 */ 3072 */
2474 void set name(String _value) { 3073 void set name(String _value) {
2475 assert(!_finished); 3074 assert(!_finished);
2476 assert(!_json.containsKey("name")); 3075 assert(!_nameIsSet);
2477 if (_value != null) { 3076 _nameIsSet = true;
2478 _json["name"] = _value; 3077 _name = _value;
2479 }
2480 } 3078 }
2481 3079
2482 /** 3080 /**
2483 * Offset of the typedef name relative to the beginning of the file. 3081 * Offset of the typedef name relative to the beginning of the file.
2484 */ 3082 */
2485 void set nameOffset(int _value) { 3083 void set nameOffset(int _value) {
2486 assert(!_finished); 3084 assert(!_finished);
2487 assert(!_json.containsKey("nameOffset")); 3085 assert(!_nameOffsetIsSet);
2488 if (_value != null) { 3086 _nameOffsetIsSet = true;
2489 _json["nameOffset"] = _value; 3087 _nameOffset = _value;
2490 }
2491 } 3088 }
2492 3089
2493 /** 3090 /**
2494 * Documentation comment for the typedef, or `null` if there is no 3091 * Documentation comment for the typedef, or `null` if there is no
2495 * documentation comment. 3092 * documentation comment.
2496 */ 3093 */
2497 void set documentationComment(UnlinkedDocumentationCommentBuilder _value) { 3094 void set documentationComment(UnlinkedDocumentationCommentBuilder _value) {
2498 assert(!_finished); 3095 assert(!_finished);
2499 assert(!_json.containsKey("documentationComment")); 3096 assert(!_documentationCommentIsSet);
2500 if (_value != null) { 3097 _documentationCommentIsSet = true;
2501 _json["documentationComment"] = _value.finish(); 3098 _documentationComment = _value;
2502 }
2503 } 3099 }
2504 3100
2505 /** 3101 /**
2506 * Type parameters of the typedef, if any. 3102 * Type parameters of the typedef, if any.
2507 */ 3103 */
2508 void set typeParameters(List<UnlinkedTypeParamBuilder> _value) { 3104 void set typeParameters(List<UnlinkedTypeParamBuilder> _value) {
2509 assert(!_finished); 3105 assert(!_finished);
2510 assert(!_json.containsKey("typeParameters")); 3106 assert(!_typeParametersIsSet);
2511 if (!(_value == null || _value.isEmpty)) { 3107 _typeParametersIsSet = true;
2512 _json["typeParameters"] = _value.map((b) => b.finish()).toList(); 3108 _typeParameters = _value;
2513 }
2514 } 3109 }
2515 3110
2516 /** 3111 /**
2517 * Return type of the typedef. Absent if the return type is `void`. 3112 * Return type of the typedef. Absent if the return type is `void`.
2518 */ 3113 */
2519 void set returnType(UnlinkedTypeRefBuilder _value) { 3114 void set returnType(UnlinkedTypeRefBuilder _value) {
2520 assert(!_finished); 3115 assert(!_finished);
2521 assert(!_json.containsKey("returnType")); 3116 assert(!_returnTypeIsSet);
2522 if (_value != null) { 3117 _returnTypeIsSet = true;
2523 _json["returnType"] = _value.finish(); 3118 _returnType = _value;
2524 }
2525 } 3119 }
2526 3120
2527 /** 3121 /**
2528 * Parameters of the executable, if any. 3122 * Parameters of the executable, if any.
2529 */ 3123 */
2530 void set parameters(List<UnlinkedParamBuilder> _value) { 3124 void set parameters(List<UnlinkedParamBuilder> _value) {
2531 assert(!_finished); 3125 assert(!_finished);
2532 assert(!_json.containsKey("parameters")); 3126 assert(!_parametersIsSet);
2533 if (!(_value == null || _value.isEmpty)) { 3127 _parametersIsSet = true;
2534 _json["parameters"] = _value.map((b) => b.finish()).toList(); 3128 _parameters = _value;
2535 }
2536 } 3129 }
2537 3130
2538 Map finish() { 3131 fb.Offset finish(fb.Builder fbBuilder) {
2539 assert(!_finished); 3132 assert(!_finished);
2540 _finished = true; 3133 _finished = true;
2541 return _json; 3134 fb.Offset offset_name;
3135 fb.Offset offset_documentationComment;
3136 fb.Offset offset_typeParameters;
3137 fb.Offset offset_returnType;
3138 fb.Offset offset_parameters;
3139 if (_name != null) {
3140 offset_name = fbBuilder.writeString(_name);
3141 }
3142 if (_documentationComment != null) {
3143 offset_documentationComment = _documentationComment.finish(fbBuilder);
3144 }
3145 if (!(_typeParameters == null || _typeParameters.isEmpty)) {
3146 offset_typeParameters = fbBuilder.writeList(_typeParameters.map((b) => b.f inish(fbBuilder)).toList());
3147 }
3148 if (_returnType != null) {
3149 offset_returnType = _returnType.finish(fbBuilder);
3150 }
3151 if (!(_parameters == null || _parameters.isEmpty)) {
3152 offset_parameters = fbBuilder.writeList(_parameters.map((b) => b.finish(fb Builder)).toList());
3153 }
3154 fbBuilder.startTable();
3155 if (offset_name != null) {
3156 fbBuilder.addOffset(0, offset_name);
3157 }
3158 if (_nameOffset != null && _nameOffset != 0) {
3159 fbBuilder.addInt32(1, _nameOffset);
3160 }
3161 if (offset_documentationComment != null) {
3162 fbBuilder.addOffset(2, offset_documentationComment);
3163 }
3164 if (offset_typeParameters != null) {
3165 fbBuilder.addOffset(3, offset_typeParameters);
3166 }
3167 if (offset_returnType != null) {
3168 fbBuilder.addOffset(4, offset_returnType);
3169 }
3170 if (offset_parameters != null) {
3171 fbBuilder.addOffset(5, offset_parameters);
3172 }
3173 return fbBuilder.endTable();
2542 } 3174 }
2543 } 3175 }
2544 3176
2545 UnlinkedTypedefBuilder encodeUnlinkedTypedef(base.BuilderContext builderContext, {String name, int nameOffset, UnlinkedDocumentationCommentBuilder documentation Comment, List<UnlinkedTypeParamBuilder> typeParameters, UnlinkedTypeRefBuilder r eturnType, List<UnlinkedParamBuilder> parameters}) { 3177 UnlinkedTypedefBuilder encodeUnlinkedTypedef(base.BuilderContext builderContext, {String name, int nameOffset, UnlinkedDocumentationCommentBuilder documentation Comment, List<UnlinkedTypeParamBuilder> typeParameters, UnlinkedTypeRefBuilder r eturnType, List<UnlinkedParamBuilder> parameters}) {
2546 UnlinkedTypedefBuilder builder = new UnlinkedTypedefBuilder(builderContext); 3178 UnlinkedTypedefBuilder builder = new UnlinkedTypedefBuilder(builderContext);
2547 builder.name = name; 3179 builder.name = name;
2548 builder.nameOffset = nameOffset; 3180 builder.nameOffset = nameOffset;
2549 builder.documentationComment = documentationComment; 3181 builder.documentationComment = documentationComment;
2550 builder.typeParameters = typeParameters; 3182 builder.typeParameters = typeParameters;
2551 builder.returnType = returnType; 3183 builder.returnType = returnType;
2552 builder.parameters = parameters; 3184 builder.parameters = parameters;
2553 return builder; 3185 return builder;
2554 } 3186 }
2555 3187
2556 /** 3188 /**
2557 * Unlinked summary information about a type parameter declaration. 3189 * Unlinked summary information about a typedef declaration.
2558 */ 3190 */
2559 class UnlinkedTypeParam extends base.SummaryClass { 3191 abstract class UnlinkedTypedef extends base.SummaryClass {
2560 String _name;
2561 int _nameOffset;
2562 UnlinkedTypeRef _bound;
2563 3192
2564 UnlinkedTypeParam.fromJson(Map json) 3193 /**
2565 : _name = json["name"], 3194 * Name of the typedef.
2566 _nameOffset = json["nameOffset"], 3195 */
2567 _bound = json["bound"] == null ? null : new UnlinkedTypeRef.fromJson(json[ "bound"]); 3196 String get name;
3197
3198 /**
3199 * Offset of the typedef name relative to the beginning of the file.
3200 */
3201 int get nameOffset;
3202
3203 /**
3204 * Documentation comment for the typedef, or `null` if there is no
3205 * documentation comment.
3206 */
3207 UnlinkedDocumentationComment get documentationComment;
3208
3209 /**
3210 * Type parameters of the typedef, if any.
3211 */
3212 List<UnlinkedTypeParam> get typeParameters;
3213
3214 /**
3215 * Return type of the typedef. Absent if the return type is `void`.
3216 */
3217 UnlinkedTypeRef get returnType;
3218
3219 /**
3220 * Parameters of the executable, if any.
3221 */
3222 List<UnlinkedParam> get parameters;
3223 }
3224
3225 class _UnlinkedTypedefReader extends fb.TableReader<_UnlinkedTypedefReader> impl ements UnlinkedTypedef {
3226 final fb.BufferPointer _bp;
3227
3228 const _UnlinkedTypedefReader([this._bp]);
2568 3229
2569 @override 3230 @override
2570 Map<String, Object> toMap() => { 3231 _UnlinkedTypedefReader createReader(fb.BufferPointer bp) => new _UnlinkedTyped efReader(bp);
2571 "name": name,
2572 "nameOffset": nameOffset,
2573 "bound": bound,
2574 };
2575 3232
2576 /** 3233 @override
2577 * Name of the type parameter. 3234 Map<String, Object> toMap() => {};
2578 */
2579 String get name => _name ?? '';
2580 3235
2581 /** 3236 @override
2582 * Offset of the type parameter name relative to the beginning of the file. 3237 String get name => const fb.StringReader().vTableGet(_bp, 0, '');
2583 */
2584 int get nameOffset => _nameOffset ?? 0;
2585 3238
2586 /** 3239 @override
2587 * Bound of the type parameter, if a bound is explicitly declared. Otherwise 3240 int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
2588 * null. 3241
2589 */ 3242 @override
2590 UnlinkedTypeRef get bound => _bound; 3243 UnlinkedDocumentationComment get documentationComment => const _UnlinkedDocume ntationCommentReader().vTableGet(_bp, 2, null);
3244
3245 @override
3246 List<UnlinkedTypeParam> get typeParameters => const fb.ListReader<UnlinkedType Param>(const _UnlinkedTypeParamReader()).vTableGet(_bp, 3, const <UnlinkedTypePa ram>[]);
3247
3248 @override
3249 UnlinkedTypeRef get returnType => const _UnlinkedTypeRefReader().vTableGet(_bp , 4, null);
3250
3251 @override
3252 List<UnlinkedParam> get parameters => const fb.ListReader<UnlinkedParam>(const _UnlinkedParamReader()).vTableGet(_bp, 5, const <UnlinkedParam>[]);
2591 } 3253 }
2592 3254
2593 class UnlinkedTypeParamBuilder { 3255 class UnlinkedTypeParamBuilder {
2594 final Map _json = {}; 3256 bool _finished = false;
2595 3257
2596 bool _finished = false; 3258 String _name;
3259 int _nameOffset;
3260 UnlinkedTypeRefBuilder _bound;
3261
3262 bool _nameIsSet = false;
3263 bool _nameOffsetIsSet = false;
3264 bool _boundIsSet = false;
2597 3265
2598 UnlinkedTypeParamBuilder(base.BuilderContext context); 3266 UnlinkedTypeParamBuilder(base.BuilderContext context);
2599 3267
2600 /** 3268 /**
2601 * Name of the type parameter. 3269 * Name of the type parameter.
2602 */ 3270 */
2603 void set name(String _value) { 3271 void set name(String _value) {
2604 assert(!_finished); 3272 assert(!_finished);
2605 assert(!_json.containsKey("name")); 3273 assert(!_nameIsSet);
2606 if (_value != null) { 3274 _nameIsSet = true;
2607 _json["name"] = _value; 3275 _name = _value;
2608 }
2609 } 3276 }
2610 3277
2611 /** 3278 /**
2612 * Offset of the type parameter name relative to the beginning of the file. 3279 * Offset of the type parameter name relative to the beginning of the file.
2613 */ 3280 */
2614 void set nameOffset(int _value) { 3281 void set nameOffset(int _value) {
2615 assert(!_finished); 3282 assert(!_finished);
2616 assert(!_json.containsKey("nameOffset")); 3283 assert(!_nameOffsetIsSet);
2617 if (_value != null) { 3284 _nameOffsetIsSet = true;
2618 _json["nameOffset"] = _value; 3285 _nameOffset = _value;
2619 }
2620 } 3286 }
2621 3287
2622 /** 3288 /**
2623 * Bound of the type parameter, if a bound is explicitly declared. Otherwise 3289 * Bound of the type parameter, if a bound is explicitly declared. Otherwise
2624 * null. 3290 * null.
2625 */ 3291 */
2626 void set bound(UnlinkedTypeRefBuilder _value) { 3292 void set bound(UnlinkedTypeRefBuilder _value) {
2627 assert(!_finished); 3293 assert(!_finished);
2628 assert(!_json.containsKey("bound")); 3294 assert(!_boundIsSet);
2629 if (_value != null) { 3295 _boundIsSet = true;
2630 _json["bound"] = _value.finish(); 3296 _bound = _value;
2631 }
2632 } 3297 }
2633 3298
2634 Map finish() { 3299 fb.Offset finish(fb.Builder fbBuilder) {
2635 assert(!_finished); 3300 assert(!_finished);
2636 _finished = true; 3301 _finished = true;
2637 return _json; 3302 fb.Offset offset_name;
3303 fb.Offset offset_bound;
3304 if (_name != null) {
3305 offset_name = fbBuilder.writeString(_name);
3306 }
3307 if (_bound != null) {
3308 offset_bound = _bound.finish(fbBuilder);
3309 }
3310 fbBuilder.startTable();
3311 if (offset_name != null) {
3312 fbBuilder.addOffset(0, offset_name);
3313 }
3314 if (_nameOffset != null && _nameOffset != 0) {
3315 fbBuilder.addInt32(1, _nameOffset);
3316 }
3317 if (offset_bound != null) {
3318 fbBuilder.addOffset(2, offset_bound);
3319 }
3320 return fbBuilder.endTable();
2638 } 3321 }
2639 } 3322 }
2640 3323
2641 UnlinkedTypeParamBuilder encodeUnlinkedTypeParam(base.BuilderContext builderCont ext, {String name, int nameOffset, UnlinkedTypeRefBuilder bound}) { 3324 UnlinkedTypeParamBuilder encodeUnlinkedTypeParam(base.BuilderContext builderCont ext, {String name, int nameOffset, UnlinkedTypeRefBuilder bound}) {
2642 UnlinkedTypeParamBuilder builder = new UnlinkedTypeParamBuilder(builderContext ); 3325 UnlinkedTypeParamBuilder builder = new UnlinkedTypeParamBuilder(builderContext );
2643 builder.name = name; 3326 builder.name = name;
2644 builder.nameOffset = nameOffset; 3327 builder.nameOffset = nameOffset;
2645 builder.bound = bound; 3328 builder.bound = bound;
2646 return builder; 3329 return builder;
2647 } 3330 }
2648 3331
2649 /** 3332 /**
2650 * Unlinked summary information about a reference to a type. 3333 * Unlinked summary information about a type parameter declaration.
2651 */ 3334 */
2652 class UnlinkedTypeRef extends base.SummaryClass { 3335 abstract class UnlinkedTypeParam extends base.SummaryClass {
2653 int _reference;
2654 int _paramReference;
2655 List<UnlinkedTypeRef> _typeArguments;
2656 3336
2657 UnlinkedTypeRef.fromJson(Map json) 3337 /**
2658 : _reference = json["reference"], 3338 * Name of the type parameter.
2659 _paramReference = json["paramReference"], 3339 */
2660 _typeArguments = json["typeArguments"]?.map((x) => new UnlinkedTypeRef.fro mJson(x))?.toList(); 3340 String get name;
3341
3342 /**
3343 * Offset of the type parameter name relative to the beginning of the file.
3344 */
3345 int get nameOffset;
3346
3347 /**
3348 * Bound of the type parameter, if a bound is explicitly declared. Otherwise
3349 * null.
3350 */
3351 UnlinkedTypeRef get bound;
3352 }
3353
3354 class _UnlinkedTypeParamReader extends fb.TableReader<_UnlinkedTypeParamReader> implements UnlinkedTypeParam {
3355 final fb.BufferPointer _bp;
3356
3357 const _UnlinkedTypeParamReader([this._bp]);
2661 3358
2662 @override 3359 @override
2663 Map<String, Object> toMap() => { 3360 _UnlinkedTypeParamReader createReader(fb.BufferPointer bp) => new _UnlinkedTyp eParamReader(bp);
2664 "reference": reference,
2665 "paramReference": paramReference,
2666 "typeArguments": typeArguments,
2667 };
2668 3361
2669 /** 3362 @override
2670 * Index into [UnlinkedUnit.references] for the type being referred to, or 3363 Map<String, Object> toMap() => {};
2671 * zero if this is a reference to a type parameter.
2672 *
2673 * Note that since zero is also a valid index into
2674 * [UnlinkedUnit.references], we cannot distinguish between references to
2675 * type parameters and references to types by checking [reference] against
2676 * zero. To distinguish between references to type parameters and references
2677 * to types, check whether [paramReference] is zero.
2678 */
2679 int get reference => _reference ?? 0;
2680 3364
2681 /** 3365 @override
2682 * If this is a reference to a type parameter, one-based index into the list 3366 String get name => const fb.StringReader().vTableGet(_bp, 0, '');
2683 * of [UnlinkedTypeParam]s currently in effect. Indexing is done using De
2684 * Bruijn index conventions; that is, innermost parameters come first, and
2685 * if a class or method has multiple parameters, they are indexed from right
2686 * to left. So for instance, if the enclosing declaration is
2687 *
2688 * class C<T,U> {
2689 * m<V,W> {
2690 * ...
2691 * }
2692 * }
2693 *
2694 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T,
2695 * respectively.
2696 *
2697 * If the type being referred to is not a type parameter, [paramReference] is
2698 * zero.
2699 */
2700 int get paramReference => _paramReference ?? 0;
2701 3367
2702 /** 3368 @override
2703 * If this is an instantiation of a generic type, the type arguments used to 3369 int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
2704 * instantiate it. Trailing type arguments of type `dynamic` are omitted. 3370
2705 */ 3371 @override
2706 List<UnlinkedTypeRef> get typeArguments => _typeArguments ?? const <UnlinkedTy peRef>[]; 3372 UnlinkedTypeRef get bound => const _UnlinkedTypeRefReader().vTableGet(_bp, 2, null);
2707 } 3373 }
2708 3374
2709 class UnlinkedTypeRefBuilder { 3375 class UnlinkedTypeRefBuilder {
2710 final Map _json = {}; 3376 bool _finished = false;
2711 3377
2712 bool _finished = false; 3378 int _reference;
3379 int _paramReference;
3380 List<UnlinkedTypeRefBuilder> _typeArguments;
3381
3382 bool _referenceIsSet = false;
3383 bool _paramReferenceIsSet = false;
3384 bool _typeArgumentsIsSet = false;
2713 3385
2714 UnlinkedTypeRefBuilder(base.BuilderContext context); 3386 UnlinkedTypeRefBuilder(base.BuilderContext context);
2715 3387
2716 /** 3388 /**
2717 * Index into [UnlinkedUnit.references] for the type being referred to, or 3389 * Index into [UnlinkedUnit.references] for the type being referred to, or
2718 * zero if this is a reference to a type parameter. 3390 * zero if this is a reference to a type parameter.
2719 * 3391 *
2720 * Note that since zero is also a valid index into 3392 * Note that since zero is also a valid index into
2721 * [UnlinkedUnit.references], we cannot distinguish between references to 3393 * [UnlinkedUnit.references], we cannot distinguish between references to
2722 * type parameters and references to types by checking [reference] against 3394 * type parameters and references to types by checking [reference] against
2723 * zero. To distinguish between references to type parameters and references 3395 * zero. To distinguish between references to type parameters and references
2724 * to types, check whether [paramReference] is zero. 3396 * to types, check whether [paramReference] is zero.
2725 */ 3397 */
2726 void set reference(int _value) { 3398 void set reference(int _value) {
2727 assert(!_finished); 3399 assert(!_finished);
2728 assert(!_json.containsKey("reference")); 3400 assert(!_referenceIsSet);
2729 if (_value != null) { 3401 _referenceIsSet = true;
2730 _json["reference"] = _value; 3402 _reference = _value;
2731 }
2732 } 3403 }
2733 3404
2734 /** 3405 /**
2735 * If this is a reference to a type parameter, one-based index into the list 3406 * If this is a reference to a type parameter, one-based index into the list
2736 * of [UnlinkedTypeParam]s currently in effect. Indexing is done using De 3407 * of [UnlinkedTypeParam]s currently in effect. Indexing is done using De
2737 * Bruijn index conventions; that is, innermost parameters come first, and 3408 * Bruijn index conventions; that is, innermost parameters come first, and
2738 * if a class or method has multiple parameters, they are indexed from right 3409 * if a class or method has multiple parameters, they are indexed from right
2739 * to left. So for instance, if the enclosing declaration is 3410 * to left. So for instance, if the enclosing declaration is
2740 * 3411 *
2741 * class C<T,U> { 3412 * class C<T,U> {
2742 * m<V,W> { 3413 * m<V,W> {
2743 * ... 3414 * ...
2744 * } 3415 * }
2745 * } 3416 * }
2746 * 3417 *
2747 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T, 3418 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T,
2748 * respectively. 3419 * respectively.
2749 * 3420 *
2750 * If the type being referred to is not a type parameter, [paramReference] is 3421 * If the type being referred to is not a type parameter, [paramReference] is
2751 * zero. 3422 * zero.
2752 */ 3423 */
2753 void set paramReference(int _value) { 3424 void set paramReference(int _value) {
2754 assert(!_finished); 3425 assert(!_finished);
2755 assert(!_json.containsKey("paramReference")); 3426 assert(!_paramReferenceIsSet);
2756 if (_value != null) { 3427 _paramReferenceIsSet = true;
2757 _json["paramReference"] = _value; 3428 _paramReference = _value;
2758 }
2759 } 3429 }
2760 3430
2761 /** 3431 /**
2762 * If this is an instantiation of a generic type, the type arguments used to 3432 * If this is an instantiation of a generic type, the type arguments used to
2763 * instantiate it. Trailing type arguments of type `dynamic` are omitted. 3433 * instantiate it. Trailing type arguments of type `dynamic` are omitted.
2764 */ 3434 */
2765 void set typeArguments(List<UnlinkedTypeRefBuilder> _value) { 3435 void set typeArguments(List<UnlinkedTypeRefBuilder> _value) {
2766 assert(!_finished); 3436 assert(!_finished);
2767 assert(!_json.containsKey("typeArguments")); 3437 assert(!_typeArgumentsIsSet);
2768 if (!(_value == null || _value.isEmpty)) { 3438 _typeArgumentsIsSet = true;
2769 _json["typeArguments"] = _value.map((b) => b.finish()).toList(); 3439 _typeArguments = _value;
2770 }
2771 } 3440 }
2772 3441
2773 Map finish() { 3442 fb.Offset finish(fb.Builder fbBuilder) {
2774 assert(!_finished); 3443 assert(!_finished);
2775 _finished = true; 3444 _finished = true;
2776 return _json; 3445 fb.Offset offset_typeArguments;
3446 if (!(_typeArguments == null || _typeArguments.isEmpty)) {
3447 offset_typeArguments = fbBuilder.writeList(_typeArguments.map((b) => b.fin ish(fbBuilder)).toList());
3448 }
3449 fbBuilder.startTable();
3450 if (_reference != null && _reference != 0) {
3451 fbBuilder.addInt32(0, _reference);
3452 }
3453 if (_paramReference != null && _paramReference != 0) {
3454 fbBuilder.addInt32(1, _paramReference);
3455 }
3456 if (offset_typeArguments != null) {
3457 fbBuilder.addOffset(2, offset_typeArguments);
3458 }
3459 return fbBuilder.endTable();
2777 } 3460 }
2778 } 3461 }
2779 3462
2780 UnlinkedTypeRefBuilder encodeUnlinkedTypeRef(base.BuilderContext builderContext, {int reference, int paramReference, List<UnlinkedTypeRefBuilder> typeArguments} ) { 3463 UnlinkedTypeRefBuilder encodeUnlinkedTypeRef(base.BuilderContext builderContext, {int reference, int paramReference, List<UnlinkedTypeRefBuilder> typeArguments} ) {
2781 UnlinkedTypeRefBuilder builder = new UnlinkedTypeRefBuilder(builderContext); 3464 UnlinkedTypeRefBuilder builder = new UnlinkedTypeRefBuilder(builderContext);
2782 builder.reference = reference; 3465 builder.reference = reference;
2783 builder.paramReference = paramReference; 3466 builder.paramReference = paramReference;
2784 builder.typeArguments = typeArguments; 3467 builder.typeArguments = typeArguments;
2785 return builder; 3468 return builder;
2786 } 3469 }
2787 3470
2788 /** 3471 /**
2789 * Unlinked summary information about a compilation unit ("part file"). 3472 * Unlinked summary information about a reference to a type.
2790 */ 3473 */
2791 class UnlinkedUnit extends base.SummaryClass { 3474 abstract class UnlinkedTypeRef extends base.SummaryClass {
3475
3476 /**
3477 * Index into [UnlinkedUnit.references] for the type being referred to, or
3478 * zero if this is a reference to a type parameter.
3479 *
3480 * Note that since zero is also a valid index into
3481 * [UnlinkedUnit.references], we cannot distinguish between references to
3482 * type parameters and references to types by checking [reference] against
3483 * zero. To distinguish between references to type parameters and references
3484 * to types, check whether [paramReference] is zero.
3485 */
3486 int get reference;
3487
3488 /**
3489 * If this is a reference to a type parameter, one-based index into the list
3490 * of [UnlinkedTypeParam]s currently in effect. Indexing is done using De
3491 * Bruijn index conventions; that is, innermost parameters come first, and
3492 * if a class or method has multiple parameters, they are indexed from right
3493 * to left. So for instance, if the enclosing declaration is
3494 *
3495 * class C<T,U> {
3496 * m<V,W> {
3497 * ...
3498 * }
3499 * }
3500 *
3501 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T,
3502 * respectively.
3503 *
3504 * If the type being referred to is not a type parameter, [paramReference] is
3505 * zero.
3506 */
3507 int get paramReference;
3508
3509 /**
3510 * If this is an instantiation of a generic type, the type arguments used to
3511 * instantiate it. Trailing type arguments of type `dynamic` are omitted.
3512 */
3513 List<UnlinkedTypeRef> get typeArguments;
3514 }
3515
3516 class _UnlinkedTypeRefReader extends fb.TableReader<_UnlinkedTypeRefReader> impl ements UnlinkedTypeRef {
3517 final fb.BufferPointer _bp;
3518
3519 const _UnlinkedTypeRefReader([this._bp]);
3520
3521 @override
3522 _UnlinkedTypeRefReader createReader(fb.BufferPointer bp) => new _UnlinkedTypeR efReader(bp);
3523
3524 @override
3525 Map<String, Object> toMap() => {};
3526
3527 @override
3528 int get reference => const fb.Int32Reader().vTableGet(_bp, 0, 0);
3529
3530 @override
3531 int get paramReference => const fb.Int32Reader().vTableGet(_bp, 1, 0);
3532
3533 @override
3534 List<UnlinkedTypeRef> get typeArguments => const fb.ListReader<UnlinkedTypeRef >(const _UnlinkedTypeRefReader()).vTableGet(_bp, 2, const <UnlinkedTypeRef>[]);
3535 }
3536
3537 class UnlinkedUnitBuilder {
3538 bool _finished = false;
3539
2792 String _libraryName; 3540 String _libraryName;
2793 int _libraryNameOffset; 3541 int _libraryNameOffset;
2794 int _libraryNameLength; 3542 int _libraryNameLength;
2795 UnlinkedDocumentationComment _libraryDocumentationComment; 3543 UnlinkedDocumentationCommentBuilder _libraryDocumentationComment;
2796 UnlinkedPublicNamespace _publicNamespace; 3544 UnlinkedPublicNamespaceBuilder _publicNamespace;
2797 List<UnlinkedReference> _references; 3545 List<UnlinkedReferenceBuilder> _references;
2798 List<UnlinkedClass> _classes; 3546 List<UnlinkedClassBuilder> _classes;
2799 List<UnlinkedEnum> _enums; 3547 List<UnlinkedEnumBuilder> _enums;
2800 List<UnlinkedExecutable> _executables; 3548 List<UnlinkedExecutableBuilder> _executables;
2801 List<UnlinkedExportNonPublic> _exports; 3549 List<UnlinkedExportNonPublicBuilder> _exports;
2802 List<UnlinkedImport> _imports; 3550 List<UnlinkedImportBuilder> _imports;
2803 List<UnlinkedPart> _parts; 3551 List<UnlinkedPartBuilder> _parts;
2804 List<UnlinkedTypedef> _typedefs; 3552 List<UnlinkedTypedefBuilder> _typedefs;
2805 List<UnlinkedVariable> _variables; 3553 List<UnlinkedVariableBuilder> _variables;
2806 3554
2807 UnlinkedUnit.fromJson(Map json) 3555 bool _libraryNameIsSet = false;
2808 : _libraryName = json["libraryName"], 3556 bool _libraryNameOffsetIsSet = false;
2809 _libraryNameOffset = json["libraryNameOffset"], 3557 bool _libraryNameLengthIsSet = false;
2810 _libraryNameLength = json["libraryNameLength"], 3558 bool _libraryDocumentationCommentIsSet = false;
2811 _libraryDocumentationComment = json["libraryDocumentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["libraryDocumentationCo mment"]), 3559 bool _publicNamespaceIsSet = false;
2812 _publicNamespace = json["publicNamespace"] == null ? null : new UnlinkedPu blicNamespace.fromJson(json["publicNamespace"]), 3560 bool _referencesIsSet = false;
2813 _references = json["references"]?.map((x) => new UnlinkedReference.fromJso n(x))?.toList(), 3561 bool _classesIsSet = false;
2814 _classes = json["classes"]?.map((x) => new UnlinkedClass.fromJson(x))?.toL ist(), 3562 bool _enumsIsSet = false;
2815 _enums = json["enums"]?.map((x) => new UnlinkedEnum.fromJson(x))?.toList() , 3563 bool _executablesIsSet = false;
2816 _executables = json["executables"]?.map((x) => new UnlinkedExecutable.from Json(x))?.toList(), 3564 bool _exportsIsSet = false;
2817 _exports = json["exports"]?.map((x) => new UnlinkedExportNonPublic.fromJso n(x))?.toList(), 3565 bool _importsIsSet = false;
2818 _imports = json["imports"]?.map((x) => new UnlinkedImport.fromJson(x))?.to List(), 3566 bool _partsIsSet = false;
2819 _parts = json["parts"]?.map((x) => new UnlinkedPart.fromJson(x))?.toList() , 3567 bool _typedefsIsSet = false;
2820 _typedefs = json["typedefs"]?.map((x) => new UnlinkedTypedef.fromJson(x))? .toList(), 3568 bool _variablesIsSet = false;
2821 _variables = json["variables"]?.map((x) => new UnlinkedVariable.fromJson(x ))?.toList();
2822
2823 @override
2824 Map<String, Object> toMap() => {
2825 "libraryName": libraryName,
2826 "libraryNameOffset": libraryNameOffset,
2827 "libraryNameLength": libraryNameLength,
2828 "libraryDocumentationComment": libraryDocumentationComment,
2829 "publicNamespace": publicNamespace,
2830 "references": references,
2831 "classes": classes,
2832 "enums": enums,
2833 "executables": executables,
2834 "exports": exports,
2835 "imports": imports,
2836 "parts": parts,
2837 "typedefs": typedefs,
2838 "variables": variables,
2839 };
2840
2841 UnlinkedUnit.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8.dec ode(buffer)));
2842
2843 /**
2844 * Name of the library (from a "library" declaration, if present).
2845 */
2846 String get libraryName => _libraryName ?? '';
2847
2848 /**
2849 * Offset of the library name relative to the beginning of the file (or 0 if
2850 * the library has no name).
2851 */
2852 int get libraryNameOffset => _libraryNameOffset ?? 0;
2853
2854 /**
2855 * Length of the library name as it appears in the source code (or 0 if the
2856 * library has no name).
2857 */
2858 int get libraryNameLength => _libraryNameLength ?? 0;
2859
2860 /**
2861 * Documentation comment for the library, or `null` if there is no
2862 * documentation comment.
2863 */
2864 UnlinkedDocumentationComment get libraryDocumentationComment => _libraryDocume ntationComment;
2865
2866 /**
2867 * Unlinked public namespace of this compilation unit.
2868 */
2869 UnlinkedPublicNamespace get publicNamespace => _publicNamespace;
2870
2871 /**
2872 * Top level and prefixed names referred to by this compilation unit. The
2873 * zeroth element of this array is always populated and always represents a
2874 * reference to the pseudo-type "dynamic".
2875 */
2876 List<UnlinkedReference> get references => _references ?? const <UnlinkedRefere nce>[];
2877
2878 /**
2879 * Classes declared in the compilation unit.
2880 */
2881 List<UnlinkedClass> get classes => _classes ?? const <UnlinkedClass>[];
2882
2883 /**
2884 * Enums declared in the compilation unit.
2885 */
2886 List<UnlinkedEnum> get enums => _enums ?? const <UnlinkedEnum>[];
2887
2888 /**
2889 * Top level executable objects (functions, getters, and setters) declared in
2890 * the compilation unit.
2891 */
2892 List<UnlinkedExecutable> get executables => _executables ?? const <UnlinkedExe cutable>[];
2893
2894 /**
2895 * Export declarations in the compilation unit.
2896 */
2897 List<UnlinkedExportNonPublic> get exports => _exports ?? const <UnlinkedExport NonPublic>[];
2898
2899 /**
2900 * Import declarations in the compilation unit.
2901 */
2902 List<UnlinkedImport> get imports => _imports ?? const <UnlinkedImport>[];
2903
2904 /**
2905 * Part declarations in the compilation unit.
2906 */
2907 List<UnlinkedPart> get parts => _parts ?? const <UnlinkedPart>[];
2908
2909 /**
2910 * Typedefs declared in the compilation unit.
2911 */
2912 List<UnlinkedTypedef> get typedefs => _typedefs ?? const <UnlinkedTypedef>[];
2913
2914 /**
2915 * Top level variables declared in the compilation unit.
2916 */
2917 List<UnlinkedVariable> get variables => _variables ?? const <UnlinkedVariable> [];
2918 }
2919
2920 class UnlinkedUnitBuilder {
2921 final Map _json = {};
2922
2923 bool _finished = false;
2924 3569
2925 UnlinkedUnitBuilder(base.BuilderContext context); 3570 UnlinkedUnitBuilder(base.BuilderContext context);
2926 3571
2927 /** 3572 /**
2928 * Name of the library (from a "library" declaration, if present). 3573 * Name of the library (from a "library" declaration, if present).
2929 */ 3574 */
2930 void set libraryName(String _value) { 3575 void set libraryName(String _value) {
2931 assert(!_finished); 3576 assert(!_finished);
2932 assert(!_json.containsKey("libraryName")); 3577 assert(!_libraryNameIsSet);
2933 if (_value != null) { 3578 _libraryNameIsSet = true;
2934 _json["libraryName"] = _value; 3579 _libraryName = _value;
2935 }
2936 } 3580 }
2937 3581
2938 /** 3582 /**
2939 * Offset of the library name relative to the beginning of the file (or 0 if 3583 * Offset of the library name relative to the beginning of the file (or 0 if
2940 * the library has no name). 3584 * the library has no name).
2941 */ 3585 */
2942 void set libraryNameOffset(int _value) { 3586 void set libraryNameOffset(int _value) {
2943 assert(!_finished); 3587 assert(!_finished);
2944 assert(!_json.containsKey("libraryNameOffset")); 3588 assert(!_libraryNameOffsetIsSet);
2945 if (_value != null) { 3589 _libraryNameOffsetIsSet = true;
2946 _json["libraryNameOffset"] = _value; 3590 _libraryNameOffset = _value;
2947 }
2948 } 3591 }
2949 3592
2950 /** 3593 /**
2951 * Length of the library name as it appears in the source code (or 0 if the 3594 * Length of the library name as it appears in the source code (or 0 if the
2952 * library has no name). 3595 * library has no name).
2953 */ 3596 */
2954 void set libraryNameLength(int _value) { 3597 void set libraryNameLength(int _value) {
2955 assert(!_finished); 3598 assert(!_finished);
2956 assert(!_json.containsKey("libraryNameLength")); 3599 assert(!_libraryNameLengthIsSet);
2957 if (_value != null) { 3600 _libraryNameLengthIsSet = true;
2958 _json["libraryNameLength"] = _value; 3601 _libraryNameLength = _value;
2959 }
2960 } 3602 }
2961 3603
2962 /** 3604 /**
2963 * Documentation comment for the library, or `null` if there is no 3605 * Documentation comment for the library, or `null` if there is no
2964 * documentation comment. 3606 * documentation comment.
2965 */ 3607 */
2966 void set libraryDocumentationComment(UnlinkedDocumentationCommentBuilder _valu e) { 3608 void set libraryDocumentationComment(UnlinkedDocumentationCommentBuilder _valu e) {
2967 assert(!_finished); 3609 assert(!_finished);
2968 assert(!_json.containsKey("libraryDocumentationComment")); 3610 assert(!_libraryDocumentationCommentIsSet);
2969 if (_value != null) { 3611 _libraryDocumentationCommentIsSet = true;
2970 _json["libraryDocumentationComment"] = _value.finish(); 3612 _libraryDocumentationComment = _value;
2971 }
2972 } 3613 }
2973 3614
2974 /** 3615 /**
2975 * Unlinked public namespace of this compilation unit. 3616 * Unlinked public namespace of this compilation unit.
2976 */ 3617 */
2977 void set publicNamespace(UnlinkedPublicNamespaceBuilder _value) { 3618 void set publicNamespace(UnlinkedPublicNamespaceBuilder _value) {
2978 assert(!_finished); 3619 assert(!_finished);
2979 assert(!_json.containsKey("publicNamespace")); 3620 assert(!_publicNamespaceIsSet);
2980 if (_value != null) { 3621 _publicNamespaceIsSet = true;
2981 _json["publicNamespace"] = _value.finish(); 3622 _publicNamespace = _value;
2982 }
2983 } 3623 }
2984 3624
2985 /** 3625 /**
2986 * Top level and prefixed names referred to by this compilation unit. The 3626 * Top level and prefixed names referred to by this compilation unit. The
2987 * zeroth element of this array is always populated and always represents a 3627 * zeroth element of this array is always populated and always represents a
2988 * reference to the pseudo-type "dynamic". 3628 * reference to the pseudo-type "dynamic".
2989 */ 3629 */
2990 void set references(List<UnlinkedReferenceBuilder> _value) { 3630 void set references(List<UnlinkedReferenceBuilder> _value) {
2991 assert(!_finished); 3631 assert(!_finished);
2992 assert(!_json.containsKey("references")); 3632 assert(!_referencesIsSet);
2993 if (!(_value == null || _value.isEmpty)) { 3633 _referencesIsSet = true;
2994 _json["references"] = _value.map((b) => b.finish()).toList(); 3634 _references = _value;
2995 }
2996 } 3635 }
2997 3636
2998 /** 3637 /**
2999 * Classes declared in the compilation unit. 3638 * Classes declared in the compilation unit.
3000 */ 3639 */
3001 void set classes(List<UnlinkedClassBuilder> _value) { 3640 void set classes(List<UnlinkedClassBuilder> _value) {
3002 assert(!_finished); 3641 assert(!_finished);
3003 assert(!_json.containsKey("classes")); 3642 assert(!_classesIsSet);
3004 if (!(_value == null || _value.isEmpty)) { 3643 _classesIsSet = true;
3005 _json["classes"] = _value.map((b) => b.finish()).toList(); 3644 _classes = _value;
3006 }
3007 } 3645 }
3008 3646
3009 /** 3647 /**
3010 * Enums declared in the compilation unit. 3648 * Enums declared in the compilation unit.
3011 */ 3649 */
3012 void set enums(List<UnlinkedEnumBuilder> _value) { 3650 void set enums(List<UnlinkedEnumBuilder> _value) {
3013 assert(!_finished); 3651 assert(!_finished);
3014 assert(!_json.containsKey("enums")); 3652 assert(!_enumsIsSet);
3015 if (!(_value == null || _value.isEmpty)) { 3653 _enumsIsSet = true;
3016 _json["enums"] = _value.map((b) => b.finish()).toList(); 3654 _enums = _value;
3017 }
3018 } 3655 }
3019 3656
3020 /** 3657 /**
3021 * Top level executable objects (functions, getters, and setters) declared in 3658 * Top level executable objects (functions, getters, and setters) declared in
3022 * the compilation unit. 3659 * the compilation unit.
3023 */ 3660 */
3024 void set executables(List<UnlinkedExecutableBuilder> _value) { 3661 void set executables(List<UnlinkedExecutableBuilder> _value) {
3025 assert(!_finished); 3662 assert(!_finished);
3026 assert(!_json.containsKey("executables")); 3663 assert(!_executablesIsSet);
3027 if (!(_value == null || _value.isEmpty)) { 3664 _executablesIsSet = true;
3028 _json["executables"] = _value.map((b) => b.finish()).toList(); 3665 _executables = _value;
3029 }
3030 } 3666 }
3031 3667
3032 /** 3668 /**
3033 * Export declarations in the compilation unit. 3669 * Export declarations in the compilation unit.
3034 */ 3670 */
3035 void set exports(List<UnlinkedExportNonPublicBuilder> _value) { 3671 void set exports(List<UnlinkedExportNonPublicBuilder> _value) {
3036 assert(!_finished); 3672 assert(!_finished);
3037 assert(!_json.containsKey("exports")); 3673 assert(!_exportsIsSet);
3038 if (!(_value == null || _value.isEmpty)) { 3674 _exportsIsSet = true;
3039 _json["exports"] = _value.map((b) => b.finish()).toList(); 3675 _exports = _value;
3040 }
3041 } 3676 }
3042 3677
3043 /** 3678 /**
3044 * Import declarations in the compilation unit. 3679 * Import declarations in the compilation unit.
3045 */ 3680 */
3046 void set imports(List<UnlinkedImportBuilder> _value) { 3681 void set imports(List<UnlinkedImportBuilder> _value) {
3047 assert(!_finished); 3682 assert(!_finished);
3048 assert(!_json.containsKey("imports")); 3683 assert(!_importsIsSet);
3049 if (!(_value == null || _value.isEmpty)) { 3684 _importsIsSet = true;
3050 _json["imports"] = _value.map((b) => b.finish()).toList(); 3685 _imports = _value;
3051 }
3052 } 3686 }
3053 3687
3054 /** 3688 /**
3055 * Part declarations in the compilation unit. 3689 * Part declarations in the compilation unit.
3056 */ 3690 */
3057 void set parts(List<UnlinkedPartBuilder> _value) { 3691 void set parts(List<UnlinkedPartBuilder> _value) {
3058 assert(!_finished); 3692 assert(!_finished);
3059 assert(!_json.containsKey("parts")); 3693 assert(!_partsIsSet);
3060 if (!(_value == null || _value.isEmpty)) { 3694 _partsIsSet = true;
3061 _json["parts"] = _value.map((b) => b.finish()).toList(); 3695 _parts = _value;
3062 }
3063 } 3696 }
3064 3697
3065 /** 3698 /**
3066 * Typedefs declared in the compilation unit. 3699 * Typedefs declared in the compilation unit.
3067 */ 3700 */
3068 void set typedefs(List<UnlinkedTypedefBuilder> _value) { 3701 void set typedefs(List<UnlinkedTypedefBuilder> _value) {
3069 assert(!_finished); 3702 assert(!_finished);
3070 assert(!_json.containsKey("typedefs")); 3703 assert(!_typedefsIsSet);
3071 if (!(_value == null || _value.isEmpty)) { 3704 _typedefsIsSet = true;
3072 _json["typedefs"] = _value.map((b) => b.finish()).toList(); 3705 _typedefs = _value;
3073 }
3074 } 3706 }
3075 3707
3076 /** 3708 /**
3077 * Top level variables declared in the compilation unit. 3709 * Top level variables declared in the compilation unit.
3078 */ 3710 */
3079 void set variables(List<UnlinkedVariableBuilder> _value) { 3711 void set variables(List<UnlinkedVariableBuilder> _value) {
3080 assert(!_finished); 3712 assert(!_finished);
3081 assert(!_json.containsKey("variables")); 3713 assert(!_variablesIsSet);
3082 if (!(_value == null || _value.isEmpty)) { 3714 _variablesIsSet = true;
3083 _json["variables"] = _value.map((b) => b.finish()).toList(); 3715 _variables = _value;
3084 }
3085 } 3716 }
3086 3717
3087 List<int> toBuffer() => UTF8.encode(JSON.encode(finish())); 3718 List<int> toBuffer() {
3719 fb.Builder fbBuilder = new fb.Builder();
3720 return fbBuilder.finish(finish(fbBuilder));
3721 }
3088 3722
3089 Map finish() { 3723 fb.Offset finish(fb.Builder fbBuilder) {
3090 assert(!_finished); 3724 assert(!_finished);
3091 _finished = true; 3725 _finished = true;
3092 return _json; 3726 fb.Offset offset_libraryName;
3727 fb.Offset offset_libraryDocumentationComment;
3728 fb.Offset offset_publicNamespace;
3729 fb.Offset offset_references;
3730 fb.Offset offset_classes;
3731 fb.Offset offset_enums;
3732 fb.Offset offset_executables;
3733 fb.Offset offset_exports;
3734 fb.Offset offset_imports;
3735 fb.Offset offset_parts;
3736 fb.Offset offset_typedefs;
3737 fb.Offset offset_variables;
3738 if (_libraryName != null) {
3739 offset_libraryName = fbBuilder.writeString(_libraryName);
3740 }
3741 if (_libraryDocumentationComment != null) {
3742 offset_libraryDocumentationComment = _libraryDocumentationComment.finish(f bBuilder);
3743 }
3744 if (_publicNamespace != null) {
3745 offset_publicNamespace = _publicNamespace.finish(fbBuilder);
3746 }
3747 if (!(_references == null || _references.isEmpty)) {
3748 offset_references = fbBuilder.writeList(_references.map((b) => b.finish(fb Builder)).toList());
3749 }
3750 if (!(_classes == null || _classes.isEmpty)) {
3751 offset_classes = fbBuilder.writeList(_classes.map((b) => b.finish(fbBuilde r)).toList());
3752 }
3753 if (!(_enums == null || _enums.isEmpty)) {
3754 offset_enums = fbBuilder.writeList(_enums.map((b) => b.finish(fbBuilder)). toList());
3755 }
3756 if (!(_executables == null || _executables.isEmpty)) {
3757 offset_executables = fbBuilder.writeList(_executables.map((b) => b.finish( fbBuilder)).toList());
3758 }
3759 if (!(_exports == null || _exports.isEmpty)) {
3760 offset_exports = fbBuilder.writeList(_exports.map((b) => b.finish(fbBuilde r)).toList());
3761 }
3762 if (!(_imports == null || _imports.isEmpty)) {
3763 offset_imports = fbBuilder.writeList(_imports.map((b) => b.finish(fbBuilde r)).toList());
3764 }
3765 if (!(_parts == null || _parts.isEmpty)) {
3766 offset_parts = fbBuilder.writeList(_parts.map((b) => b.finish(fbBuilder)). toList());
3767 }
3768 if (!(_typedefs == null || _typedefs.isEmpty)) {
3769 offset_typedefs = fbBuilder.writeList(_typedefs.map((b) => b.finish(fbBuil der)).toList());
3770 }
3771 if (!(_variables == null || _variables.isEmpty)) {
3772 offset_variables = fbBuilder.writeList(_variables.map((b) => b.finish(fbBu ilder)).toList());
3773 }
3774 fbBuilder.startTable();
3775 if (offset_libraryName != null) {
3776 fbBuilder.addOffset(0, offset_libraryName);
3777 }
3778 if (_libraryNameOffset != null && _libraryNameOffset != 0) {
3779 fbBuilder.addInt32(1, _libraryNameOffset);
3780 }
3781 if (_libraryNameLength != null && _libraryNameLength != 0) {
3782 fbBuilder.addInt32(2, _libraryNameLength);
3783 }
3784 if (offset_libraryDocumentationComment != null) {
3785 fbBuilder.addOffset(3, offset_libraryDocumentationComment);
3786 }
3787 if (offset_publicNamespace != null) {
3788 fbBuilder.addOffset(4, offset_publicNamespace);
3789 }
3790 if (offset_references != null) {
3791 fbBuilder.addOffset(5, offset_references);
3792 }
3793 if (offset_classes != null) {
3794 fbBuilder.addOffset(6, offset_classes);
3795 }
3796 if (offset_enums != null) {
3797 fbBuilder.addOffset(7, offset_enums);
3798 }
3799 if (offset_executables != null) {
3800 fbBuilder.addOffset(8, offset_executables);
3801 }
3802 if (offset_exports != null) {
3803 fbBuilder.addOffset(9, offset_exports);
3804 }
3805 if (offset_imports != null) {
3806 fbBuilder.addOffset(10, offset_imports);
3807 }
3808 if (offset_parts != null) {
3809 fbBuilder.addOffset(11, offset_parts);
3810 }
3811 if (offset_typedefs != null) {
3812 fbBuilder.addOffset(12, offset_typedefs);
3813 }
3814 if (offset_variables != null) {
3815 fbBuilder.addOffset(13, offset_variables);
3816 }
3817 return fbBuilder.endTable();
3093 } 3818 }
3094 } 3819 }
3095 3820
3096 UnlinkedUnitBuilder encodeUnlinkedUnit(base.BuilderContext builderContext, {Stri ng libraryName, int libraryNameOffset, int libraryNameLength, UnlinkedDocumentat ionCommentBuilder libraryDocumentationComment, UnlinkedPublicNamespaceBuilder pu blicNamespace, List<UnlinkedReferenceBuilder> references, List<UnlinkedClassBuil der> classes, List<UnlinkedEnumBuilder> enums, List<UnlinkedExecutableBuilder> e xecutables, List<UnlinkedExportNonPublicBuilder> exports, List<UnlinkedImportBui lder> imports, List<UnlinkedPartBuilder> parts, List<UnlinkedTypedefBuilder> typ edefs, List<UnlinkedVariableBuilder> variables}) { 3821 UnlinkedUnitBuilder encodeUnlinkedUnit(base.BuilderContext builderContext, {Stri ng libraryName, int libraryNameOffset, int libraryNameLength, UnlinkedDocumentat ionCommentBuilder libraryDocumentationComment, UnlinkedPublicNamespaceBuilder pu blicNamespace, List<UnlinkedReferenceBuilder> references, List<UnlinkedClassBuil der> classes, List<UnlinkedEnumBuilder> enums, List<UnlinkedExecutableBuilder> e xecutables, List<UnlinkedExportNonPublicBuilder> exports, List<UnlinkedImportBui lder> imports, List<UnlinkedPartBuilder> parts, List<UnlinkedTypedefBuilder> typ edefs, List<UnlinkedVariableBuilder> variables}) {
3097 UnlinkedUnitBuilder builder = new UnlinkedUnitBuilder(builderContext); 3822 UnlinkedUnitBuilder builder = new UnlinkedUnitBuilder(builderContext);
3098 builder.libraryName = libraryName; 3823 builder.libraryName = libraryName;
3099 builder.libraryNameOffset = libraryNameOffset; 3824 builder.libraryNameOffset = libraryNameOffset;
3100 builder.libraryNameLength = libraryNameLength; 3825 builder.libraryNameLength = libraryNameLength;
3101 builder.libraryDocumentationComment = libraryDocumentationComment; 3826 builder.libraryDocumentationComment = libraryDocumentationComment;
3102 builder.publicNamespace = publicNamespace; 3827 builder.publicNamespace = publicNamespace;
3103 builder.references = references; 3828 builder.references = references;
3104 builder.classes = classes; 3829 builder.classes = classes;
3105 builder.enums = enums; 3830 builder.enums = enums;
3106 builder.executables = executables; 3831 builder.executables = executables;
3107 builder.exports = exports; 3832 builder.exports = exports;
3108 builder.imports = imports; 3833 builder.imports = imports;
3109 builder.parts = parts; 3834 builder.parts = parts;
3110 builder.typedefs = typedefs; 3835 builder.typedefs = typedefs;
3111 builder.variables = variables; 3836 builder.variables = variables;
3112 return builder; 3837 return builder;
3113 } 3838 }
3114 3839
3115 /** 3840 /**
3116 * Unlinked summary information about a top level variable, local variable, or 3841 * Unlinked summary information about a compilation unit ("part file").
3117 * a field.
3118 */ 3842 */
3119 class UnlinkedVariable extends base.SummaryClass { 3843 abstract class UnlinkedUnit extends base.SummaryClass {
3844 factory UnlinkedUnit.fromBuffer(List<int> buffer) {
3845 fb.BufferPointer rootRef = new fb.BufferPointer.fromBytes(buffer);
3846 return const _UnlinkedUnitReader().read(rootRef);
3847 }
3848
3849 /**
3850 * Name of the library (from a "library" declaration, if present).
3851 */
3852 String get libraryName;
3853
3854 /**
3855 * Offset of the library name relative to the beginning of the file (or 0 if
3856 * the library has no name).
3857 */
3858 int get libraryNameOffset;
3859
3860 /**
3861 * Length of the library name as it appears in the source code (or 0 if the
3862 * library has no name).
3863 */
3864 int get libraryNameLength;
3865
3866 /**
3867 * Documentation comment for the library, or `null` if there is no
3868 * documentation comment.
3869 */
3870 UnlinkedDocumentationComment get libraryDocumentationComment;
3871
3872 /**
3873 * Unlinked public namespace of this compilation unit.
3874 */
3875 UnlinkedPublicNamespace get publicNamespace;
3876
3877 /**
3878 * Top level and prefixed names referred to by this compilation unit. The
3879 * zeroth element of this array is always populated and always represents a
3880 * reference to the pseudo-type "dynamic".
3881 */
3882 List<UnlinkedReference> get references;
3883
3884 /**
3885 * Classes declared in the compilation unit.
3886 */
3887 List<UnlinkedClass> get classes;
3888
3889 /**
3890 * Enums declared in the compilation unit.
3891 */
3892 List<UnlinkedEnum> get enums;
3893
3894 /**
3895 * Top level executable objects (functions, getters, and setters) declared in
3896 * the compilation unit.
3897 */
3898 List<UnlinkedExecutable> get executables;
3899
3900 /**
3901 * Export declarations in the compilation unit.
3902 */
3903 List<UnlinkedExportNonPublic> get exports;
3904
3905 /**
3906 * Import declarations in the compilation unit.
3907 */
3908 List<UnlinkedImport> get imports;
3909
3910 /**
3911 * Part declarations in the compilation unit.
3912 */
3913 List<UnlinkedPart> get parts;
3914
3915 /**
3916 * Typedefs declared in the compilation unit.
3917 */
3918 List<UnlinkedTypedef> get typedefs;
3919
3920 /**
3921 * Top level variables declared in the compilation unit.
3922 */
3923 List<UnlinkedVariable> get variables;
3924 }
3925
3926 class _UnlinkedUnitReader extends fb.TableReader<_UnlinkedUnitReader> implements UnlinkedUnit {
3927 final fb.BufferPointer _bp;
3928
3929 const _UnlinkedUnitReader([this._bp]);
3930
3931 @override
3932 _UnlinkedUnitReader createReader(fb.BufferPointer bp) => new _UnlinkedUnitRead er(bp);
3933
3934 @override
3935 Map<String, Object> toMap() => {};
3936
3937 @override
3938 String get libraryName => const fb.StringReader().vTableGet(_bp, 0, '');
3939
3940 @override
3941 int get libraryNameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
3942
3943 @override
3944 int get libraryNameLength => const fb.Int32Reader().vTableGet(_bp, 2, 0);
3945
3946 @override
3947 UnlinkedDocumentationComment get libraryDocumentationComment => const _Unlinke dDocumentationCommentReader().vTableGet(_bp, 3, null);
3948
3949 @override
3950 UnlinkedPublicNamespace get publicNamespace => const _UnlinkedPublicNamespaceR eader().vTableGet(_bp, 4, null);
3951
3952 @override
3953 List<UnlinkedReference> get references => const fb.ListReader<UnlinkedReferenc e>(const _UnlinkedReferenceReader()).vTableGet(_bp, 5, const <UnlinkedReference> []);
3954
3955 @override
3956 List<UnlinkedClass> get classes => const fb.ListReader<UnlinkedClass>(const _U nlinkedClassReader()).vTableGet(_bp, 6, const <UnlinkedClass>[]);
3957
3958 @override
3959 List<UnlinkedEnum> get enums => const fb.ListReader<UnlinkedEnum>(const _Unlin kedEnumReader()).vTableGet(_bp, 7, const <UnlinkedEnum>[]);
3960
3961 @override
3962 List<UnlinkedExecutable> get executables => const fb.ListReader<UnlinkedExecut able>(const _UnlinkedExecutableReader()).vTableGet(_bp, 8, const <UnlinkedExecut able>[]);
3963
3964 @override
3965 List<UnlinkedExportNonPublic> get exports => const fb.ListReader<UnlinkedExpor tNonPublic>(const _UnlinkedExportNonPublicReader()).vTableGet(_bp, 9, const <Unl inkedExportNonPublic>[]);
3966
3967 @override
3968 List<UnlinkedImport> get imports => const fb.ListReader<UnlinkedImport>(const _UnlinkedImportReader()).vTableGet(_bp, 10, const <UnlinkedImport>[]);
3969
3970 @override
3971 List<UnlinkedPart> get parts => const fb.ListReader<UnlinkedPart>(const _Unlin kedPartReader()).vTableGet(_bp, 11, const <UnlinkedPart>[]);
3972
3973 @override
3974 List<UnlinkedTypedef> get typedefs => const fb.ListReader<UnlinkedTypedef>(con st _UnlinkedTypedefReader()).vTableGet(_bp, 12, const <UnlinkedTypedef>[]);
3975
3976 @override
3977 List<UnlinkedVariable> get variables => const fb.ListReader<UnlinkedVariable>( const _UnlinkedVariableReader()).vTableGet(_bp, 13, const <UnlinkedVariable>[]);
3978 }
3979
3980 class UnlinkedVariableBuilder {
3981 bool _finished = false;
3982
3120 String _name; 3983 String _name;
3121 int _nameOffset; 3984 int _nameOffset;
3122 UnlinkedDocumentationComment _documentationComment; 3985 UnlinkedDocumentationCommentBuilder _documentationComment;
3123 UnlinkedTypeRef _type; 3986 UnlinkedTypeRefBuilder _type;
3124 bool _isStatic; 3987 bool _isStatic;
3125 bool _isFinal; 3988 bool _isFinal;
3126 bool _isConst; 3989 bool _isConst;
3127 bool _hasImplicitType; 3990 bool _hasImplicitType;
3128 3991
3129 UnlinkedVariable.fromJson(Map json) 3992 bool _nameIsSet = false;
3130 : _name = json["name"], 3993 bool _nameOffsetIsSet = false;
3131 _nameOffset = json["nameOffset"], 3994 bool _documentationCommentIsSet = false;
3132 _documentationComment = json["documentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["documentationComment"]), 3995 bool _typeIsSet = false;
3133 _type = json["type"] == null ? null : new UnlinkedTypeRef.fromJson(json["t ype"]), 3996 bool _isStaticIsSet = false;
3134 _isStatic = json["isStatic"], 3997 bool _isFinalIsSet = false;
3135 _isFinal = json["isFinal"], 3998 bool _isConstIsSet = false;
3136 _isConst = json["isConst"], 3999 bool _hasImplicitTypeIsSet = false;
3137 _hasImplicitType = json["hasImplicitType"];
3138
3139 @override
3140 Map<String, Object> toMap() => {
3141 "name": name,
3142 "nameOffset": nameOffset,
3143 "documentationComment": documentationComment,
3144 "type": type,
3145 "isStatic": isStatic,
3146 "isFinal": isFinal,
3147 "isConst": isConst,
3148 "hasImplicitType": hasImplicitType,
3149 };
3150
3151 /**
3152 * Name of the variable.
3153 */
3154 String get name => _name ?? '';
3155
3156 /**
3157 * Offset of the variable name relative to the beginning of the file.
3158 */
3159 int get nameOffset => _nameOffset ?? 0;
3160
3161 /**
3162 * Documentation comment for the variable, or `null` if there is no
3163 * documentation comment.
3164 */
3165 UnlinkedDocumentationComment get documentationComment => _documentationComment ;
3166
3167 /**
3168 * Declared type of the variable. Note that when strong mode is enabled, the
3169 * actual type of the variable may be different due to type inference.
3170 */
3171 UnlinkedTypeRef get type => _type;
3172
3173 /**
3174 * Indicates whether the variable is declared using the `static` keyword.
3175 *
3176 * Note that for top level variables, this flag is false, since they are not
3177 * declared using the `static` keyword (even though they are considered
3178 * static for semantic purposes).
3179 */
3180 bool get isStatic => _isStatic ?? false;
3181
3182 /**
3183 * Indicates whether the variable is declared using the `final` keyword.
3184 */
3185 bool get isFinal => _isFinal ?? false;
3186
3187 /**
3188 * Indicates whether the variable is declared using the `const` keyword.
3189 */
3190 bool get isConst => _isConst ?? false;
3191
3192 /**
3193 * Indicates whether this variable lacks an explicit type declaration.
3194 */
3195 bool get hasImplicitType => _hasImplicitType ?? false;
3196 }
3197
3198 class UnlinkedVariableBuilder {
3199 final Map _json = {};
3200
3201 bool _finished = false;
3202 4000
3203 UnlinkedVariableBuilder(base.BuilderContext context); 4001 UnlinkedVariableBuilder(base.BuilderContext context);
3204 4002
3205 /** 4003 /**
3206 * Name of the variable. 4004 * Name of the variable.
3207 */ 4005 */
3208 void set name(String _value) { 4006 void set name(String _value) {
3209 assert(!_finished); 4007 assert(!_finished);
3210 assert(!_json.containsKey("name")); 4008 assert(!_nameIsSet);
3211 if (_value != null) { 4009 _nameIsSet = true;
3212 _json["name"] = _value; 4010 _name = _value;
3213 }
3214 } 4011 }
3215 4012
3216 /** 4013 /**
3217 * Offset of the variable name relative to the beginning of the file. 4014 * Offset of the variable name relative to the beginning of the file.
3218 */ 4015 */
3219 void set nameOffset(int _value) { 4016 void set nameOffset(int _value) {
3220 assert(!_finished); 4017 assert(!_finished);
3221 assert(!_json.containsKey("nameOffset")); 4018 assert(!_nameOffsetIsSet);
3222 if (_value != null) { 4019 _nameOffsetIsSet = true;
3223 _json["nameOffset"] = _value; 4020 _nameOffset = _value;
3224 }
3225 } 4021 }
3226 4022
3227 /** 4023 /**
3228 * Documentation comment for the variable, or `null` if there is no 4024 * Documentation comment for the variable, or `null` if there is no
3229 * documentation comment. 4025 * documentation comment.
3230 */ 4026 */
3231 void set documentationComment(UnlinkedDocumentationCommentBuilder _value) { 4027 void set documentationComment(UnlinkedDocumentationCommentBuilder _value) {
3232 assert(!_finished); 4028 assert(!_finished);
3233 assert(!_json.containsKey("documentationComment")); 4029 assert(!_documentationCommentIsSet);
3234 if (_value != null) { 4030 _documentationCommentIsSet = true;
3235 _json["documentationComment"] = _value.finish(); 4031 _documentationComment = _value;
3236 }
3237 } 4032 }
3238 4033
3239 /** 4034 /**
3240 * Declared type of the variable. Note that when strong mode is enabled, the 4035 * Declared type of the variable. Note that when strong mode is enabled, the
3241 * actual type of the variable may be different due to type inference. 4036 * actual type of the variable may be different due to type inference.
3242 */ 4037 */
3243 void set type(UnlinkedTypeRefBuilder _value) { 4038 void set type(UnlinkedTypeRefBuilder _value) {
3244 assert(!_finished); 4039 assert(!_finished);
3245 assert(!_json.containsKey("type")); 4040 assert(!_typeIsSet);
3246 if (_value != null) { 4041 _typeIsSet = true;
3247 _json["type"] = _value.finish(); 4042 _type = _value;
3248 }
3249 } 4043 }
3250 4044
3251 /** 4045 /**
3252 * Indicates whether the variable is declared using the `static` keyword. 4046 * Indicates whether the variable is declared using the `static` keyword.
3253 * 4047 *
3254 * Note that for top level variables, this flag is false, since they are not 4048 * Note that for top level variables, this flag is false, since they are not
3255 * declared using the `static` keyword (even though they are considered 4049 * declared using the `static` keyword (even though they are considered
3256 * static for semantic purposes). 4050 * static for semantic purposes).
3257 */ 4051 */
3258 void set isStatic(bool _value) { 4052 void set isStatic(bool _value) {
3259 assert(!_finished); 4053 assert(!_finished);
3260 assert(!_json.containsKey("isStatic")); 4054 assert(!_isStaticIsSet);
3261 if (_value != null) { 4055 _isStaticIsSet = true;
3262 _json["isStatic"] = _value; 4056 _isStatic = _value;
3263 }
3264 } 4057 }
3265 4058
3266 /** 4059 /**
3267 * Indicates whether the variable is declared using the `final` keyword. 4060 * Indicates whether the variable is declared using the `final` keyword.
3268 */ 4061 */
3269 void set isFinal(bool _value) { 4062 void set isFinal(bool _value) {
3270 assert(!_finished); 4063 assert(!_finished);
3271 assert(!_json.containsKey("isFinal")); 4064 assert(!_isFinalIsSet);
3272 if (_value != null) { 4065 _isFinalIsSet = true;
3273 _json["isFinal"] = _value; 4066 _isFinal = _value;
3274 }
3275 } 4067 }
3276 4068
3277 /** 4069 /**
3278 * Indicates whether the variable is declared using the `const` keyword. 4070 * Indicates whether the variable is declared using the `const` keyword.
3279 */ 4071 */
3280 void set isConst(bool _value) { 4072 void set isConst(bool _value) {
3281 assert(!_finished); 4073 assert(!_finished);
3282 assert(!_json.containsKey("isConst")); 4074 assert(!_isConstIsSet);
3283 if (_value != null) { 4075 _isConstIsSet = true;
3284 _json["isConst"] = _value; 4076 _isConst = _value;
3285 }
3286 } 4077 }
3287 4078
3288 /** 4079 /**
3289 * Indicates whether this variable lacks an explicit type declaration. 4080 * Indicates whether this variable lacks an explicit type declaration.
3290 */ 4081 */
3291 void set hasImplicitType(bool _value) { 4082 void set hasImplicitType(bool _value) {
3292 assert(!_finished); 4083 assert(!_finished);
3293 assert(!_json.containsKey("hasImplicitType")); 4084 assert(!_hasImplicitTypeIsSet);
3294 if (_value != null) { 4085 _hasImplicitTypeIsSet = true;
3295 _json["hasImplicitType"] = _value; 4086 _hasImplicitType = _value;
3296 }
3297 } 4087 }
3298 4088
3299 Map finish() { 4089 fb.Offset finish(fb.Builder fbBuilder) {
3300 assert(!_finished); 4090 assert(!_finished);
3301 _finished = true; 4091 _finished = true;
3302 return _json; 4092 fb.Offset offset_name;
4093 fb.Offset offset_documentationComment;
4094 fb.Offset offset_type;
4095 if (_name != null) {
4096 offset_name = fbBuilder.writeString(_name);
4097 }
4098 if (_documentationComment != null) {
4099 offset_documentationComment = _documentationComment.finish(fbBuilder);
4100 }
4101 if (_type != null) {
4102 offset_type = _type.finish(fbBuilder);
4103 }
4104 fbBuilder.startTable();
4105 if (offset_name != null) {
4106 fbBuilder.addOffset(0, offset_name);
4107 }
4108 if (_nameOffset != null && _nameOffset != 0) {
4109 fbBuilder.addInt32(1, _nameOffset);
4110 }
4111 if (offset_documentationComment != null) {
4112 fbBuilder.addOffset(2, offset_documentationComment);
4113 }
4114 if (offset_type != null) {
4115 fbBuilder.addOffset(3, offset_type);
4116 }
4117 if (_isStatic == true) {
4118 fbBuilder.addInt8(4, 1);
4119 }
4120 if (_isFinal == true) {
4121 fbBuilder.addInt8(5, 1);
4122 }
4123 if (_isConst == true) {
4124 fbBuilder.addInt8(6, 1);
4125 }
4126 if (_hasImplicitType == true) {
4127 fbBuilder.addInt8(7, 1);
4128 }
4129 return fbBuilder.endTable();
3303 } 4130 }
3304 } 4131 }
3305 4132
3306 UnlinkedVariableBuilder encodeUnlinkedVariable(base.BuilderContext builderContex t, {String name, int nameOffset, UnlinkedDocumentationCommentBuilder documentati onComment, UnlinkedTypeRefBuilder type, bool isStatic, bool isFinal, bool isCons t, bool hasImplicitType}) { 4133 UnlinkedVariableBuilder encodeUnlinkedVariable(base.BuilderContext builderContex t, {String name, int nameOffset, UnlinkedDocumentationCommentBuilder documentati onComment, UnlinkedTypeRefBuilder type, bool isStatic, bool isFinal, bool isCons t, bool hasImplicitType}) {
3307 UnlinkedVariableBuilder builder = new UnlinkedVariableBuilder(builderContext); 4134 UnlinkedVariableBuilder builder = new UnlinkedVariableBuilder(builderContext);
3308 builder.name = name; 4135 builder.name = name;
3309 builder.nameOffset = nameOffset; 4136 builder.nameOffset = nameOffset;
3310 builder.documentationComment = documentationComment; 4137 builder.documentationComment = documentationComment;
3311 builder.type = type; 4138 builder.type = type;
3312 builder.isStatic = isStatic; 4139 builder.isStatic = isStatic;
3313 builder.isFinal = isFinal; 4140 builder.isFinal = isFinal;
3314 builder.isConst = isConst; 4141 builder.isConst = isConst;
3315 builder.hasImplicitType = hasImplicitType; 4142 builder.hasImplicitType = hasImplicitType;
3316 return builder; 4143 return builder;
3317 } 4144 }
3318 4145
4146 /**
4147 * Unlinked summary information about a top level variable, local variable, or
4148 * a field.
4149 */
4150 abstract class UnlinkedVariable extends base.SummaryClass {
4151
4152 /**
4153 * Name of the variable.
4154 */
4155 String get name;
4156
4157 /**
4158 * Offset of the variable name relative to the beginning of the file.
4159 */
4160 int get nameOffset;
4161
4162 /**
4163 * Documentation comment for the variable, or `null` if there is no
4164 * documentation comment.
4165 */
4166 UnlinkedDocumentationComment get documentationComment;
4167
4168 /**
4169 * Declared type of the variable. Note that when strong mode is enabled, the
4170 * actual type of the variable may be different due to type inference.
4171 */
4172 UnlinkedTypeRef get type;
4173
4174 /**
4175 * Indicates whether the variable is declared using the `static` keyword.
4176 *
4177 * Note that for top level variables, this flag is false, since they are not
4178 * declared using the `static` keyword (even though they are considered
4179 * static for semantic purposes).
4180 */
4181 bool get isStatic;
4182
4183 /**
4184 * Indicates whether the variable is declared using the `final` keyword.
4185 */
4186 bool get isFinal;
4187
4188 /**
4189 * Indicates whether the variable is declared using the `const` keyword.
4190 */
4191 bool get isConst;
4192
4193 /**
4194 * Indicates whether this variable lacks an explicit type declaration.
4195 */
4196 bool get hasImplicitType;
4197 }
4198
4199 class _UnlinkedVariableReader extends fb.TableReader<_UnlinkedVariableReader> im plements UnlinkedVariable {
4200 final fb.BufferPointer _bp;
4201
4202 const _UnlinkedVariableReader([this._bp]);
4203
4204 @override
4205 _UnlinkedVariableReader createReader(fb.BufferPointer bp) => new _UnlinkedVari ableReader(bp);
4206
4207 @override
4208 Map<String, Object> toMap() => {};
4209
4210 @override
4211 String get name => const fb.StringReader().vTableGet(_bp, 0, '');
4212
4213 @override
4214 int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
4215
4216 @override
4217 UnlinkedDocumentationComment get documentationComment => const _UnlinkedDocume ntationCommentReader().vTableGet(_bp, 2, null);
4218
4219 @override
4220 UnlinkedTypeRef get type => const _UnlinkedTypeRefReader().vTableGet(_bp, 3, n ull);
4221
4222 @override
4223 bool get isStatic => const fb.Int8Reader().vTableGet(_bp, 4, 0) == 1;
4224
4225 @override
4226 bool get isFinal => const fb.Int8Reader().vTableGet(_bp, 5, 0) == 1;
4227
4228 @override
4229 bool get isConst => const fb.Int8Reader().vTableGet(_bp, 6, 0) == 1;
4230
4231 @override
4232 bool get hasImplicitType => const fb.Int8Reader().vTableGet(_bp, 7, 0) == 1;
4233 }
4234
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/summary_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698