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

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

Issue 1563453002: Generate documentation 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
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'; 10 import 'dart:convert';
11 import 'base.dart' as base; 11 import 'base.dart' as base;
12 12
13 /**
14 * Enum used to indicate the kind of entity referred to by a
15 * [PrelinkedReference].
16 */
13 enum PrelinkedReferenceKind { 17 enum PrelinkedReferenceKind {
14 classOrEnum, 18 classOrEnum,
15 typedef, 19 typedef,
16 other, 20 other,
17 prefix, 21 prefix,
18 unresolved, 22 unresolved,
19 } 23 }
20 24
25 /**
26 * Enum used to indicate the kind of an executable.
27 */
21 enum UnlinkedExecutableKind { 28 enum UnlinkedExecutableKind {
22 functionOrMethod, 29 functionOrMethod,
23 getter, 30 getter,
24 setter, 31 setter,
25 constructor, 32 constructor,
26 } 33 }
27 34
35 /**
36 * Enum used to indicate the kind of a parameter.
37 */
28 enum UnlinkedParamKind { 38 enum UnlinkedParamKind {
29 required, 39 required,
30 positional, 40 positional,
31 named, 41 named,
32 } 42 }
33 43
44 /**
45 * Information about a dependency that exists between one library and another
46 * due to an "import" declaration.
47 */
34 class PrelinkedDependency extends base.SummaryClass { 48 class PrelinkedDependency extends base.SummaryClass {
35 String _uri; 49 String _uri;
36 50
37 PrelinkedDependency.fromJson(Map json) 51 PrelinkedDependency.fromJson(Map json)
38 : _uri = json["uri"]; 52 : _uri = json["uri"];
39 53
40 @override 54 @override
41 Map<String, Object> toMap() => { 55 Map<String, Object> toMap() => {
42 "uri": uri, 56 "uri": uri,
43 }; 57 };
44 58
59 /**
60 * The relative URI used to import one library from the other.
61 */
45 String get uri => _uri ?? ''; 62 String get uri => _uri ?? '';
46 } 63 }
47 64
48 class PrelinkedDependencyBuilder { 65 class PrelinkedDependencyBuilder {
49 final Map _json = {}; 66 final Map _json = {};
50 67
51 bool _finished = false; 68 bool _finished = false;
52 69
53 PrelinkedDependencyBuilder(base.BuilderContext context); 70 PrelinkedDependencyBuilder(base.BuilderContext context);
54 71
72 /**
73 * The relative URI used to import one library from the other.
74 */
55 void set uri(String _value) { 75 void set uri(String _value) {
56 assert(!_finished); 76 assert(!_finished);
57 assert(!_json.containsKey("uri")); 77 assert(!_json.containsKey("uri"));
58 if (_value != null) { 78 if (_value != null) {
59 _json["uri"] = _value; 79 _json["uri"] = _value;
60 } 80 }
61 } 81 }
62 82
63 Map finish() { 83 Map finish() {
64 assert(!_finished); 84 assert(!_finished);
65 _finished = true; 85 _finished = true;
66 return _json; 86 return _json;
67 } 87 }
68 } 88 }
69 89
70 PrelinkedDependencyBuilder encodePrelinkedDependency(base.BuilderContext builder Context, {String uri}) { 90 PrelinkedDependencyBuilder encodePrelinkedDependency(base.BuilderContext builder Context, {String uri}) {
71 PrelinkedDependencyBuilder builder = new PrelinkedDependencyBuilder(builderCon text); 91 PrelinkedDependencyBuilder builder = new PrelinkedDependencyBuilder(builderCon text);
72 builder.uri = uri; 92 builder.uri = uri;
73 return builder; 93 return builder;
74 } 94 }
75 95
96 /**
97 * Pre-linked summary of a library.
98 */
76 class PrelinkedLibrary extends base.SummaryClass { 99 class PrelinkedLibrary extends base.SummaryClass {
77 List<PrelinkedUnit> _units; 100 List<PrelinkedUnit> _units;
78 List<PrelinkedDependency> _dependencies; 101 List<PrelinkedDependency> _dependencies;
79 List<int> _importDependencies; 102 List<int> _importDependencies;
80 103
81 PrelinkedLibrary.fromJson(Map json) 104 PrelinkedLibrary.fromJson(Map json)
82 : _units = json["units"]?.map((x) => new PrelinkedUnit.fromJson(x))?.toList( ), 105 : _units = json["units"]?.map((x) => new PrelinkedUnit.fromJson(x))?.toList( ),
83 _dependencies = json["dependencies"]?.map((x) => new PrelinkedDependency.f romJson(x))?.toList(), 106 _dependencies = json["dependencies"]?.map((x) => new PrelinkedDependency.f romJson(x))?.toList(),
84 _importDependencies = json["importDependencies"]; 107 _importDependencies = json["importDependencies"];
85 108
86 @override 109 @override
87 Map<String, Object> toMap() => { 110 Map<String, Object> toMap() => {
88 "units": units, 111 "units": units,
89 "dependencies": dependencies, 112 "dependencies": dependencies,
90 "importDependencies": importDependencies, 113 "importDependencies": importDependencies,
91 }; 114 };
92 115
93 PrelinkedLibrary.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8 .decode(buffer))); 116 PrelinkedLibrary.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8 .decode(buffer)));
94 117
118 /**
119 * The pre-linked summary of all the compilation units constituting the
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 */
95 List<PrelinkedUnit> get units => _units ?? const <PrelinkedUnit>[]; 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 */
96 List<PrelinkedDependency> get dependencies => _dependencies ?? const <Prelinke dDependency>[]; 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 */
97 List<int> get importDependencies => _importDependencies ?? const <int>[]; 144 List<int> get importDependencies => _importDependencies ?? const <int>[];
98 } 145 }
99 146
100 class PrelinkedLibraryBuilder { 147 class PrelinkedLibraryBuilder {
101 final Map _json = {}; 148 final Map _json = {};
102 149
103 bool _finished = false; 150 bool _finished = false;
104 151
105 PrelinkedLibraryBuilder(base.BuilderContext context); 152 PrelinkedLibraryBuilder(base.BuilderContext context);
106 153
154 /**
155 * The pre-linked summary of all the compilation units constituting the
156 * 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`
158 * declarations in the defining compilation unit.
159 */
107 void set units(List<PrelinkedUnitBuilder> _value) { 160 void set units(List<PrelinkedUnitBuilder> _value) {
108 assert(!_finished); 161 assert(!_finished);
109 assert(!_json.containsKey("units")); 162 assert(!_json.containsKey("units"));
110 if (!(_value == null || _value.isEmpty)) { 163 if (!(_value == null || _value.isEmpty)) {
111 _json["units"] = _value.map((b) => b.finish()).toList(); 164 _json["units"] = _value.map((b) => b.finish()).toList();
112 } 165 }
113 } 166 }
114 167
168 /**
169 * The libraries that this library depends on (either via an explicit import
170 * statement or via the implicit dependencies on `dart:core` and
171 * `dart:async`). The first element of this array is a pseudo-dependency
172 * representing the library itself (it is also used for "dynamic").
173 *
174 * TODO(paulberry): consider removing this entirely and just using
175 * [UnlinkedLibrary.imports].
176 */
115 void set dependencies(List<PrelinkedDependencyBuilder> _value) { 177 void set dependencies(List<PrelinkedDependencyBuilder> _value) {
116 assert(!_finished); 178 assert(!_finished);
117 assert(!_json.containsKey("dependencies")); 179 assert(!_json.containsKey("dependencies"));
118 if (!(_value == null || _value.isEmpty)) { 180 if (!(_value == null || _value.isEmpty)) {
119 _json["dependencies"] = _value.map((b) => b.finish()).toList(); 181 _json["dependencies"] = _value.map((b) => b.finish()).toList();
120 } 182 }
121 } 183 }
122 184
185 /**
186 * For each import in [UnlinkedUnit.imports], an index into [dependencies]
187 * of the library being imported.
188 *
189 * TODO(paulberry): if [dependencies] is removed, this can be removed as
190 * well, since there will effectively be a one-to-one mapping.
191 */
123 void set importDependencies(List<int> _value) { 192 void set importDependencies(List<int> _value) {
124 assert(!_finished); 193 assert(!_finished);
125 assert(!_json.containsKey("importDependencies")); 194 assert(!_json.containsKey("importDependencies"));
126 if (!(_value == null || _value.isEmpty)) { 195 if (!(_value == null || _value.isEmpty)) {
127 _json["importDependencies"] = _value.toList(); 196 _json["importDependencies"] = _value.toList();
128 } 197 }
129 } 198 }
130 199
131 List<int> toBuffer() => UTF8.encode(JSON.encode(finish())); 200 List<int> toBuffer() => UTF8.encode(JSON.encode(finish()));
132 201
133 Map finish() { 202 Map finish() {
134 assert(!_finished); 203 assert(!_finished);
135 _finished = true; 204 _finished = true;
136 return _json; 205 return _json;
137 } 206 }
138 } 207 }
139 208
140 PrelinkedLibraryBuilder encodePrelinkedLibrary(base.BuilderContext builderContex t, {List<PrelinkedUnitBuilder> units, List<PrelinkedDependencyBuilder> dependenc ies, List<int> importDependencies}) { 209 PrelinkedLibraryBuilder encodePrelinkedLibrary(base.BuilderContext builderContex t, {List<PrelinkedUnitBuilder> units, List<PrelinkedDependencyBuilder> dependenc ies, List<int> importDependencies}) {
141 PrelinkedLibraryBuilder builder = new PrelinkedLibraryBuilder(builderContext); 210 PrelinkedLibraryBuilder builder = new PrelinkedLibraryBuilder(builderContext);
142 builder.units = units; 211 builder.units = units;
143 builder.dependencies = dependencies; 212 builder.dependencies = dependencies;
144 builder.importDependencies = importDependencies; 213 builder.importDependencies = importDependencies;
145 return builder; 214 return builder;
146 } 215 }
147 216
217 /**
218 * Information about the resolution of an [UnlinkedReference].
219 */
148 class PrelinkedReference extends base.SummaryClass { 220 class PrelinkedReference extends base.SummaryClass {
149 int _dependency; 221 int _dependency;
150 PrelinkedReferenceKind _kind; 222 PrelinkedReferenceKind _kind;
151 int _unit; 223 int _unit;
152 int _numTypeParameters; 224 int _numTypeParameters;
153 225
154 PrelinkedReference.fromJson(Map json) 226 PrelinkedReference.fromJson(Map json)
155 : _dependency = json["dependency"], 227 : _dependency = json["dependency"],
156 _kind = json["kind"] == null ? null : PrelinkedReferenceKind.values[json[" kind"]], 228 _kind = json["kind"] == null ? null : PrelinkedReferenceKind.values[json[" kind"]],
157 _unit = json["unit"], 229 _unit = json["unit"],
158 _numTypeParameters = json["numTypeParameters"]; 230 _numTypeParameters = json["numTypeParameters"];
159 231
160 @override 232 @override
161 Map<String, Object> toMap() => { 233 Map<String, Object> toMap() => {
162 "dependency": dependency, 234 "dependency": dependency,
163 "kind": kind, 235 "kind": kind,
164 "unit": unit, 236 "unit": unit,
165 "numTypeParameters": numTypeParameters, 237 "numTypeParameters": numTypeParameters,
166 }; 238 };
167 239
240 /**
241 * Index into [PrelinkedLibrary.dependencies] indicating which imported librar y
242 * declares the entity being referred to.
243 */
168 int get dependency => _dependency ?? 0; 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 */
169 PrelinkedReferenceKind get kind => _kind ?? PrelinkedReferenceKind.classOrEnum ; 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 */
170 int get unit => _unit ?? 0; 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 */
171 int get numTypeParameters => _numTypeParameters ?? 0; 264 int get numTypeParameters => _numTypeParameters ?? 0;
172 } 265 }
173 266
174 class PrelinkedReferenceBuilder { 267 class PrelinkedReferenceBuilder {
175 final Map _json = {}; 268 final Map _json = {};
176 269
177 bool _finished = false; 270 bool _finished = false;
178 271
179 PrelinkedReferenceBuilder(base.BuilderContext context); 272 PrelinkedReferenceBuilder(base.BuilderContext context);
180 273
274 /**
275 * Index into [PrelinkedLibrary.dependencies] indicating which imported librar y
276 * declares the entity being referred to.
277 */
181 void set dependency(int _value) { 278 void set dependency(int _value) {
182 assert(!_finished); 279 assert(!_finished);
183 assert(!_json.containsKey("dependency")); 280 assert(!_json.containsKey("dependency"));
184 if (_value != null) { 281 if (_value != null) {
185 _json["dependency"] = _value; 282 _json["dependency"] = _value;
186 } 283 }
187 } 284 }
188 285
286 /**
287 * The kind of the entity being referred to. For the pseudo-type `dynamic`,
288 * the kind is [PrelinkedReferenceKind.classOrEnum].
289 */
189 void set kind(PrelinkedReferenceKind _value) { 290 void set kind(PrelinkedReferenceKind _value) {
190 assert(!_finished); 291 assert(!_finished);
191 assert(!_json.containsKey("kind")); 292 assert(!_json.containsKey("kind"));
192 if (!(_value == null || _value == PrelinkedReferenceKind.classOrEnum)) { 293 if (!(_value == null || _value == PrelinkedReferenceKind.classOrEnum)) {
193 _json["kind"] = _value.index; 294 _json["kind"] = _value.index;
194 } 295 }
195 } 296 }
196 297
298 /**
299 * Integer index indicating which unit in the imported library contains the
300 * definition of the entity. As with indices into [PrelinkedLibrary.units],
301 * zero represents the defining compilation unit, and nonzero values
302 * represent parts in the order of the corresponding `part` declarations.
303 */
197 void set unit(int _value) { 304 void set unit(int _value) {
198 assert(!_finished); 305 assert(!_finished);
199 assert(!_json.containsKey("unit")); 306 assert(!_json.containsKey("unit"));
200 if (_value != null) { 307 if (_value != null) {
201 _json["unit"] = _value; 308 _json["unit"] = _value;
202 } 309 }
203 } 310 }
204 311
312 /**
313 * If the entity being referred to is generic, the number of type parameters
314 * it accepts. Otherwise zero.
315 */
205 void set numTypeParameters(int _value) { 316 void set numTypeParameters(int _value) {
206 assert(!_finished); 317 assert(!_finished);
207 assert(!_json.containsKey("numTypeParameters")); 318 assert(!_json.containsKey("numTypeParameters"));
208 if (_value != null) { 319 if (_value != null) {
209 _json["numTypeParameters"] = _value; 320 _json["numTypeParameters"] = _value;
210 } 321 }
211 } 322 }
212 323
213 Map finish() { 324 Map finish() {
214 assert(!_finished); 325 assert(!_finished);
215 _finished = true; 326 _finished = true;
216 return _json; 327 return _json;
217 } 328 }
218 } 329 }
219 330
220 PrelinkedReferenceBuilder encodePrelinkedReference(base.BuilderContext builderCo ntext, {int dependency, PrelinkedReferenceKind kind, int unit, int numTypeParame ters}) { 331 PrelinkedReferenceBuilder encodePrelinkedReference(base.BuilderContext builderCo ntext, {int dependency, PrelinkedReferenceKind kind, int unit, int numTypeParame ters}) {
221 PrelinkedReferenceBuilder builder = new PrelinkedReferenceBuilder(builderConte xt); 332 PrelinkedReferenceBuilder builder = new PrelinkedReferenceBuilder(builderConte xt);
222 builder.dependency = dependency; 333 builder.dependency = dependency;
223 builder.kind = kind; 334 builder.kind = kind;
224 builder.unit = unit; 335 builder.unit = unit;
225 builder.numTypeParameters = numTypeParameters; 336 builder.numTypeParameters = numTypeParameters;
226 return builder; 337 return builder;
227 } 338 }
228 339
340 /**
341 * Pre-linked summary of a compilation unit.
342 */
229 class PrelinkedUnit extends base.SummaryClass { 343 class PrelinkedUnit extends base.SummaryClass {
230 List<PrelinkedReference> _references; 344 List<PrelinkedReference> _references;
231 345
232 PrelinkedUnit.fromJson(Map json) 346 PrelinkedUnit.fromJson(Map json)
233 : _references = json["references"]?.map((x) => new PrelinkedReference.fromJs on(x))?.toList(); 347 : _references = json["references"]?.map((x) => new PrelinkedReference.fromJs on(x))?.toList();
234 348
235 @override 349 @override
236 Map<String, Object> toMap() => { 350 Map<String, Object> toMap() => {
237 "references": references, 351 "references": references,
238 }; 352 };
239 353
354 /**
355 * For each reference in [UnlinkedUnit.references], information about how
356 * that reference is resolved.
357 */
240 List<PrelinkedReference> get references => _references ?? const <PrelinkedRefe rence>[]; 358 List<PrelinkedReference> get references => _references ?? const <PrelinkedRefe rence>[];
241 } 359 }
242 360
243 class PrelinkedUnitBuilder { 361 class PrelinkedUnitBuilder {
244 final Map _json = {}; 362 final Map _json = {};
245 363
246 bool _finished = false; 364 bool _finished = false;
247 365
248 PrelinkedUnitBuilder(base.BuilderContext context); 366 PrelinkedUnitBuilder(base.BuilderContext context);
249 367
368 /**
369 * For each reference in [UnlinkedUnit.references], information about how
370 * that reference is resolved.
371 */
250 void set references(List<PrelinkedReferenceBuilder> _value) { 372 void set references(List<PrelinkedReferenceBuilder> _value) {
251 assert(!_finished); 373 assert(!_finished);
252 assert(!_json.containsKey("references")); 374 assert(!_json.containsKey("references"));
253 if (!(_value == null || _value.isEmpty)) { 375 if (!(_value == null || _value.isEmpty)) {
254 _json["references"] = _value.map((b) => b.finish()).toList(); 376 _json["references"] = _value.map((b) => b.finish()).toList();
255 } 377 }
256 } 378 }
257 379
258 Map finish() { 380 Map finish() {
259 assert(!_finished); 381 assert(!_finished);
260 _finished = true; 382 _finished = true;
261 return _json; 383 return _json;
262 } 384 }
263 } 385 }
264 386
265 PrelinkedUnitBuilder encodePrelinkedUnit(base.BuilderContext builderContext, {Li st<PrelinkedReferenceBuilder> references}) { 387 PrelinkedUnitBuilder encodePrelinkedUnit(base.BuilderContext builderContext, {Li st<PrelinkedReferenceBuilder> references}) {
266 PrelinkedUnitBuilder builder = new PrelinkedUnitBuilder(builderContext); 388 PrelinkedUnitBuilder builder = new PrelinkedUnitBuilder(builderContext);
267 builder.references = references; 389 builder.references = references;
268 return builder; 390 return builder;
269 } 391 }
270 392
393 /**
394 * Information about SDK.
395 */
271 class SdkBundle extends base.SummaryClass { 396 class SdkBundle extends base.SummaryClass {
272 List<String> _prelinkedLibraryUris; 397 List<String> _prelinkedLibraryUris;
273 List<PrelinkedLibrary> _prelinkedLibraries; 398 List<PrelinkedLibrary> _prelinkedLibraries;
274 List<String> _unlinkedUnitUris; 399 List<String> _unlinkedUnitUris;
275 List<UnlinkedUnit> _unlinkedUnits; 400 List<UnlinkedUnit> _unlinkedUnits;
276 401
277 SdkBundle.fromJson(Map json) 402 SdkBundle.fromJson(Map json)
278 : _prelinkedLibraryUris = json["prelinkedLibraryUris"], 403 : _prelinkedLibraryUris = json["prelinkedLibraryUris"],
279 _prelinkedLibraries = json["prelinkedLibraries"]?.map((x) => new Prelinked Library.fromJson(x))?.toList(), 404 _prelinkedLibraries = json["prelinkedLibraries"]?.map((x) => new Prelinked Library.fromJson(x))?.toList(),
280 _unlinkedUnitUris = json["unlinkedUnitUris"], 405 _unlinkedUnitUris = json["unlinkedUnitUris"],
281 _unlinkedUnits = json["unlinkedUnits"]?.map((x) => new UnlinkedUnit.fromJs on(x))?.toList(); 406 _unlinkedUnits = json["unlinkedUnits"]?.map((x) => new UnlinkedUnit.fromJs on(x))?.toList();
282 407
283 @override 408 @override
284 Map<String, Object> toMap() => { 409 Map<String, Object> toMap() => {
285 "prelinkedLibraryUris": prelinkedLibraryUris, 410 "prelinkedLibraryUris": prelinkedLibraryUris,
286 "prelinkedLibraries": prelinkedLibraries, 411 "prelinkedLibraries": prelinkedLibraries,
287 "unlinkedUnitUris": unlinkedUnitUris, 412 "unlinkedUnitUris": unlinkedUnitUris,
288 "unlinkedUnits": unlinkedUnits, 413 "unlinkedUnits": unlinkedUnits,
289 }; 414 };
290 415
291 SdkBundle.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8.decode (buffer))); 416 SdkBundle.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8.decode (buffer)));
292 417
418 /**
419 * The list of URIs of items in [prelinkedLibraries], e.g. `dart:core`.
420 */
293 List<String> get prelinkedLibraryUris => _prelinkedLibraryUris ?? const <Strin g>[]; 421 List<String> get prelinkedLibraryUris => _prelinkedLibraryUris ?? const <Strin g>[];
422
423 /**
424 * Pre-linked libraries.
425 */
294 List<PrelinkedLibrary> get prelinkedLibraries => _prelinkedLibraries ?? const <PrelinkedLibrary>[]; 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 */
295 List<String> get unlinkedUnitUris => _unlinkedUnitUris ?? const <String>[]; 431 List<String> get unlinkedUnitUris => _unlinkedUnitUris ?? const <String>[];
432
433 /**
434 * Unlinked information for the compilation units constituting the SDK.
435 */
296 List<UnlinkedUnit> get unlinkedUnits => _unlinkedUnits ?? const <UnlinkedUnit> []; 436 List<UnlinkedUnit> get unlinkedUnits => _unlinkedUnits ?? const <UnlinkedUnit> [];
297 } 437 }
298 438
299 class SdkBundleBuilder { 439 class SdkBundleBuilder {
300 final Map _json = {}; 440 final Map _json = {};
301 441
302 bool _finished = false; 442 bool _finished = false;
303 443
304 SdkBundleBuilder(base.BuilderContext context); 444 SdkBundleBuilder(base.BuilderContext context);
305 445
446 /**
447 * The list of URIs of items in [prelinkedLibraries], e.g. `dart:core`.
448 */
306 void set prelinkedLibraryUris(List<String> _value) { 449 void set prelinkedLibraryUris(List<String> _value) {
307 assert(!_finished); 450 assert(!_finished);
308 assert(!_json.containsKey("prelinkedLibraryUris")); 451 assert(!_json.containsKey("prelinkedLibraryUris"));
309 if (!(_value == null || _value.isEmpty)) { 452 if (!(_value == null || _value.isEmpty)) {
310 _json["prelinkedLibraryUris"] = _value.toList(); 453 _json["prelinkedLibraryUris"] = _value.toList();
311 } 454 }
312 } 455 }
313 456
457 /**
458 * Pre-linked libraries.
459 */
314 void set prelinkedLibraries(List<PrelinkedLibraryBuilder> _value) { 460 void set prelinkedLibraries(List<PrelinkedLibraryBuilder> _value) {
315 assert(!_finished); 461 assert(!_finished);
316 assert(!_json.containsKey("prelinkedLibraries")); 462 assert(!_json.containsKey("prelinkedLibraries"));
317 if (!(_value == null || _value.isEmpty)) { 463 if (!(_value == null || _value.isEmpty)) {
318 _json["prelinkedLibraries"] = _value.map((b) => b.finish()).toList(); 464 _json["prelinkedLibraries"] = _value.map((b) => b.finish()).toList();
319 } 465 }
320 } 466 }
321 467
468 /**
469 * The list of URIs of items in [unlinkedUnits], e.g. `dart:core/bool.dart`.
470 */
322 void set unlinkedUnitUris(List<String> _value) { 471 void set unlinkedUnitUris(List<String> _value) {
323 assert(!_finished); 472 assert(!_finished);
324 assert(!_json.containsKey("unlinkedUnitUris")); 473 assert(!_json.containsKey("unlinkedUnitUris"));
325 if (!(_value == null || _value.isEmpty)) { 474 if (!(_value == null || _value.isEmpty)) {
326 _json["unlinkedUnitUris"] = _value.toList(); 475 _json["unlinkedUnitUris"] = _value.toList();
327 } 476 }
328 } 477 }
329 478
479 /**
480 * Unlinked information for the compilation units constituting the SDK.
481 */
330 void set unlinkedUnits(List<UnlinkedUnitBuilder> _value) { 482 void set unlinkedUnits(List<UnlinkedUnitBuilder> _value) {
331 assert(!_finished); 483 assert(!_finished);
332 assert(!_json.containsKey("unlinkedUnits")); 484 assert(!_json.containsKey("unlinkedUnits"));
333 if (!(_value == null || _value.isEmpty)) { 485 if (!(_value == null || _value.isEmpty)) {
334 _json["unlinkedUnits"] = _value.map((b) => b.finish()).toList(); 486 _json["unlinkedUnits"] = _value.map((b) => b.finish()).toList();
335 } 487 }
336 } 488 }
337 489
338 List<int> toBuffer() => UTF8.encode(JSON.encode(finish())); 490 List<int> toBuffer() => UTF8.encode(JSON.encode(finish()));
339 491
340 Map finish() { 492 Map finish() {
341 assert(!_finished); 493 assert(!_finished);
342 _finished = true; 494 _finished = true;
343 return _json; 495 return _json;
344 } 496 }
345 } 497 }
346 498
347 SdkBundleBuilder encodeSdkBundle(base.BuilderContext builderContext, {List<Strin g> prelinkedLibraryUris, List<PrelinkedLibraryBuilder> prelinkedLibraries, List< String> unlinkedUnitUris, List<UnlinkedUnitBuilder> unlinkedUnits}) { 499 SdkBundleBuilder encodeSdkBundle(base.BuilderContext builderContext, {List<Strin g> prelinkedLibraryUris, List<PrelinkedLibraryBuilder> prelinkedLibraries, List< String> unlinkedUnitUris, List<UnlinkedUnitBuilder> unlinkedUnits}) {
348 SdkBundleBuilder builder = new SdkBundleBuilder(builderContext); 500 SdkBundleBuilder builder = new SdkBundleBuilder(builderContext);
349 builder.prelinkedLibraryUris = prelinkedLibraryUris; 501 builder.prelinkedLibraryUris = prelinkedLibraryUris;
350 builder.prelinkedLibraries = prelinkedLibraries; 502 builder.prelinkedLibraries = prelinkedLibraries;
351 builder.unlinkedUnitUris = unlinkedUnitUris; 503 builder.unlinkedUnitUris = unlinkedUnitUris;
352 builder.unlinkedUnits = unlinkedUnits; 504 builder.unlinkedUnits = unlinkedUnits;
353 return builder; 505 return builder;
354 } 506 }
355 507
508 /**
509 * Unlinked summary information about a class declaration.
510 */
356 class UnlinkedClass extends base.SummaryClass { 511 class UnlinkedClass extends base.SummaryClass {
357 String _name; 512 String _name;
358 List<UnlinkedTypeParam> _typeParameters; 513 List<UnlinkedTypeParam> _typeParameters;
359 UnlinkedTypeRef _supertype; 514 UnlinkedTypeRef _supertype;
360 List<UnlinkedTypeRef> _mixins; 515 List<UnlinkedTypeRef> _mixins;
361 List<UnlinkedTypeRef> _interfaces; 516 List<UnlinkedTypeRef> _interfaces;
362 List<UnlinkedVariable> _fields; 517 List<UnlinkedVariable> _fields;
363 List<UnlinkedExecutable> _executables; 518 List<UnlinkedExecutable> _executables;
364 bool _isAbstract; 519 bool _isAbstract;
365 bool _isMixinApplication; 520 bool _isMixinApplication;
(...skipping 18 matching lines...) Expand all
384 "supertype": supertype, 539 "supertype": supertype,
385 "mixins": mixins, 540 "mixins": mixins,
386 "interfaces": interfaces, 541 "interfaces": interfaces,
387 "fields": fields, 542 "fields": fields,
388 "executables": executables, 543 "executables": executables,
389 "isAbstract": isAbstract, 544 "isAbstract": isAbstract,
390 "isMixinApplication": isMixinApplication, 545 "isMixinApplication": isMixinApplication,
391 "hasNoSupertype": hasNoSupertype, 546 "hasNoSupertype": hasNoSupertype,
392 }; 547 };
393 548
549 /**
550 * Name of the class.
551 */
394 String get name => _name ?? ''; 552 String get name => _name ?? '';
553
554 /**
555 * Type parameters of the class, if any.
556 */
395 List<UnlinkedTypeParam> get typeParameters => _typeParameters ?? const <Unlink edTypeParam>[]; 557 List<UnlinkedTypeParam> get typeParameters => _typeParameters ?? const <Unlink edTypeParam>[];
558
559 /**
560 * Supertype of the class, or `null` if either (a) the class doesn't
561 * explicitly declare a supertype (and hence has supertype `Object`), or (b)
562 * the class *is* `Object` (and hence has no supertype).
563 */
396 UnlinkedTypeRef get supertype => _supertype; 564 UnlinkedTypeRef get supertype => _supertype;
565
566 /**
567 * Mixins appearing in a `with` clause, if any.
568 */
397 List<UnlinkedTypeRef> get mixins => _mixins ?? const <UnlinkedTypeRef>[]; 569 List<UnlinkedTypeRef> get mixins => _mixins ?? const <UnlinkedTypeRef>[];
570
571 /**
572 * Interfaces appearing in an `implements` clause, if any.
573 */
398 List<UnlinkedTypeRef> get interfaces => _interfaces ?? const <UnlinkedTypeRef> []; 574 List<UnlinkedTypeRef> get interfaces => _interfaces ?? const <UnlinkedTypeRef> [];
575
576 /**
577 * Field declarations contained in the class.
578 */
399 List<UnlinkedVariable> get fields => _fields ?? const <UnlinkedVariable>[]; 579 List<UnlinkedVariable> get fields => _fields ?? const <UnlinkedVariable>[];
580
581 /**
582 * Executable objects (methods, getters, and setters) contained in the class.
583 */
400 List<UnlinkedExecutable> get executables => _executables ?? const <UnlinkedExe cutable>[]; 584 List<UnlinkedExecutable> get executables => _executables ?? const <UnlinkedExe cutable>[];
585
586 /**
587 * Indicates whether the class is declared with the `abstract` keyword.
588 */
401 bool get isAbstract => _isAbstract ?? false; 589 bool get isAbstract => _isAbstract ?? false;
590
591 /**
592 * Indicates whether the class is declared using mixin application syntax.
593 */
402 bool get isMixinApplication => _isMixinApplication ?? false; 594 bool get isMixinApplication => _isMixinApplication ?? false;
595
596 /**
597 * Indicates whether this class is the core "Object" class (and hence has no
598 * supertype)
599 */
403 bool get hasNoSupertype => _hasNoSupertype ?? false; 600 bool get hasNoSupertype => _hasNoSupertype ?? false;
404 } 601 }
405 602
406 class UnlinkedClassBuilder { 603 class UnlinkedClassBuilder {
407 final Map _json = {}; 604 final Map _json = {};
408 605
409 bool _finished = false; 606 bool _finished = false;
410 607
411 UnlinkedClassBuilder(base.BuilderContext context); 608 UnlinkedClassBuilder(base.BuilderContext context);
412 609
610 /**
611 * Name of the class.
612 */
413 void set name(String _value) { 613 void set name(String _value) {
414 assert(!_finished); 614 assert(!_finished);
415 assert(!_json.containsKey("name")); 615 assert(!_json.containsKey("name"));
416 if (_value != null) { 616 if (_value != null) {
417 _json["name"] = _value; 617 _json["name"] = _value;
418 } 618 }
419 } 619 }
420 620
621 /**
622 * Type parameters of the class, if any.
623 */
421 void set typeParameters(List<UnlinkedTypeParamBuilder> _value) { 624 void set typeParameters(List<UnlinkedTypeParamBuilder> _value) {
422 assert(!_finished); 625 assert(!_finished);
423 assert(!_json.containsKey("typeParameters")); 626 assert(!_json.containsKey("typeParameters"));
424 if (!(_value == null || _value.isEmpty)) { 627 if (!(_value == null || _value.isEmpty)) {
425 _json["typeParameters"] = _value.map((b) => b.finish()).toList(); 628 _json["typeParameters"] = _value.map((b) => b.finish()).toList();
426 } 629 }
427 } 630 }
428 631
632 /**
633 * Supertype of the class, or `null` if either (a) the class doesn't
634 * explicitly declare a supertype (and hence has supertype `Object`), or (b)
635 * the class *is* `Object` (and hence has no supertype).
636 */
429 void set supertype(UnlinkedTypeRefBuilder _value) { 637 void set supertype(UnlinkedTypeRefBuilder _value) {
430 assert(!_finished); 638 assert(!_finished);
431 assert(!_json.containsKey("supertype")); 639 assert(!_json.containsKey("supertype"));
432 if (_value != null) { 640 if (_value != null) {
433 _json["supertype"] = _value.finish(); 641 _json["supertype"] = _value.finish();
434 } 642 }
435 } 643 }
436 644
645 /**
646 * Mixins appearing in a `with` clause, if any.
647 */
437 void set mixins(List<UnlinkedTypeRefBuilder> _value) { 648 void set mixins(List<UnlinkedTypeRefBuilder> _value) {
438 assert(!_finished); 649 assert(!_finished);
439 assert(!_json.containsKey("mixins")); 650 assert(!_json.containsKey("mixins"));
440 if (!(_value == null || _value.isEmpty)) { 651 if (!(_value == null || _value.isEmpty)) {
441 _json["mixins"] = _value.map((b) => b.finish()).toList(); 652 _json["mixins"] = _value.map((b) => b.finish()).toList();
442 } 653 }
443 } 654 }
444 655
656 /**
657 * Interfaces appearing in an `implements` clause, if any.
658 */
445 void set interfaces(List<UnlinkedTypeRefBuilder> _value) { 659 void set interfaces(List<UnlinkedTypeRefBuilder> _value) {
446 assert(!_finished); 660 assert(!_finished);
447 assert(!_json.containsKey("interfaces")); 661 assert(!_json.containsKey("interfaces"));
448 if (!(_value == null || _value.isEmpty)) { 662 if (!(_value == null || _value.isEmpty)) {
449 _json["interfaces"] = _value.map((b) => b.finish()).toList(); 663 _json["interfaces"] = _value.map((b) => b.finish()).toList();
450 } 664 }
451 } 665 }
452 666
667 /**
668 * Field declarations contained in the class.
669 */
453 void set fields(List<UnlinkedVariableBuilder> _value) { 670 void set fields(List<UnlinkedVariableBuilder> _value) {
454 assert(!_finished); 671 assert(!_finished);
455 assert(!_json.containsKey("fields")); 672 assert(!_json.containsKey("fields"));
456 if (!(_value == null || _value.isEmpty)) { 673 if (!(_value == null || _value.isEmpty)) {
457 _json["fields"] = _value.map((b) => b.finish()).toList(); 674 _json["fields"] = _value.map((b) => b.finish()).toList();
458 } 675 }
459 } 676 }
460 677
678 /**
679 * Executable objects (methods, getters, and setters) contained in the class.
680 */
461 void set executables(List<UnlinkedExecutableBuilder> _value) { 681 void set executables(List<UnlinkedExecutableBuilder> _value) {
462 assert(!_finished); 682 assert(!_finished);
463 assert(!_json.containsKey("executables")); 683 assert(!_json.containsKey("executables"));
464 if (!(_value == null || _value.isEmpty)) { 684 if (!(_value == null || _value.isEmpty)) {
465 _json["executables"] = _value.map((b) => b.finish()).toList(); 685 _json["executables"] = _value.map((b) => b.finish()).toList();
466 } 686 }
467 } 687 }
468 688
689 /**
690 * Indicates whether the class is declared with the `abstract` keyword.
691 */
469 void set isAbstract(bool _value) { 692 void set isAbstract(bool _value) {
470 assert(!_finished); 693 assert(!_finished);
471 assert(!_json.containsKey("isAbstract")); 694 assert(!_json.containsKey("isAbstract"));
472 if (_value != null) { 695 if (_value != null) {
473 _json["isAbstract"] = _value; 696 _json["isAbstract"] = _value;
474 } 697 }
475 } 698 }
476 699
700 /**
701 * Indicates whether the class is declared using mixin application syntax.
702 */
477 void set isMixinApplication(bool _value) { 703 void set isMixinApplication(bool _value) {
478 assert(!_finished); 704 assert(!_finished);
479 assert(!_json.containsKey("isMixinApplication")); 705 assert(!_json.containsKey("isMixinApplication"));
480 if (_value != null) { 706 if (_value != null) {
481 _json["isMixinApplication"] = _value; 707 _json["isMixinApplication"] = _value;
482 } 708 }
483 } 709 }
484 710
711 /**
712 * Indicates whether this class is the core "Object" class (and hence has no
713 * supertype)
714 */
485 void set hasNoSupertype(bool _value) { 715 void set hasNoSupertype(bool _value) {
486 assert(!_finished); 716 assert(!_finished);
487 assert(!_json.containsKey("hasNoSupertype")); 717 assert(!_json.containsKey("hasNoSupertype"));
488 if (_value != null) { 718 if (_value != null) {
489 _json["hasNoSupertype"] = _value; 719 _json["hasNoSupertype"] = _value;
490 } 720 }
491 } 721 }
492 722
493 Map finish() { 723 Map finish() {
494 assert(!_finished); 724 assert(!_finished);
(...skipping 10 matching lines...) Expand all
505 builder.mixins = mixins; 735 builder.mixins = mixins;
506 builder.interfaces = interfaces; 736 builder.interfaces = interfaces;
507 builder.fields = fields; 737 builder.fields = fields;
508 builder.executables = executables; 738 builder.executables = executables;
509 builder.isAbstract = isAbstract; 739 builder.isAbstract = isAbstract;
510 builder.isMixinApplication = isMixinApplication; 740 builder.isMixinApplication = isMixinApplication;
511 builder.hasNoSupertype = hasNoSupertype; 741 builder.hasNoSupertype = hasNoSupertype;
512 return builder; 742 return builder;
513 } 743 }
514 744
745 /**
746 * Unlinked summary information about a `show` or `hide` combinator in an
747 * import or export declaration.
748 */
515 class UnlinkedCombinator extends base.SummaryClass { 749 class UnlinkedCombinator extends base.SummaryClass {
516 List<String> _shows; 750 List<String> _shows;
517 List<String> _hides; 751 List<String> _hides;
518 752
519 UnlinkedCombinator.fromJson(Map json) 753 UnlinkedCombinator.fromJson(Map json)
520 : _shows = json["shows"], 754 : _shows = json["shows"],
521 _hides = json["hides"]; 755 _hides = json["hides"];
522 756
523 @override 757 @override
524 Map<String, Object> toMap() => { 758 Map<String, Object> toMap() => {
525 "shows": shows, 759 "shows": shows,
526 "hides": hides, 760 "hides": hides,
527 }; 761 };
528 762
763 /**
764 * List of names which are shown. Empty if this is a `hide` combinator.
765 */
529 List<String> get shows => _shows ?? const <String>[]; 766 List<String> get shows => _shows ?? const <String>[];
767
768 /**
769 * List of names which are hidden. Empty if this is a `show` combinator.
770 */
530 List<String> get hides => _hides ?? const <String>[]; 771 List<String> get hides => _hides ?? const <String>[];
531 } 772 }
532 773
533 class UnlinkedCombinatorBuilder { 774 class UnlinkedCombinatorBuilder {
534 final Map _json = {}; 775 final Map _json = {};
535 776
536 bool _finished = false; 777 bool _finished = false;
537 778
538 UnlinkedCombinatorBuilder(base.BuilderContext context); 779 UnlinkedCombinatorBuilder(base.BuilderContext context);
539 780
781 /**
782 * List of names which are shown. Empty if this is a `hide` combinator.
783 */
540 void set shows(List<String> _value) { 784 void set shows(List<String> _value) {
541 assert(!_finished); 785 assert(!_finished);
542 assert(!_json.containsKey("shows")); 786 assert(!_json.containsKey("shows"));
543 if (!(_value == null || _value.isEmpty)) { 787 if (!(_value == null || _value.isEmpty)) {
544 _json["shows"] = _value.toList(); 788 _json["shows"] = _value.toList();
545 } 789 }
546 } 790 }
547 791
792 /**
793 * List of names which are hidden. Empty if this is a `show` combinator.
794 */
548 void set hides(List<String> _value) { 795 void set hides(List<String> _value) {
549 assert(!_finished); 796 assert(!_finished);
550 assert(!_json.containsKey("hides")); 797 assert(!_json.containsKey("hides"));
551 if (!(_value == null || _value.isEmpty)) { 798 if (!(_value == null || _value.isEmpty)) {
552 _json["hides"] = _value.toList(); 799 _json["hides"] = _value.toList();
553 } 800 }
554 } 801 }
555 802
556 Map finish() { 803 Map finish() {
557 assert(!_finished); 804 assert(!_finished);
558 _finished = true; 805 _finished = true;
559 return _json; 806 return _json;
560 } 807 }
561 } 808 }
562 809
563 UnlinkedCombinatorBuilder encodeUnlinkedCombinator(base.BuilderContext builderCo ntext, {List<String> shows, List<String> hides}) { 810 UnlinkedCombinatorBuilder encodeUnlinkedCombinator(base.BuilderContext builderCo ntext, {List<String> shows, List<String> hides}) {
564 UnlinkedCombinatorBuilder builder = new UnlinkedCombinatorBuilder(builderConte xt); 811 UnlinkedCombinatorBuilder builder = new UnlinkedCombinatorBuilder(builderConte xt);
565 builder.shows = shows; 812 builder.shows = shows;
566 builder.hides = hides; 813 builder.hides = hides;
567 return builder; 814 return builder;
568 } 815 }
569 816
817 /**
818 * Unlinked summary information about an enum declaration.
819 */
570 class UnlinkedEnum extends base.SummaryClass { 820 class UnlinkedEnum extends base.SummaryClass {
571 String _name; 821 String _name;
572 List<UnlinkedEnumValue> _values; 822 List<UnlinkedEnumValue> _values;
573 823
574 UnlinkedEnum.fromJson(Map json) 824 UnlinkedEnum.fromJson(Map json)
575 : _name = json["name"], 825 : _name = json["name"],
576 _values = json["values"]?.map((x) => new UnlinkedEnumValue.fromJson(x))?.t oList(); 826 _values = json["values"]?.map((x) => new UnlinkedEnumValue.fromJson(x))?.t oList();
577 827
578 @override 828 @override
579 Map<String, Object> toMap() => { 829 Map<String, Object> toMap() => {
580 "name": name, 830 "name": name,
581 "values": values, 831 "values": values,
582 }; 832 };
583 833
834 /**
835 * Name of the enum type.
836 */
584 String get name => _name ?? ''; 837 String get name => _name ?? '';
838
839 /**
840 * Values listed in the enum declaration, in declaration order.
841 */
585 List<UnlinkedEnumValue> get values => _values ?? const <UnlinkedEnumValue>[]; 842 List<UnlinkedEnumValue> get values => _values ?? const <UnlinkedEnumValue>[];
586 } 843 }
587 844
588 class UnlinkedEnumBuilder { 845 class UnlinkedEnumBuilder {
589 final Map _json = {}; 846 final Map _json = {};
590 847
591 bool _finished = false; 848 bool _finished = false;
592 849
593 UnlinkedEnumBuilder(base.BuilderContext context); 850 UnlinkedEnumBuilder(base.BuilderContext context);
594 851
852 /**
853 * Name of the enum type.
854 */
595 void set name(String _value) { 855 void set name(String _value) {
596 assert(!_finished); 856 assert(!_finished);
597 assert(!_json.containsKey("name")); 857 assert(!_json.containsKey("name"));
598 if (_value != null) { 858 if (_value != null) {
599 _json["name"] = _value; 859 _json["name"] = _value;
600 } 860 }
601 } 861 }
602 862
863 /**
864 * Values listed in the enum declaration, in declaration order.
865 */
603 void set values(List<UnlinkedEnumValueBuilder> _value) { 866 void set values(List<UnlinkedEnumValueBuilder> _value) {
604 assert(!_finished); 867 assert(!_finished);
605 assert(!_json.containsKey("values")); 868 assert(!_json.containsKey("values"));
606 if (!(_value == null || _value.isEmpty)) { 869 if (!(_value == null || _value.isEmpty)) {
607 _json["values"] = _value.map((b) => b.finish()).toList(); 870 _json["values"] = _value.map((b) => b.finish()).toList();
608 } 871 }
609 } 872 }
610 873
611 Map finish() { 874 Map finish() {
612 assert(!_finished); 875 assert(!_finished);
613 _finished = true; 876 _finished = true;
614 return _json; 877 return _json;
615 } 878 }
616 } 879 }
617 880
618 UnlinkedEnumBuilder encodeUnlinkedEnum(base.BuilderContext builderContext, {Stri ng name, List<UnlinkedEnumValueBuilder> values}) { 881 UnlinkedEnumBuilder encodeUnlinkedEnum(base.BuilderContext builderContext, {Stri ng name, List<UnlinkedEnumValueBuilder> values}) {
619 UnlinkedEnumBuilder builder = new UnlinkedEnumBuilder(builderContext); 882 UnlinkedEnumBuilder builder = new UnlinkedEnumBuilder(builderContext);
620 builder.name = name; 883 builder.name = name;
621 builder.values = values; 884 builder.values = values;
622 return builder; 885 return builder;
623 } 886 }
624 887
888 /**
889 * Unlinked summary information about a single enumerated value in an enum
890 * declaration.
891 */
625 class UnlinkedEnumValue extends base.SummaryClass { 892 class UnlinkedEnumValue extends base.SummaryClass {
626 String _name; 893 String _name;
627 894
628 UnlinkedEnumValue.fromJson(Map json) 895 UnlinkedEnumValue.fromJson(Map json)
629 : _name = json["name"]; 896 : _name = json["name"];
630 897
631 @override 898 @override
632 Map<String, Object> toMap() => { 899 Map<String, Object> toMap() => {
633 "name": name, 900 "name": name,
634 }; 901 };
635 902
903 /**
904 * Name of the enumerated value.
905 */
636 String get name => _name ?? ''; 906 String get name => _name ?? '';
637 } 907 }
638 908
639 class UnlinkedEnumValueBuilder { 909 class UnlinkedEnumValueBuilder {
640 final Map _json = {}; 910 final Map _json = {};
641 911
642 bool _finished = false; 912 bool _finished = false;
643 913
644 UnlinkedEnumValueBuilder(base.BuilderContext context); 914 UnlinkedEnumValueBuilder(base.BuilderContext context);
645 915
916 /**
917 * Name of the enumerated value.
918 */
646 void set name(String _value) { 919 void set name(String _value) {
647 assert(!_finished); 920 assert(!_finished);
648 assert(!_json.containsKey("name")); 921 assert(!_json.containsKey("name"));
649 if (_value != null) { 922 if (_value != null) {
650 _json["name"] = _value; 923 _json["name"] = _value;
651 } 924 }
652 } 925 }
653 926
654 Map finish() { 927 Map finish() {
655 assert(!_finished); 928 assert(!_finished);
656 _finished = true; 929 _finished = true;
657 return _json; 930 return _json;
658 } 931 }
659 } 932 }
660 933
661 UnlinkedEnumValueBuilder encodeUnlinkedEnumValue(base.BuilderContext builderCont ext, {String name}) { 934 UnlinkedEnumValueBuilder encodeUnlinkedEnumValue(base.BuilderContext builderCont ext, {String name}) {
662 UnlinkedEnumValueBuilder builder = new UnlinkedEnumValueBuilder(builderContext ); 935 UnlinkedEnumValueBuilder builder = new UnlinkedEnumValueBuilder(builderContext );
663 builder.name = name; 936 builder.name = name;
664 return builder; 937 return builder;
665 } 938 }
666 939
940 /**
941 * Unlinked summary information about a function, method, getter, or setter
942 * declaration.
943 */
667 class UnlinkedExecutable extends base.SummaryClass { 944 class UnlinkedExecutable extends base.SummaryClass {
668 String _name; 945 String _name;
669 List<UnlinkedTypeParam> _typeParameters; 946 List<UnlinkedTypeParam> _typeParameters;
670 UnlinkedTypeRef _returnType; 947 UnlinkedTypeRef _returnType;
671 List<UnlinkedParam> _parameters; 948 List<UnlinkedParam> _parameters;
672 UnlinkedExecutableKind _kind; 949 UnlinkedExecutableKind _kind;
673 bool _isAbstract; 950 bool _isAbstract;
674 bool _isStatic; 951 bool _isStatic;
675 bool _isConst; 952 bool _isConst;
676 bool _isFactory; 953 bool _isFactory;
(...skipping 21 matching lines...) Expand all
698 "parameters": parameters, 975 "parameters": parameters,
699 "kind": kind, 976 "kind": kind,
700 "isAbstract": isAbstract, 977 "isAbstract": isAbstract,
701 "isStatic": isStatic, 978 "isStatic": isStatic,
702 "isConst": isConst, 979 "isConst": isConst,
703 "isFactory": isFactory, 980 "isFactory": isFactory,
704 "hasImplicitReturnType": hasImplicitReturnType, 981 "hasImplicitReturnType": hasImplicitReturnType,
705 "isExternal": isExternal, 982 "isExternal": isExternal,
706 }; 983 };
707 984
985 /**
986 * Name of the executable. For setters, this includes the trailing "=". For
987 * named constructors, this excludes the class name and excludes the ".".
988 * For unnamed constructors, this is the empty string.
989 */
708 String get name => _name ?? ''; 990 String get name => _name ?? '';
991
992 /**
993 * Type parameters of the executable, if any. Empty if support for generic
994 * method syntax is disabled.
995 */
709 List<UnlinkedTypeParam> get typeParameters => _typeParameters ?? const <Unlink edTypeParam>[]; 996 List<UnlinkedTypeParam> get typeParameters => _typeParameters ?? const <Unlink edTypeParam>[];
997
998 /**
999 * Declared return type of the executable. Absent if the return type is
1000 * `void`. Note that when strong mode is enabled, the actual return type may
1001 * be different due to type inference.
1002 */
710 UnlinkedTypeRef get returnType => _returnType; 1003 UnlinkedTypeRef get returnType => _returnType;
1004
1005 /**
1006 * Parameters of the executable, if any. Note that getters have no
1007 * parameters (hence this will be the empty list), and setters have a single
1008 * parameter.
1009 */
711 List<UnlinkedParam> get parameters => _parameters ?? const <UnlinkedParam>[]; 1010 List<UnlinkedParam> get parameters => _parameters ?? const <UnlinkedParam>[];
1011
1012 /**
1013 * The kind of the executable (function/method, getter, setter, or
1014 * constructor).
1015 */
712 UnlinkedExecutableKind get kind => _kind ?? UnlinkedExecutableKind.functionOrM ethod; 1016 UnlinkedExecutableKind get kind => _kind ?? UnlinkedExecutableKind.functionOrM ethod;
1017
1018 /**
1019 * Indicates whether the executable is declared using the `abstract` keyword.
1020 */
713 bool get isAbstract => _isAbstract ?? false; 1021 bool get isAbstract => _isAbstract ?? false;
1022
1023 /**
1024 * Indicates whether the executable is declared using the `static` keyword.
1025 *
1026 * Note that for top level executables, this flag is false, since they are
1027 * not declared using the `static` keyword (even though they are considered
1028 * static for semantic purposes).
1029 */
714 bool get isStatic => _isStatic ?? false; 1030 bool get isStatic => _isStatic ?? false;
1031
1032 /**
1033 * Indicates whether the executable is declared using the `const` keyword.
1034 */
715 bool get isConst => _isConst ?? false; 1035 bool get isConst => _isConst ?? false;
1036
1037 /**
1038 * Indicates whether the executable is declared using the `factory` keyword.
1039 */
716 bool get isFactory => _isFactory ?? false; 1040 bool get isFactory => _isFactory ?? false;
1041
1042 /**
1043 * Indicates whether the executable lacks an explicit return type
1044 * declaration. False for constructors and setters.
1045 */
717 bool get hasImplicitReturnType => _hasImplicitReturnType ?? false; 1046 bool get hasImplicitReturnType => _hasImplicitReturnType ?? false;
1047
1048 /**
1049 * Indicates whether the executable is declared using the `external` keyword.
1050 */
718 bool get isExternal => _isExternal ?? false; 1051 bool get isExternal => _isExternal ?? false;
719 } 1052 }
720 1053
721 class UnlinkedExecutableBuilder { 1054 class UnlinkedExecutableBuilder {
722 final Map _json = {}; 1055 final Map _json = {};
723 1056
724 bool _finished = false; 1057 bool _finished = false;
725 1058
726 UnlinkedExecutableBuilder(base.BuilderContext context); 1059 UnlinkedExecutableBuilder(base.BuilderContext context);
727 1060
1061 /**
1062 * Name of the executable. For setters, this includes the trailing "=". For
1063 * named constructors, this excludes the class name and excludes the ".".
1064 * For unnamed constructors, this is the empty string.
1065 */
728 void set name(String _value) { 1066 void set name(String _value) {
729 assert(!_finished); 1067 assert(!_finished);
730 assert(!_json.containsKey("name")); 1068 assert(!_json.containsKey("name"));
731 if (_value != null) { 1069 if (_value != null) {
732 _json["name"] = _value; 1070 _json["name"] = _value;
733 } 1071 }
734 } 1072 }
735 1073
1074 /**
1075 * Type parameters of the executable, if any. Empty if support for generic
1076 * method syntax is disabled.
1077 */
736 void set typeParameters(List<UnlinkedTypeParamBuilder> _value) { 1078 void set typeParameters(List<UnlinkedTypeParamBuilder> _value) {
737 assert(!_finished); 1079 assert(!_finished);
738 assert(!_json.containsKey("typeParameters")); 1080 assert(!_json.containsKey("typeParameters"));
739 if (!(_value == null || _value.isEmpty)) { 1081 if (!(_value == null || _value.isEmpty)) {
740 _json["typeParameters"] = _value.map((b) => b.finish()).toList(); 1082 _json["typeParameters"] = _value.map((b) => b.finish()).toList();
741 } 1083 }
742 } 1084 }
743 1085
1086 /**
1087 * Declared return type of the executable. Absent if the return type is
1088 * `void`. Note that when strong mode is enabled, the actual return type may
1089 * be different due to type inference.
1090 */
744 void set returnType(UnlinkedTypeRefBuilder _value) { 1091 void set returnType(UnlinkedTypeRefBuilder _value) {
745 assert(!_finished); 1092 assert(!_finished);
746 assert(!_json.containsKey("returnType")); 1093 assert(!_json.containsKey("returnType"));
747 if (_value != null) { 1094 if (_value != null) {
748 _json["returnType"] = _value.finish(); 1095 _json["returnType"] = _value.finish();
749 } 1096 }
750 } 1097 }
751 1098
1099 /**
1100 * Parameters of the executable, if any. Note that getters have no
1101 * parameters (hence this will be the empty list), and setters have a single
1102 * parameter.
1103 */
752 void set parameters(List<UnlinkedParamBuilder> _value) { 1104 void set parameters(List<UnlinkedParamBuilder> _value) {
753 assert(!_finished); 1105 assert(!_finished);
754 assert(!_json.containsKey("parameters")); 1106 assert(!_json.containsKey("parameters"));
755 if (!(_value == null || _value.isEmpty)) { 1107 if (!(_value == null || _value.isEmpty)) {
756 _json["parameters"] = _value.map((b) => b.finish()).toList(); 1108 _json["parameters"] = _value.map((b) => b.finish()).toList();
757 } 1109 }
758 } 1110 }
759 1111
1112 /**
1113 * The kind of the executable (function/method, getter, setter, or
1114 * constructor).
1115 */
760 void set kind(UnlinkedExecutableKind _value) { 1116 void set kind(UnlinkedExecutableKind _value) {
761 assert(!_finished); 1117 assert(!_finished);
762 assert(!_json.containsKey("kind")); 1118 assert(!_json.containsKey("kind"));
763 if (!(_value == null || _value == UnlinkedExecutableKind.functionOrMethod)) { 1119 if (!(_value == null || _value == UnlinkedExecutableKind.functionOrMethod)) {
764 _json["kind"] = _value.index; 1120 _json["kind"] = _value.index;
765 } 1121 }
766 } 1122 }
767 1123
1124 /**
1125 * Indicates whether the executable is declared using the `abstract` keyword.
1126 */
768 void set isAbstract(bool _value) { 1127 void set isAbstract(bool _value) {
769 assert(!_finished); 1128 assert(!_finished);
770 assert(!_json.containsKey("isAbstract")); 1129 assert(!_json.containsKey("isAbstract"));
771 if (_value != null) { 1130 if (_value != null) {
772 _json["isAbstract"] = _value; 1131 _json["isAbstract"] = _value;
773 } 1132 }
774 } 1133 }
775 1134
1135 /**
1136 * Indicates whether the executable is declared using the `static` keyword.
1137 *
1138 * Note that for top level executables, this flag is false, since they are
1139 * not declared using the `static` keyword (even though they are considered
1140 * static for semantic purposes).
1141 */
776 void set isStatic(bool _value) { 1142 void set isStatic(bool _value) {
777 assert(!_finished); 1143 assert(!_finished);
778 assert(!_json.containsKey("isStatic")); 1144 assert(!_json.containsKey("isStatic"));
779 if (_value != null) { 1145 if (_value != null) {
780 _json["isStatic"] = _value; 1146 _json["isStatic"] = _value;
781 } 1147 }
782 } 1148 }
783 1149
1150 /**
1151 * Indicates whether the executable is declared using the `const` keyword.
1152 */
784 void set isConst(bool _value) { 1153 void set isConst(bool _value) {
785 assert(!_finished); 1154 assert(!_finished);
786 assert(!_json.containsKey("isConst")); 1155 assert(!_json.containsKey("isConst"));
787 if (_value != null) { 1156 if (_value != null) {
788 _json["isConst"] = _value; 1157 _json["isConst"] = _value;
789 } 1158 }
790 } 1159 }
791 1160
1161 /**
1162 * Indicates whether the executable is declared using the `factory` keyword.
1163 */
792 void set isFactory(bool _value) { 1164 void set isFactory(bool _value) {
793 assert(!_finished); 1165 assert(!_finished);
794 assert(!_json.containsKey("isFactory")); 1166 assert(!_json.containsKey("isFactory"));
795 if (_value != null) { 1167 if (_value != null) {
796 _json["isFactory"] = _value; 1168 _json["isFactory"] = _value;
797 } 1169 }
798 } 1170 }
799 1171
1172 /**
1173 * Indicates whether the executable lacks an explicit return type
1174 * declaration. False for constructors and setters.
1175 */
800 void set hasImplicitReturnType(bool _value) { 1176 void set hasImplicitReturnType(bool _value) {
801 assert(!_finished); 1177 assert(!_finished);
802 assert(!_json.containsKey("hasImplicitReturnType")); 1178 assert(!_json.containsKey("hasImplicitReturnType"));
803 if (_value != null) { 1179 if (_value != null) {
804 _json["hasImplicitReturnType"] = _value; 1180 _json["hasImplicitReturnType"] = _value;
805 } 1181 }
806 } 1182 }
807 1183
1184 /**
1185 * Indicates whether the executable is declared using the `external` keyword.
1186 */
808 void set isExternal(bool _value) { 1187 void set isExternal(bool _value) {
809 assert(!_finished); 1188 assert(!_finished);
810 assert(!_json.containsKey("isExternal")); 1189 assert(!_json.containsKey("isExternal"));
811 if (_value != null) { 1190 if (_value != null) {
812 _json["isExternal"] = _value; 1191 _json["isExternal"] = _value;
813 } 1192 }
814 } 1193 }
815 1194
816 Map finish() { 1195 Map finish() {
817 assert(!_finished); 1196 assert(!_finished);
(...skipping 11 matching lines...) Expand all
829 builder.kind = kind; 1208 builder.kind = kind;
830 builder.isAbstract = isAbstract; 1209 builder.isAbstract = isAbstract;
831 builder.isStatic = isStatic; 1210 builder.isStatic = isStatic;
832 builder.isConst = isConst; 1211 builder.isConst = isConst;
833 builder.isFactory = isFactory; 1212 builder.isFactory = isFactory;
834 builder.hasImplicitReturnType = hasImplicitReturnType; 1213 builder.hasImplicitReturnType = hasImplicitReturnType;
835 builder.isExternal = isExternal; 1214 builder.isExternal = isExternal;
836 return builder; 1215 return builder;
837 } 1216 }
838 1217
1218 /**
1219 * Unlinked summary information about an export declaration.
1220 */
839 class UnlinkedExport extends base.SummaryClass { 1221 class UnlinkedExport extends base.SummaryClass {
840 String _uri; 1222 String _uri;
841 List<UnlinkedCombinator> _combinators; 1223 List<UnlinkedCombinator> _combinators;
842 1224
843 UnlinkedExport.fromJson(Map json) 1225 UnlinkedExport.fromJson(Map json)
844 : _uri = json["uri"], 1226 : _uri = json["uri"],
845 _combinators = json["combinators"]?.map((x) => new UnlinkedCombinator.from Json(x))?.toList(); 1227 _combinators = json["combinators"]?.map((x) => new UnlinkedCombinator.from Json(x))?.toList();
846 1228
847 @override 1229 @override
848 Map<String, Object> toMap() => { 1230 Map<String, Object> toMap() => {
849 "uri": uri, 1231 "uri": uri,
850 "combinators": combinators, 1232 "combinators": combinators,
851 }; 1233 };
852 1234
1235 /**
1236 * URI used in the source code to reference the exported library.
1237 */
853 String get uri => _uri ?? ''; 1238 String get uri => _uri ?? '';
1239
1240 /**
1241 * Combinators contained in this import declaration.
1242 */
854 List<UnlinkedCombinator> get combinators => _combinators ?? const <UnlinkedCom binator>[]; 1243 List<UnlinkedCombinator> get combinators => _combinators ?? const <UnlinkedCom binator>[];
855 } 1244 }
856 1245
857 class UnlinkedExportBuilder { 1246 class UnlinkedExportBuilder {
858 final Map _json = {}; 1247 final Map _json = {};
859 1248
860 bool _finished = false; 1249 bool _finished = false;
861 1250
862 UnlinkedExportBuilder(base.BuilderContext context); 1251 UnlinkedExportBuilder(base.BuilderContext context);
863 1252
1253 /**
1254 * URI used in the source code to reference the exported library.
1255 */
864 void set uri(String _value) { 1256 void set uri(String _value) {
865 assert(!_finished); 1257 assert(!_finished);
866 assert(!_json.containsKey("uri")); 1258 assert(!_json.containsKey("uri"));
867 if (_value != null) { 1259 if (_value != null) {
868 _json["uri"] = _value; 1260 _json["uri"] = _value;
869 } 1261 }
870 } 1262 }
871 1263
1264 /**
1265 * Combinators contained in this import declaration.
1266 */
872 void set combinators(List<UnlinkedCombinatorBuilder> _value) { 1267 void set combinators(List<UnlinkedCombinatorBuilder> _value) {
873 assert(!_finished); 1268 assert(!_finished);
874 assert(!_json.containsKey("combinators")); 1269 assert(!_json.containsKey("combinators"));
875 if (!(_value == null || _value.isEmpty)) { 1270 if (!(_value == null || _value.isEmpty)) {
876 _json["combinators"] = _value.map((b) => b.finish()).toList(); 1271 _json["combinators"] = _value.map((b) => b.finish()).toList();
877 } 1272 }
878 } 1273 }
879 1274
880 Map finish() { 1275 Map finish() {
881 assert(!_finished); 1276 assert(!_finished);
882 _finished = true; 1277 _finished = true;
883 return _json; 1278 return _json;
884 } 1279 }
885 } 1280 }
886 1281
887 UnlinkedExportBuilder encodeUnlinkedExport(base.BuilderContext builderContext, { String uri, List<UnlinkedCombinatorBuilder> combinators}) { 1282 UnlinkedExportBuilder encodeUnlinkedExport(base.BuilderContext builderContext, { String uri, List<UnlinkedCombinatorBuilder> combinators}) {
888 UnlinkedExportBuilder builder = new UnlinkedExportBuilder(builderContext); 1283 UnlinkedExportBuilder builder = new UnlinkedExportBuilder(builderContext);
889 builder.uri = uri; 1284 builder.uri = uri;
890 builder.combinators = combinators; 1285 builder.combinators = combinators;
891 return builder; 1286 return builder;
892 } 1287 }
893 1288
1289 /**
1290 * Unlinked summary information about an import declaration.
1291 */
894 class UnlinkedImport extends base.SummaryClass { 1292 class UnlinkedImport extends base.SummaryClass {
895 String _uri; 1293 String _uri;
896 int _offset; 1294 int _offset;
897 int _prefixReference; 1295 int _prefixReference;
898 List<UnlinkedCombinator> _combinators; 1296 List<UnlinkedCombinator> _combinators;
899 bool _isDeferred; 1297 bool _isDeferred;
900 bool _isImplicit; 1298 bool _isImplicit;
901 1299
902 UnlinkedImport.fromJson(Map json) 1300 UnlinkedImport.fromJson(Map json)
903 : _uri = json["uri"], 1301 : _uri = json["uri"],
904 _offset = json["offset"], 1302 _offset = json["offset"],
905 _prefixReference = json["prefixReference"], 1303 _prefixReference = json["prefixReference"],
906 _combinators = json["combinators"]?.map((x) => new UnlinkedCombinator.from Json(x))?.toList(), 1304 _combinators = json["combinators"]?.map((x) => new UnlinkedCombinator.from Json(x))?.toList(),
907 _isDeferred = json["isDeferred"], 1305 _isDeferred = json["isDeferred"],
908 _isImplicit = json["isImplicit"]; 1306 _isImplicit = json["isImplicit"];
909 1307
910 @override 1308 @override
911 Map<String, Object> toMap() => { 1309 Map<String, Object> toMap() => {
912 "uri": uri, 1310 "uri": uri,
913 "offset": offset, 1311 "offset": offset,
914 "prefixReference": prefixReference, 1312 "prefixReference": prefixReference,
915 "combinators": combinators, 1313 "combinators": combinators,
916 "isDeferred": isDeferred, 1314 "isDeferred": isDeferred,
917 "isImplicit": isImplicit, 1315 "isImplicit": isImplicit,
918 }; 1316 };
919 1317
1318 /**
1319 * URI used in the source code to reference the imported library.
1320 */
920 String get uri => _uri ?? ''; 1321 String get uri => _uri ?? '';
1322
1323 /**
1324 * If [isImplicit] is false, offset of the "import" keyword. If [isImplicit]
1325 * is true, zero.
1326 */
921 int get offset => _offset ?? 0; 1327 int get offset => _offset ?? 0;
1328
1329 /**
1330 * Index into [UnlinkedUnit.references] of the prefix declared by this
1331 * import declaration, or zero if this import declaration declares no prefix.
1332 *
1333 * Note that multiple imports can declare the same prefix.
1334 */
922 int get prefixReference => _prefixReference ?? 0; 1335 int get prefixReference => _prefixReference ?? 0;
1336
1337 /**
1338 * Combinators contained in this import declaration.
1339 */
923 List<UnlinkedCombinator> get combinators => _combinators ?? const <UnlinkedCom binator>[]; 1340 List<UnlinkedCombinator> get combinators => _combinators ?? const <UnlinkedCom binator>[];
1341
1342 /**
1343 * Indicates whether the import declaration uses the `deferred` keyword.
1344 */
924 bool get isDeferred => _isDeferred ?? false; 1345 bool get isDeferred => _isDeferred ?? false;
1346
1347 /**
1348 * Indicates whether the import declaration is implicit.
1349 */
925 bool get isImplicit => _isImplicit ?? false; 1350 bool get isImplicit => _isImplicit ?? false;
926 } 1351 }
927 1352
928 class UnlinkedImportBuilder { 1353 class UnlinkedImportBuilder {
929 final Map _json = {}; 1354 final Map _json = {};
930 1355
931 bool _finished = false; 1356 bool _finished = false;
932 1357
933 UnlinkedImportBuilder(base.BuilderContext context); 1358 UnlinkedImportBuilder(base.BuilderContext context);
934 1359
1360 /**
1361 * URI used in the source code to reference the imported library.
1362 */
935 void set uri(String _value) { 1363 void set uri(String _value) {
936 assert(!_finished); 1364 assert(!_finished);
937 assert(!_json.containsKey("uri")); 1365 assert(!_json.containsKey("uri"));
938 if (_value != null) { 1366 if (_value != null) {
939 _json["uri"] = _value; 1367 _json["uri"] = _value;
940 } 1368 }
941 } 1369 }
942 1370
1371 /**
1372 * If [isImplicit] is false, offset of the "import" keyword. If [isImplicit]
1373 * is true, zero.
1374 */
943 void set offset(int _value) { 1375 void set offset(int _value) {
944 assert(!_finished); 1376 assert(!_finished);
945 assert(!_json.containsKey("offset")); 1377 assert(!_json.containsKey("offset"));
946 if (_value != null) { 1378 if (_value != null) {
947 _json["offset"] = _value; 1379 _json["offset"] = _value;
948 } 1380 }
949 } 1381 }
950 1382
1383 /**
1384 * Index into [UnlinkedUnit.references] of the prefix declared by this
1385 * import declaration, or zero if this import declaration declares no prefix.
1386 *
1387 * Note that multiple imports can declare the same prefix.
1388 */
951 void set prefixReference(int _value) { 1389 void set prefixReference(int _value) {
952 assert(!_finished); 1390 assert(!_finished);
953 assert(!_json.containsKey("prefixReference")); 1391 assert(!_json.containsKey("prefixReference"));
954 if (_value != null) { 1392 if (_value != null) {
955 _json["prefixReference"] = _value; 1393 _json["prefixReference"] = _value;
956 } 1394 }
957 } 1395 }
958 1396
1397 /**
1398 * Combinators contained in this import declaration.
1399 */
959 void set combinators(List<UnlinkedCombinatorBuilder> _value) { 1400 void set combinators(List<UnlinkedCombinatorBuilder> _value) {
960 assert(!_finished); 1401 assert(!_finished);
961 assert(!_json.containsKey("combinators")); 1402 assert(!_json.containsKey("combinators"));
962 if (!(_value == null || _value.isEmpty)) { 1403 if (!(_value == null || _value.isEmpty)) {
963 _json["combinators"] = _value.map((b) => b.finish()).toList(); 1404 _json["combinators"] = _value.map((b) => b.finish()).toList();
964 } 1405 }
965 } 1406 }
966 1407
1408 /**
1409 * Indicates whether the import declaration uses the `deferred` keyword.
1410 */
967 void set isDeferred(bool _value) { 1411 void set isDeferred(bool _value) {
968 assert(!_finished); 1412 assert(!_finished);
969 assert(!_json.containsKey("isDeferred")); 1413 assert(!_json.containsKey("isDeferred"));
970 if (_value != null) { 1414 if (_value != null) {
971 _json["isDeferred"] = _value; 1415 _json["isDeferred"] = _value;
972 } 1416 }
973 } 1417 }
974 1418
1419 /**
1420 * Indicates whether the import declaration is implicit.
1421 */
975 void set isImplicit(bool _value) { 1422 void set isImplicit(bool _value) {
976 assert(!_finished); 1423 assert(!_finished);
977 assert(!_json.containsKey("isImplicit")); 1424 assert(!_json.containsKey("isImplicit"));
978 if (_value != null) { 1425 if (_value != null) {
979 _json["isImplicit"] = _value; 1426 _json["isImplicit"] = _value;
980 } 1427 }
981 } 1428 }
982 1429
983 Map finish() { 1430 Map finish() {
984 assert(!_finished); 1431 assert(!_finished);
985 _finished = true; 1432 _finished = true;
986 return _json; 1433 return _json;
987 } 1434 }
988 } 1435 }
989 1436
990 UnlinkedImportBuilder encodeUnlinkedImport(base.BuilderContext builderContext, { String uri, int offset, int prefixReference, List<UnlinkedCombinatorBuilder> com binators, bool isDeferred, bool isImplicit}) { 1437 UnlinkedImportBuilder encodeUnlinkedImport(base.BuilderContext builderContext, { String uri, int offset, int prefixReference, List<UnlinkedCombinatorBuilder> com binators, bool isDeferred, bool isImplicit}) {
991 UnlinkedImportBuilder builder = new UnlinkedImportBuilder(builderContext); 1438 UnlinkedImportBuilder builder = new UnlinkedImportBuilder(builderContext);
992 builder.uri = uri; 1439 builder.uri = uri;
993 builder.offset = offset; 1440 builder.offset = offset;
994 builder.prefixReference = prefixReference; 1441 builder.prefixReference = prefixReference;
995 builder.combinators = combinators; 1442 builder.combinators = combinators;
996 builder.isDeferred = isDeferred; 1443 builder.isDeferred = isDeferred;
997 builder.isImplicit = isImplicit; 1444 builder.isImplicit = isImplicit;
998 return builder; 1445 return builder;
999 } 1446 }
1000 1447
1448 /**
1449 * Unlinked summary information about a function parameter.
1450 */
1001 class UnlinkedParam extends base.SummaryClass { 1451 class UnlinkedParam extends base.SummaryClass {
1002 String _name; 1452 String _name;
1003 UnlinkedTypeRef _type; 1453 UnlinkedTypeRef _type;
1004 List<UnlinkedParam> _parameters; 1454 List<UnlinkedParam> _parameters;
1005 UnlinkedParamKind _kind; 1455 UnlinkedParamKind _kind;
1006 bool _isFunctionTyped; 1456 bool _isFunctionTyped;
1007 bool _isInitializingFormal; 1457 bool _isInitializingFormal;
1008 bool _hasImplicitType; 1458 bool _hasImplicitType;
1009 1459
1010 UnlinkedParam.fromJson(Map json) 1460 UnlinkedParam.fromJson(Map json)
1011 : _name = json["name"], 1461 : _name = json["name"],
1012 _type = json["type"] == null ? null : new UnlinkedTypeRef.fromJson(json["t ype"]), 1462 _type = json["type"] == null ? null : new UnlinkedTypeRef.fromJson(json["t ype"]),
1013 _parameters = json["parameters"]?.map((x) => new UnlinkedParam.fromJson(x) )?.toList(), 1463 _parameters = json["parameters"]?.map((x) => new UnlinkedParam.fromJson(x) )?.toList(),
1014 _kind = json["kind"] == null ? null : UnlinkedParamKind.values[json["kind" ]], 1464 _kind = json["kind"] == null ? null : UnlinkedParamKind.values[json["kind" ]],
1015 _isFunctionTyped = json["isFunctionTyped"], 1465 _isFunctionTyped = json["isFunctionTyped"],
1016 _isInitializingFormal = json["isInitializingFormal"], 1466 _isInitializingFormal = json["isInitializingFormal"],
1017 _hasImplicitType = json["hasImplicitType"]; 1467 _hasImplicitType = json["hasImplicitType"];
1018 1468
1019 @override 1469 @override
1020 Map<String, Object> toMap() => { 1470 Map<String, Object> toMap() => {
1021 "name": name, 1471 "name": name,
1022 "type": type, 1472 "type": type,
1023 "parameters": parameters, 1473 "parameters": parameters,
1024 "kind": kind, 1474 "kind": kind,
1025 "isFunctionTyped": isFunctionTyped, 1475 "isFunctionTyped": isFunctionTyped,
1026 "isInitializingFormal": isInitializingFormal, 1476 "isInitializingFormal": isInitializingFormal,
1027 "hasImplicitType": hasImplicitType, 1477 "hasImplicitType": hasImplicitType,
1028 }; 1478 };
1029 1479
1480 /**
1481 * Name of the parameter.
1482 */
1030 String get name => _name ?? ''; 1483 String get name => _name ?? '';
1484
1485 /**
1486 * If [isFunctionTyped] is `true`, the declared return type. If
1487 * [isFunctionTyped] is `false`, the declared type. Absent if
1488 * [isFunctionTyped] is `true` and the declared return type is `void`. Note
1489 * that when strong mode is enabled, the actual type may be different due to
1490 * type inference.
1491 */
1031 UnlinkedTypeRef get type => _type; 1492 UnlinkedTypeRef get type => _type;
1493
1494 /**
1495 * If [isFunctionTyped] is `true`, the parameters of the function type.
1496 */
1032 List<UnlinkedParam> get parameters => _parameters ?? const <UnlinkedParam>[]; 1497 List<UnlinkedParam> get parameters => _parameters ?? const <UnlinkedParam>[];
1498
1499 /**
1500 * Kind of the parameter.
1501 */
1033 UnlinkedParamKind get kind => _kind ?? UnlinkedParamKind.required; 1502 UnlinkedParamKind get kind => _kind ?? UnlinkedParamKind.required;
1503
1504 /**
1505 * Indicates whether this is a function-typed parameter.
1506 */
1034 bool get isFunctionTyped => _isFunctionTyped ?? false; 1507 bool get isFunctionTyped => _isFunctionTyped ?? false;
1508
1509 /**
1510 * Indicates whether this is an initializing formal parameter (i.e. it is
1511 * declared using `this.` syntax).
1512 */
1035 bool get isInitializingFormal => _isInitializingFormal ?? false; 1513 bool get isInitializingFormal => _isInitializingFormal ?? false;
1514
1515 /**
1516 * Indicates whether this parameter lacks an explicit type declaration.
1517 * Always false for a function-typed parameter.
1518 */
1036 bool get hasImplicitType => _hasImplicitType ?? false; 1519 bool get hasImplicitType => _hasImplicitType ?? false;
1037 } 1520 }
1038 1521
1039 class UnlinkedParamBuilder { 1522 class UnlinkedParamBuilder {
1040 final Map _json = {}; 1523 final Map _json = {};
1041 1524
1042 bool _finished = false; 1525 bool _finished = false;
1043 1526
1044 UnlinkedParamBuilder(base.BuilderContext context); 1527 UnlinkedParamBuilder(base.BuilderContext context);
1045 1528
1529 /**
1530 * Name of the parameter.
1531 */
1046 void set name(String _value) { 1532 void set name(String _value) {
1047 assert(!_finished); 1533 assert(!_finished);
1048 assert(!_json.containsKey("name")); 1534 assert(!_json.containsKey("name"));
1049 if (_value != null) { 1535 if (_value != null) {
1050 _json["name"] = _value; 1536 _json["name"] = _value;
1051 } 1537 }
1052 } 1538 }
1053 1539
1540 /**
1541 * If [isFunctionTyped] is `true`, the declared return type. If
1542 * [isFunctionTyped] is `false`, the declared type. Absent if
1543 * [isFunctionTyped] is `true` and the declared return type is `void`. Note
1544 * that when strong mode is enabled, the actual type may be different due to
1545 * type inference.
1546 */
1054 void set type(UnlinkedTypeRefBuilder _value) { 1547 void set type(UnlinkedTypeRefBuilder _value) {
1055 assert(!_finished); 1548 assert(!_finished);
1056 assert(!_json.containsKey("type")); 1549 assert(!_json.containsKey("type"));
1057 if (_value != null) { 1550 if (_value != null) {
1058 _json["type"] = _value.finish(); 1551 _json["type"] = _value.finish();
1059 } 1552 }
1060 } 1553 }
1061 1554
1555 /**
1556 * If [isFunctionTyped] is `true`, the parameters of the function type.
1557 */
1062 void set parameters(List<UnlinkedParamBuilder> _value) { 1558 void set parameters(List<UnlinkedParamBuilder> _value) {
1063 assert(!_finished); 1559 assert(!_finished);
1064 assert(!_json.containsKey("parameters")); 1560 assert(!_json.containsKey("parameters"));
1065 if (!(_value == null || _value.isEmpty)) { 1561 if (!(_value == null || _value.isEmpty)) {
1066 _json["parameters"] = _value.map((b) => b.finish()).toList(); 1562 _json["parameters"] = _value.map((b) => b.finish()).toList();
1067 } 1563 }
1068 } 1564 }
1069 1565
1566 /**
1567 * Kind of the parameter.
1568 */
1070 void set kind(UnlinkedParamKind _value) { 1569 void set kind(UnlinkedParamKind _value) {
1071 assert(!_finished); 1570 assert(!_finished);
1072 assert(!_json.containsKey("kind")); 1571 assert(!_json.containsKey("kind"));
1073 if (!(_value == null || _value == UnlinkedParamKind.required)) { 1572 if (!(_value == null || _value == UnlinkedParamKind.required)) {
1074 _json["kind"] = _value.index; 1573 _json["kind"] = _value.index;
1075 } 1574 }
1076 } 1575 }
1077 1576
1577 /**
1578 * Indicates whether this is a function-typed parameter.
1579 */
1078 void set isFunctionTyped(bool _value) { 1580 void set isFunctionTyped(bool _value) {
1079 assert(!_finished); 1581 assert(!_finished);
1080 assert(!_json.containsKey("isFunctionTyped")); 1582 assert(!_json.containsKey("isFunctionTyped"));
1081 if (_value != null) { 1583 if (_value != null) {
1082 _json["isFunctionTyped"] = _value; 1584 _json["isFunctionTyped"] = _value;
1083 } 1585 }
1084 } 1586 }
1085 1587
1588 /**
1589 * Indicates whether this is an initializing formal parameter (i.e. it is
1590 * declared using `this.` syntax).
1591 */
1086 void set isInitializingFormal(bool _value) { 1592 void set isInitializingFormal(bool _value) {
1087 assert(!_finished); 1593 assert(!_finished);
1088 assert(!_json.containsKey("isInitializingFormal")); 1594 assert(!_json.containsKey("isInitializingFormal"));
1089 if (_value != null) { 1595 if (_value != null) {
1090 _json["isInitializingFormal"] = _value; 1596 _json["isInitializingFormal"] = _value;
1091 } 1597 }
1092 } 1598 }
1093 1599
1600 /**
1601 * Indicates whether this parameter lacks an explicit type declaration.
1602 * Always false for a function-typed parameter.
1603 */
1094 void set hasImplicitType(bool _value) { 1604 void set hasImplicitType(bool _value) {
1095 assert(!_finished); 1605 assert(!_finished);
1096 assert(!_json.containsKey("hasImplicitType")); 1606 assert(!_json.containsKey("hasImplicitType"));
1097 if (_value != null) { 1607 if (_value != null) {
1098 _json["hasImplicitType"] = _value; 1608 _json["hasImplicitType"] = _value;
1099 } 1609 }
1100 } 1610 }
1101 1611
1102 Map finish() { 1612 Map finish() {
1103 assert(!_finished); 1613 assert(!_finished);
1104 _finished = true; 1614 _finished = true;
1105 return _json; 1615 return _json;
1106 } 1616 }
1107 } 1617 }
1108 1618
1109 UnlinkedParamBuilder encodeUnlinkedParam(base.BuilderContext builderContext, {St ring name, UnlinkedTypeRefBuilder type, List<UnlinkedParamBuilder> parameters, U nlinkedParamKind kind, bool isFunctionTyped, bool isInitializingFormal, bool has ImplicitType}) { 1619 UnlinkedParamBuilder encodeUnlinkedParam(base.BuilderContext builderContext, {St ring name, UnlinkedTypeRefBuilder type, List<UnlinkedParamBuilder> parameters, U nlinkedParamKind kind, bool isFunctionTyped, bool isInitializingFormal, bool has ImplicitType}) {
1110 UnlinkedParamBuilder builder = new UnlinkedParamBuilder(builderContext); 1620 UnlinkedParamBuilder builder = new UnlinkedParamBuilder(builderContext);
1111 builder.name = name; 1621 builder.name = name;
1112 builder.type = type; 1622 builder.type = type;
1113 builder.parameters = parameters; 1623 builder.parameters = parameters;
1114 builder.kind = kind; 1624 builder.kind = kind;
1115 builder.isFunctionTyped = isFunctionTyped; 1625 builder.isFunctionTyped = isFunctionTyped;
1116 builder.isInitializingFormal = isInitializingFormal; 1626 builder.isInitializingFormal = isInitializingFormal;
1117 builder.hasImplicitType = hasImplicitType; 1627 builder.hasImplicitType = hasImplicitType;
1118 return builder; 1628 return builder;
1119 } 1629 }
1120 1630
1631 /**
1632 * Unlinked summary information about a part declaration.
1633 */
1121 class UnlinkedPart extends base.SummaryClass { 1634 class UnlinkedPart extends base.SummaryClass {
1122 String _uri; 1635 String _uri;
1123 1636
1124 UnlinkedPart.fromJson(Map json) 1637 UnlinkedPart.fromJson(Map json)
1125 : _uri = json["uri"]; 1638 : _uri = json["uri"];
1126 1639
1127 @override 1640 @override
1128 Map<String, Object> toMap() => { 1641 Map<String, Object> toMap() => {
1129 "uri": uri, 1642 "uri": uri,
1130 }; 1643 };
1131 1644
1645 /**
1646 * String used in the compilation unit to refer to the part file.
1647 */
1132 String get uri => _uri ?? ''; 1648 String get uri => _uri ?? '';
1133 } 1649 }
1134 1650
1135 class UnlinkedPartBuilder { 1651 class UnlinkedPartBuilder {
1136 final Map _json = {}; 1652 final Map _json = {};
1137 1653
1138 bool _finished = false; 1654 bool _finished = false;
1139 1655
1140 UnlinkedPartBuilder(base.BuilderContext context); 1656 UnlinkedPartBuilder(base.BuilderContext context);
1141 1657
1658 /**
1659 * String used in the compilation unit to refer to the part file.
1660 */
1142 void set uri(String _value) { 1661 void set uri(String _value) {
1143 assert(!_finished); 1662 assert(!_finished);
1144 assert(!_json.containsKey("uri")); 1663 assert(!_json.containsKey("uri"));
1145 if (_value != null) { 1664 if (_value != null) {
1146 _json["uri"] = _value; 1665 _json["uri"] = _value;
1147 } 1666 }
1148 } 1667 }
1149 1668
1150 Map finish() { 1669 Map finish() {
1151 assert(!_finished); 1670 assert(!_finished);
1152 _finished = true; 1671 _finished = true;
1153 return _json; 1672 return _json;
1154 } 1673 }
1155 } 1674 }
1156 1675
1157 UnlinkedPartBuilder encodeUnlinkedPart(base.BuilderContext builderContext, {Stri ng uri}) { 1676 UnlinkedPartBuilder encodeUnlinkedPart(base.BuilderContext builderContext, {Stri ng uri}) {
1158 UnlinkedPartBuilder builder = new UnlinkedPartBuilder(builderContext); 1677 UnlinkedPartBuilder builder = new UnlinkedPartBuilder(builderContext);
1159 builder.uri = uri; 1678 builder.uri = uri;
1160 return builder; 1679 return builder;
1161 } 1680 }
1162 1681
1682 /**
1683 * Unlinked summary information about a specific name contributed by a
1684 * compilation unit to a library's public namespace.
1685 *
1686 * TODO(paulberry): add a count of generic parameters, so that resynthesis
1687 * doesn't have to peek into the library to obtain this info.
1688 *
1689 * TODO(paulberry): for classes, add info about static members and
1690 * constructors, since this will be needed to prelink info about constants.
1691 *
1692 * TODO(paulberry): some of this information is redundant with information
1693 * elsewhere in the summary. Consider reducing the redundancy to reduce
1694 * summary size.
1695 */
1163 class UnlinkedPublicName extends base.SummaryClass { 1696 class UnlinkedPublicName extends base.SummaryClass {
1164 String _name; 1697 String _name;
1165 PrelinkedReferenceKind _kind; 1698 PrelinkedReferenceKind _kind;
1166 1699
1167 UnlinkedPublicName.fromJson(Map json) 1700 UnlinkedPublicName.fromJson(Map json)
1168 : _name = json["name"], 1701 : _name = json["name"],
1169 _kind = json["kind"] == null ? null : PrelinkedReferenceKind.values[json[" kind"]]; 1702 _kind = json["kind"] == null ? null : PrelinkedReferenceKind.values[json[" kind"]];
1170 1703
1171 @override 1704 @override
1172 Map<String, Object> toMap() => { 1705 Map<String, Object> toMap() => {
1173 "name": name, 1706 "name": name,
1174 "kind": kind, 1707 "kind": kind,
1175 }; 1708 };
1176 1709
1710 /**
1711 * The name itself.
1712 */
1177 String get name => _name ?? ''; 1713 String get name => _name ?? '';
1714
1715 /**
1716 * The kind of object referred to by the name.
1717 */
1178 PrelinkedReferenceKind get kind => _kind ?? PrelinkedReferenceKind.classOrEnum ; 1718 PrelinkedReferenceKind get kind => _kind ?? PrelinkedReferenceKind.classOrEnum ;
1179 } 1719 }
1180 1720
1181 class UnlinkedPublicNameBuilder { 1721 class UnlinkedPublicNameBuilder {
1182 final Map _json = {}; 1722 final Map _json = {};
1183 1723
1184 bool _finished = false; 1724 bool _finished = false;
1185 1725
1186 UnlinkedPublicNameBuilder(base.BuilderContext context); 1726 UnlinkedPublicNameBuilder(base.BuilderContext context);
1187 1727
1728 /**
1729 * The name itself.
1730 */
1188 void set name(String _value) { 1731 void set name(String _value) {
1189 assert(!_finished); 1732 assert(!_finished);
1190 assert(!_json.containsKey("name")); 1733 assert(!_json.containsKey("name"));
1191 if (_value != null) { 1734 if (_value != null) {
1192 _json["name"] = _value; 1735 _json["name"] = _value;
1193 } 1736 }
1194 } 1737 }
1195 1738
1739 /**
1740 * The kind of object referred to by the name.
1741 */
1196 void set kind(PrelinkedReferenceKind _value) { 1742 void set kind(PrelinkedReferenceKind _value) {
1197 assert(!_finished); 1743 assert(!_finished);
1198 assert(!_json.containsKey("kind")); 1744 assert(!_json.containsKey("kind"));
1199 if (!(_value == null || _value == PrelinkedReferenceKind.classOrEnum)) { 1745 if (!(_value == null || _value == PrelinkedReferenceKind.classOrEnum)) {
1200 _json["kind"] = _value.index; 1746 _json["kind"] = _value.index;
1201 } 1747 }
1202 } 1748 }
1203 1749
1204 Map finish() { 1750 Map finish() {
1205 assert(!_finished); 1751 assert(!_finished);
1206 _finished = true; 1752 _finished = true;
1207 return _json; 1753 return _json;
1208 } 1754 }
1209 } 1755 }
1210 1756
1211 UnlinkedPublicNameBuilder encodeUnlinkedPublicName(base.BuilderContext builderCo ntext, {String name, PrelinkedReferenceKind kind}) { 1757 UnlinkedPublicNameBuilder encodeUnlinkedPublicName(base.BuilderContext builderCo ntext, {String name, PrelinkedReferenceKind kind}) {
1212 UnlinkedPublicNameBuilder builder = new UnlinkedPublicNameBuilder(builderConte xt); 1758 UnlinkedPublicNameBuilder builder = new UnlinkedPublicNameBuilder(builderConte xt);
1213 builder.name = name; 1759 builder.name = name;
1214 builder.kind = kind; 1760 builder.kind = kind;
1215 return builder; 1761 return builder;
1216 } 1762 }
1217 1763
1764 /**
1765 * Unlinked summary information about what a compilation unit contributes to a
1766 * library's public namespace. This is the subset of [UnlinkedUnit] that is
1767 * required from dependent libraries in order to perform prelinking.
1768 */
1218 class UnlinkedPublicNamespace extends base.SummaryClass { 1769 class UnlinkedPublicNamespace extends base.SummaryClass {
1219 List<UnlinkedPublicName> _names; 1770 List<UnlinkedPublicName> _names;
1220 List<UnlinkedExport> _exports; 1771 List<UnlinkedExport> _exports;
1221 List<UnlinkedPart> _parts; 1772 List<UnlinkedPart> _parts;
1222 1773
1223 UnlinkedPublicNamespace.fromJson(Map json) 1774 UnlinkedPublicNamespace.fromJson(Map json)
1224 : _names = json["names"]?.map((x) => new UnlinkedPublicName.fromJson(x))?.to List(), 1775 : _names = json["names"]?.map((x) => new UnlinkedPublicName.fromJson(x))?.to List(),
1225 _exports = json["exports"]?.map((x) => new UnlinkedExport.fromJson(x))?.to List(), 1776 _exports = json["exports"]?.map((x) => new UnlinkedExport.fromJson(x))?.to List(),
1226 _parts = json["parts"]?.map((x) => new UnlinkedPart.fromJson(x))?.toList() ; 1777 _parts = json["parts"]?.map((x) => new UnlinkedPart.fromJson(x))?.toList() ;
1227 1778
1228 @override 1779 @override
1229 Map<String, Object> toMap() => { 1780 Map<String, Object> toMap() => {
1230 "names": names, 1781 "names": names,
1231 "exports": exports, 1782 "exports": exports,
1232 "parts": parts, 1783 "parts": parts,
1233 }; 1784 };
1234 1785
1235 UnlinkedPublicNamespace.fromBuffer(List<int> buffer) : this.fromJson(JSON.deco de(UTF8.decode(buffer))); 1786 UnlinkedPublicNamespace.fromBuffer(List<int> buffer) : this.fromJson(JSON.deco de(UTF8.decode(buffer)));
1236 1787
1788 /**
1789 * Public names defined in the compilation unit.
1790 *
1791 * TODO(paulberry): consider sorting these names to reduce unnecessary
1792 * relinking.
1793 */
1237 List<UnlinkedPublicName> get names => _names ?? const <UnlinkedPublicName>[]; 1794 List<UnlinkedPublicName> get names => _names ?? const <UnlinkedPublicName>[];
1795
1796 /**
1797 * Export declarations in the compilation unit.
1798 */
1238 List<UnlinkedExport> get exports => _exports ?? const <UnlinkedExport>[]; 1799 List<UnlinkedExport> get exports => _exports ?? const <UnlinkedExport>[];
1800
1801 /**
1802 * Part declarations in the compilation unit.
1803 */
1239 List<UnlinkedPart> get parts => _parts ?? const <UnlinkedPart>[]; 1804 List<UnlinkedPart> get parts => _parts ?? const <UnlinkedPart>[];
1240 } 1805 }
1241 1806
1242 class UnlinkedPublicNamespaceBuilder { 1807 class UnlinkedPublicNamespaceBuilder {
1243 final Map _json = {}; 1808 final Map _json = {};
1244 1809
1245 bool _finished = false; 1810 bool _finished = false;
1246 1811
1247 UnlinkedPublicNamespaceBuilder(base.BuilderContext context); 1812 UnlinkedPublicNamespaceBuilder(base.BuilderContext context);
1248 1813
1814 /**
1815 * Public names defined in the compilation unit.
1816 *
1817 * TODO(paulberry): consider sorting these names to reduce unnecessary
1818 * relinking.
1819 */
1249 void set names(List<UnlinkedPublicNameBuilder> _value) { 1820 void set names(List<UnlinkedPublicNameBuilder> _value) {
1250 assert(!_finished); 1821 assert(!_finished);
1251 assert(!_json.containsKey("names")); 1822 assert(!_json.containsKey("names"));
1252 if (!(_value == null || _value.isEmpty)) { 1823 if (!(_value == null || _value.isEmpty)) {
1253 _json["names"] = _value.map((b) => b.finish()).toList(); 1824 _json["names"] = _value.map((b) => b.finish()).toList();
1254 } 1825 }
1255 } 1826 }
1256 1827
1828 /**
1829 * Export declarations in the compilation unit.
1830 */
1257 void set exports(List<UnlinkedExportBuilder> _value) { 1831 void set exports(List<UnlinkedExportBuilder> _value) {
1258 assert(!_finished); 1832 assert(!_finished);
1259 assert(!_json.containsKey("exports")); 1833 assert(!_json.containsKey("exports"));
1260 if (!(_value == null || _value.isEmpty)) { 1834 if (!(_value == null || _value.isEmpty)) {
1261 _json["exports"] = _value.map((b) => b.finish()).toList(); 1835 _json["exports"] = _value.map((b) => b.finish()).toList();
1262 } 1836 }
1263 } 1837 }
1264 1838
1839 /**
1840 * Part declarations in the compilation unit.
1841 */
1265 void set parts(List<UnlinkedPartBuilder> _value) { 1842 void set parts(List<UnlinkedPartBuilder> _value) {
1266 assert(!_finished); 1843 assert(!_finished);
1267 assert(!_json.containsKey("parts")); 1844 assert(!_json.containsKey("parts"));
1268 if (!(_value == null || _value.isEmpty)) { 1845 if (!(_value == null || _value.isEmpty)) {
1269 _json["parts"] = _value.map((b) => b.finish()).toList(); 1846 _json["parts"] = _value.map((b) => b.finish()).toList();
1270 } 1847 }
1271 } 1848 }
1272 1849
1273 List<int> toBuffer() => UTF8.encode(JSON.encode(finish())); 1850 List<int> toBuffer() => UTF8.encode(JSON.encode(finish()));
1274 1851
1275 Map finish() { 1852 Map finish() {
1276 assert(!_finished); 1853 assert(!_finished);
1277 _finished = true; 1854 _finished = true;
1278 return _json; 1855 return _json;
1279 } 1856 }
1280 } 1857 }
1281 1858
1282 UnlinkedPublicNamespaceBuilder encodeUnlinkedPublicNamespace(base.BuilderContext builderContext, {List<UnlinkedPublicNameBuilder> names, List<UnlinkedExportBuil der> exports, List<UnlinkedPartBuilder> parts}) { 1859 UnlinkedPublicNamespaceBuilder encodeUnlinkedPublicNamespace(base.BuilderContext builderContext, {List<UnlinkedPublicNameBuilder> names, List<UnlinkedExportBuil der> exports, List<UnlinkedPartBuilder> parts}) {
1283 UnlinkedPublicNamespaceBuilder builder = new UnlinkedPublicNamespaceBuilder(bu ilderContext); 1860 UnlinkedPublicNamespaceBuilder builder = new UnlinkedPublicNamespaceBuilder(bu ilderContext);
1284 builder.names = names; 1861 builder.names = names;
1285 builder.exports = exports; 1862 builder.exports = exports;
1286 builder.parts = parts; 1863 builder.parts = parts;
1287 return builder; 1864 return builder;
1288 } 1865 }
1289 1866
1867 /**
1868 * Unlinked summary information about a name referred to in one library that
1869 * might be defined in another.
1870 */
1290 class UnlinkedReference extends base.SummaryClass { 1871 class UnlinkedReference extends base.SummaryClass {
1291 String _name; 1872 String _name;
1292 int _prefixReference; 1873 int _prefixReference;
1293 1874
1294 UnlinkedReference.fromJson(Map json) 1875 UnlinkedReference.fromJson(Map json)
1295 : _name = json["name"], 1876 : _name = json["name"],
1296 _prefixReference = json["prefixReference"]; 1877 _prefixReference = json["prefixReference"];
1297 1878
1298 @override 1879 @override
1299 Map<String, Object> toMap() => { 1880 Map<String, Object> toMap() => {
1300 "name": name, 1881 "name": name,
1301 "prefixReference": prefixReference, 1882 "prefixReference": prefixReference,
1302 }; 1883 };
1303 1884
1885 /**
1886 * Name of the entity being referred to. The empty string refers to the
1887 * pseudo-type `dynamic`.
1888 */
1304 String get name => _name ?? ''; 1889 String get name => _name ?? '';
1890
1891 /**
1892 * Prefix used to refer to the entity, or zero if no prefix is used. This is
1893 * an index into [UnlinkedUnit.references].
1894 */
1305 int get prefixReference => _prefixReference ?? 0; 1895 int get prefixReference => _prefixReference ?? 0;
1306 } 1896 }
1307 1897
1308 class UnlinkedReferenceBuilder { 1898 class UnlinkedReferenceBuilder {
1309 final Map _json = {}; 1899 final Map _json = {};
1310 1900
1311 bool _finished = false; 1901 bool _finished = false;
1312 1902
1313 UnlinkedReferenceBuilder(base.BuilderContext context); 1903 UnlinkedReferenceBuilder(base.BuilderContext context);
1314 1904
1905 /**
1906 * Name of the entity being referred to. The empty string refers to the
1907 * pseudo-type `dynamic`.
1908 */
1315 void set name(String _value) { 1909 void set name(String _value) {
1316 assert(!_finished); 1910 assert(!_finished);
1317 assert(!_json.containsKey("name")); 1911 assert(!_json.containsKey("name"));
1318 if (_value != null) { 1912 if (_value != null) {
1319 _json["name"] = _value; 1913 _json["name"] = _value;
1320 } 1914 }
1321 } 1915 }
1322 1916
1917 /**
1918 * Prefix used to refer to the entity, or zero if no prefix is used. This is
1919 * an index into [UnlinkedUnit.references].
1920 */
1323 void set prefixReference(int _value) { 1921 void set prefixReference(int _value) {
1324 assert(!_finished); 1922 assert(!_finished);
1325 assert(!_json.containsKey("prefixReference")); 1923 assert(!_json.containsKey("prefixReference"));
1326 if (_value != null) { 1924 if (_value != null) {
1327 _json["prefixReference"] = _value; 1925 _json["prefixReference"] = _value;
1328 } 1926 }
1329 } 1927 }
1330 1928
1331 Map finish() { 1929 Map finish() {
1332 assert(!_finished); 1930 assert(!_finished);
1333 _finished = true; 1931 _finished = true;
1334 return _json; 1932 return _json;
1335 } 1933 }
1336 } 1934 }
1337 1935
1338 UnlinkedReferenceBuilder encodeUnlinkedReference(base.BuilderContext builderCont ext, {String name, int prefixReference}) { 1936 UnlinkedReferenceBuilder encodeUnlinkedReference(base.BuilderContext builderCont ext, {String name, int prefixReference}) {
1339 UnlinkedReferenceBuilder builder = new UnlinkedReferenceBuilder(builderContext ); 1937 UnlinkedReferenceBuilder builder = new UnlinkedReferenceBuilder(builderContext );
1340 builder.name = name; 1938 builder.name = name;
1341 builder.prefixReference = prefixReference; 1939 builder.prefixReference = prefixReference;
1342 return builder; 1940 return builder;
1343 } 1941 }
1344 1942
1943 /**
1944 * Unlinked summary information about a typedef declaration.
1945 */
1345 class UnlinkedTypedef extends base.SummaryClass { 1946 class UnlinkedTypedef extends base.SummaryClass {
1346 String _name; 1947 String _name;
1347 List<UnlinkedTypeParam> _typeParameters; 1948 List<UnlinkedTypeParam> _typeParameters;
1348 UnlinkedTypeRef _returnType; 1949 UnlinkedTypeRef _returnType;
1349 List<UnlinkedParam> _parameters; 1950 List<UnlinkedParam> _parameters;
1350 1951
1351 UnlinkedTypedef.fromJson(Map json) 1952 UnlinkedTypedef.fromJson(Map json)
1352 : _name = json["name"], 1953 : _name = json["name"],
1353 _typeParameters = json["typeParameters"]?.map((x) => new UnlinkedTypeParam .fromJson(x))?.toList(), 1954 _typeParameters = json["typeParameters"]?.map((x) => new UnlinkedTypeParam .fromJson(x))?.toList(),
1354 _returnType = json["returnType"] == null ? null : new UnlinkedTypeRef.from Json(json["returnType"]), 1955 _returnType = json["returnType"] == null ? null : new UnlinkedTypeRef.from Json(json["returnType"]),
1355 _parameters = json["parameters"]?.map((x) => new UnlinkedParam.fromJson(x) )?.toList(); 1956 _parameters = json["parameters"]?.map((x) => new UnlinkedParam.fromJson(x) )?.toList();
1356 1957
1357 @override 1958 @override
1358 Map<String, Object> toMap() => { 1959 Map<String, Object> toMap() => {
1359 "name": name, 1960 "name": name,
1360 "typeParameters": typeParameters, 1961 "typeParameters": typeParameters,
1361 "returnType": returnType, 1962 "returnType": returnType,
1362 "parameters": parameters, 1963 "parameters": parameters,
1363 }; 1964 };
1364 1965
1966 /**
1967 * Name of the typedef.
1968 */
1365 String get name => _name ?? ''; 1969 String get name => _name ?? '';
1970
1971 /**
1972 * Type parameters of the typedef, if any.
1973 */
1366 List<UnlinkedTypeParam> get typeParameters => _typeParameters ?? const <Unlink edTypeParam>[]; 1974 List<UnlinkedTypeParam> get typeParameters => _typeParameters ?? const <Unlink edTypeParam>[];
1975
1976 /**
1977 * Return type of the typedef. Absent if the return type is `void`.
1978 */
1367 UnlinkedTypeRef get returnType => _returnType; 1979 UnlinkedTypeRef get returnType => _returnType;
1980
1981 /**
1982 * Parameters of the executable, if any.
1983 */
1368 List<UnlinkedParam> get parameters => _parameters ?? const <UnlinkedParam>[]; 1984 List<UnlinkedParam> get parameters => _parameters ?? const <UnlinkedParam>[];
1369 } 1985 }
1370 1986
1371 class UnlinkedTypedefBuilder { 1987 class UnlinkedTypedefBuilder {
1372 final Map _json = {}; 1988 final Map _json = {};
1373 1989
1374 bool _finished = false; 1990 bool _finished = false;
1375 1991
1376 UnlinkedTypedefBuilder(base.BuilderContext context); 1992 UnlinkedTypedefBuilder(base.BuilderContext context);
1377 1993
1994 /**
1995 * Name of the typedef.
1996 */
1378 void set name(String _value) { 1997 void set name(String _value) {
1379 assert(!_finished); 1998 assert(!_finished);
1380 assert(!_json.containsKey("name")); 1999 assert(!_json.containsKey("name"));
1381 if (_value != null) { 2000 if (_value != null) {
1382 _json["name"] = _value; 2001 _json["name"] = _value;
1383 } 2002 }
1384 } 2003 }
1385 2004
2005 /**
2006 * Type parameters of the typedef, if any.
2007 */
1386 void set typeParameters(List<UnlinkedTypeParamBuilder> _value) { 2008 void set typeParameters(List<UnlinkedTypeParamBuilder> _value) {
1387 assert(!_finished); 2009 assert(!_finished);
1388 assert(!_json.containsKey("typeParameters")); 2010 assert(!_json.containsKey("typeParameters"));
1389 if (!(_value == null || _value.isEmpty)) { 2011 if (!(_value == null || _value.isEmpty)) {
1390 _json["typeParameters"] = _value.map((b) => b.finish()).toList(); 2012 _json["typeParameters"] = _value.map((b) => b.finish()).toList();
1391 } 2013 }
1392 } 2014 }
1393 2015
2016 /**
2017 * Return type of the typedef. Absent if the return type is `void`.
2018 */
1394 void set returnType(UnlinkedTypeRefBuilder _value) { 2019 void set returnType(UnlinkedTypeRefBuilder _value) {
1395 assert(!_finished); 2020 assert(!_finished);
1396 assert(!_json.containsKey("returnType")); 2021 assert(!_json.containsKey("returnType"));
1397 if (_value != null) { 2022 if (_value != null) {
1398 _json["returnType"] = _value.finish(); 2023 _json["returnType"] = _value.finish();
1399 } 2024 }
1400 } 2025 }
1401 2026
2027 /**
2028 * Parameters of the executable, if any.
2029 */
1402 void set parameters(List<UnlinkedParamBuilder> _value) { 2030 void set parameters(List<UnlinkedParamBuilder> _value) {
1403 assert(!_finished); 2031 assert(!_finished);
1404 assert(!_json.containsKey("parameters")); 2032 assert(!_json.containsKey("parameters"));
1405 if (!(_value == null || _value.isEmpty)) { 2033 if (!(_value == null || _value.isEmpty)) {
1406 _json["parameters"] = _value.map((b) => b.finish()).toList(); 2034 _json["parameters"] = _value.map((b) => b.finish()).toList();
1407 } 2035 }
1408 } 2036 }
1409 2037
1410 Map finish() { 2038 Map finish() {
1411 assert(!_finished); 2039 assert(!_finished);
1412 _finished = true; 2040 _finished = true;
1413 return _json; 2041 return _json;
1414 } 2042 }
1415 } 2043 }
1416 2044
1417 UnlinkedTypedefBuilder encodeUnlinkedTypedef(base.BuilderContext builderContext, {String name, List<UnlinkedTypeParamBuilder> typeParameters, UnlinkedTypeRefBui lder returnType, List<UnlinkedParamBuilder> parameters}) { 2045 UnlinkedTypedefBuilder encodeUnlinkedTypedef(base.BuilderContext builderContext, {String name, List<UnlinkedTypeParamBuilder> typeParameters, UnlinkedTypeRefBui lder returnType, List<UnlinkedParamBuilder> parameters}) {
1418 UnlinkedTypedefBuilder builder = new UnlinkedTypedefBuilder(builderContext); 2046 UnlinkedTypedefBuilder builder = new UnlinkedTypedefBuilder(builderContext);
1419 builder.name = name; 2047 builder.name = name;
1420 builder.typeParameters = typeParameters; 2048 builder.typeParameters = typeParameters;
1421 builder.returnType = returnType; 2049 builder.returnType = returnType;
1422 builder.parameters = parameters; 2050 builder.parameters = parameters;
1423 return builder; 2051 return builder;
1424 } 2052 }
1425 2053
2054 /**
2055 * Unlinked summary information about a type parameter declaration.
2056 */
1426 class UnlinkedTypeParam extends base.SummaryClass { 2057 class UnlinkedTypeParam extends base.SummaryClass {
1427 String _name; 2058 String _name;
1428 UnlinkedTypeRef _bound; 2059 UnlinkedTypeRef _bound;
1429 2060
1430 UnlinkedTypeParam.fromJson(Map json) 2061 UnlinkedTypeParam.fromJson(Map json)
1431 : _name = json["name"], 2062 : _name = json["name"],
1432 _bound = json["bound"] == null ? null : new UnlinkedTypeRef.fromJson(json[ "bound"]); 2063 _bound = json["bound"] == null ? null : new UnlinkedTypeRef.fromJson(json[ "bound"]);
1433 2064
1434 @override 2065 @override
1435 Map<String, Object> toMap() => { 2066 Map<String, Object> toMap() => {
1436 "name": name, 2067 "name": name,
1437 "bound": bound, 2068 "bound": bound,
1438 }; 2069 };
1439 2070
2071 /**
2072 * Name of the type parameter.
2073 */
1440 String get name => _name ?? ''; 2074 String get name => _name ?? '';
2075
2076 /**
2077 * Bound of the type parameter, if a bound is explicitly declared. Otherwise
2078 * null.
2079 */
1441 UnlinkedTypeRef get bound => _bound; 2080 UnlinkedTypeRef get bound => _bound;
1442 } 2081 }
1443 2082
1444 class UnlinkedTypeParamBuilder { 2083 class UnlinkedTypeParamBuilder {
1445 final Map _json = {}; 2084 final Map _json = {};
1446 2085
1447 bool _finished = false; 2086 bool _finished = false;
1448 2087
1449 UnlinkedTypeParamBuilder(base.BuilderContext context); 2088 UnlinkedTypeParamBuilder(base.BuilderContext context);
1450 2089
2090 /**
2091 * Name of the type parameter.
2092 */
1451 void set name(String _value) { 2093 void set name(String _value) {
1452 assert(!_finished); 2094 assert(!_finished);
1453 assert(!_json.containsKey("name")); 2095 assert(!_json.containsKey("name"));
1454 if (_value != null) { 2096 if (_value != null) {
1455 _json["name"] = _value; 2097 _json["name"] = _value;
1456 } 2098 }
1457 } 2099 }
1458 2100
2101 /**
2102 * Bound of the type parameter, if a bound is explicitly declared. Otherwise
2103 * null.
2104 */
1459 void set bound(UnlinkedTypeRefBuilder _value) { 2105 void set bound(UnlinkedTypeRefBuilder _value) {
1460 assert(!_finished); 2106 assert(!_finished);
1461 assert(!_json.containsKey("bound")); 2107 assert(!_json.containsKey("bound"));
1462 if (_value != null) { 2108 if (_value != null) {
1463 _json["bound"] = _value.finish(); 2109 _json["bound"] = _value.finish();
1464 } 2110 }
1465 } 2111 }
1466 2112
1467 Map finish() { 2113 Map finish() {
1468 assert(!_finished); 2114 assert(!_finished);
1469 _finished = true; 2115 _finished = true;
1470 return _json; 2116 return _json;
1471 } 2117 }
1472 } 2118 }
1473 2119
1474 UnlinkedTypeParamBuilder encodeUnlinkedTypeParam(base.BuilderContext builderCont ext, {String name, UnlinkedTypeRefBuilder bound}) { 2120 UnlinkedTypeParamBuilder encodeUnlinkedTypeParam(base.BuilderContext builderCont ext, {String name, UnlinkedTypeRefBuilder bound}) {
1475 UnlinkedTypeParamBuilder builder = new UnlinkedTypeParamBuilder(builderContext ); 2121 UnlinkedTypeParamBuilder builder = new UnlinkedTypeParamBuilder(builderContext );
1476 builder.name = name; 2122 builder.name = name;
1477 builder.bound = bound; 2123 builder.bound = bound;
1478 return builder; 2124 return builder;
1479 } 2125 }
1480 2126
2127 /**
2128 * Unlinked summary information about a reference to a type.
2129 */
1481 class UnlinkedTypeRef extends base.SummaryClass { 2130 class UnlinkedTypeRef extends base.SummaryClass {
1482 int _reference; 2131 int _reference;
1483 int _paramReference; 2132 int _paramReference;
1484 List<UnlinkedTypeRef> _typeArguments; 2133 List<UnlinkedTypeRef> _typeArguments;
1485 2134
1486 UnlinkedTypeRef.fromJson(Map json) 2135 UnlinkedTypeRef.fromJson(Map json)
1487 : _reference = json["reference"], 2136 : _reference = json["reference"],
1488 _paramReference = json["paramReference"], 2137 _paramReference = json["paramReference"],
1489 _typeArguments = json["typeArguments"]?.map((x) => new UnlinkedTypeRef.fro mJson(x))?.toList(); 2138 _typeArguments = json["typeArguments"]?.map((x) => new UnlinkedTypeRef.fro mJson(x))?.toList();
1490 2139
1491 @override 2140 @override
1492 Map<String, Object> toMap() => { 2141 Map<String, Object> toMap() => {
1493 "reference": reference, 2142 "reference": reference,
1494 "paramReference": paramReference, 2143 "paramReference": paramReference,
1495 "typeArguments": typeArguments, 2144 "typeArguments": typeArguments,
1496 }; 2145 };
1497 2146
2147 /**
2148 * Index into [UnlinkedUnit.references] for the type being referred to, or
2149 * zero if this is a reference to a type parameter.
2150 *
2151 * Note that since zero is also a valid index into
2152 * [UnlinkedUnit.references], we cannot distinguish between references to
2153 * type parameters and references to types by checking [reference] against
2154 * zero. To distinguish between references to type parameters and references
2155 * to types, check whether [paramReference] is zero.
2156 */
1498 int get reference => _reference ?? 0; 2157 int get reference => _reference ?? 0;
2158
2159 /**
2160 * If this is a reference to a type parameter, one-based index into the list
2161 * of [UnlinkedTypeParam]s currently in effect. Indexing is done using De
2162 * Bruijn index conventions; that is, innermost parameters come first, and
2163 * if a class or method has multiple parameters, they are indexed from right
2164 * to left. So for instance, if the enclosing declaration is
2165 *
2166 * class C<T,U> {
2167 * m<V,W> {
2168 * ...
2169 * }
2170 * }
2171 *
2172 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T,
2173 * respectively.
2174 *
2175 * If the type being referred to is not a type parameter, [paramReference] is
2176 * zero.
2177 */
1499 int get paramReference => _paramReference ?? 0; 2178 int get paramReference => _paramReference ?? 0;
2179
2180 /**
2181 * If this is an instantiation of a generic type, the type arguments used to
2182 * instantiate it. Trailing type arguments of type `dynamic` are omitted.
2183 */
1500 List<UnlinkedTypeRef> get typeArguments => _typeArguments ?? const <UnlinkedTy peRef>[]; 2184 List<UnlinkedTypeRef> get typeArguments => _typeArguments ?? const <UnlinkedTy peRef>[];
1501 } 2185 }
1502 2186
1503 class UnlinkedTypeRefBuilder { 2187 class UnlinkedTypeRefBuilder {
1504 final Map _json = {}; 2188 final Map _json = {};
1505 2189
1506 bool _finished = false; 2190 bool _finished = false;
1507 2191
1508 UnlinkedTypeRefBuilder(base.BuilderContext context); 2192 UnlinkedTypeRefBuilder(base.BuilderContext context);
1509 2193
2194 /**
2195 * Index into [UnlinkedUnit.references] for the type being referred to, or
2196 * zero if this is a reference to a type parameter.
2197 *
2198 * Note that since zero is also a valid index into
2199 * [UnlinkedUnit.references], we cannot distinguish between references to
2200 * type parameters and references to types by checking [reference] against
2201 * zero. To distinguish between references to type parameters and references
2202 * to types, check whether [paramReference] is zero.
2203 */
1510 void set reference(int _value) { 2204 void set reference(int _value) {
1511 assert(!_finished); 2205 assert(!_finished);
1512 assert(!_json.containsKey("reference")); 2206 assert(!_json.containsKey("reference"));
1513 if (_value != null) { 2207 if (_value != null) {
1514 _json["reference"] = _value; 2208 _json["reference"] = _value;
1515 } 2209 }
1516 } 2210 }
1517 2211
2212 /**
2213 * If this is a reference to a type parameter, one-based index into the list
2214 * of [UnlinkedTypeParam]s currently in effect. Indexing is done using De
2215 * Bruijn index conventions; that is, innermost parameters come first, and
2216 * if a class or method has multiple parameters, they are indexed from right
2217 * to left. So for instance, if the enclosing declaration is
2218 *
2219 * class C<T,U> {
2220 * m<V,W> {
2221 * ...
2222 * }
2223 * }
2224 *
2225 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T,
2226 * respectively.
2227 *
2228 * If the type being referred to is not a type parameter, [paramReference] is
2229 * zero.
2230 */
1518 void set paramReference(int _value) { 2231 void set paramReference(int _value) {
1519 assert(!_finished); 2232 assert(!_finished);
1520 assert(!_json.containsKey("paramReference")); 2233 assert(!_json.containsKey("paramReference"));
1521 if (_value != null) { 2234 if (_value != null) {
1522 _json["paramReference"] = _value; 2235 _json["paramReference"] = _value;
1523 } 2236 }
1524 } 2237 }
1525 2238
2239 /**
2240 * If this is an instantiation of a generic type, the type arguments used to
2241 * instantiate it. Trailing type arguments of type `dynamic` are omitted.
2242 */
1526 void set typeArguments(List<UnlinkedTypeRefBuilder> _value) { 2243 void set typeArguments(List<UnlinkedTypeRefBuilder> _value) {
1527 assert(!_finished); 2244 assert(!_finished);
1528 assert(!_json.containsKey("typeArguments")); 2245 assert(!_json.containsKey("typeArguments"));
1529 if (!(_value == null || _value.isEmpty)) { 2246 if (!(_value == null || _value.isEmpty)) {
1530 _json["typeArguments"] = _value.map((b) => b.finish()).toList(); 2247 _json["typeArguments"] = _value.map((b) => b.finish()).toList();
1531 } 2248 }
1532 } 2249 }
1533 2250
1534 Map finish() { 2251 Map finish() {
1535 assert(!_finished); 2252 assert(!_finished);
1536 _finished = true; 2253 _finished = true;
1537 return _json; 2254 return _json;
1538 } 2255 }
1539 } 2256 }
1540 2257
1541 UnlinkedTypeRefBuilder encodeUnlinkedTypeRef(base.BuilderContext builderContext, {int reference, int paramReference, List<UnlinkedTypeRefBuilder> typeArguments} ) { 2258 UnlinkedTypeRefBuilder encodeUnlinkedTypeRef(base.BuilderContext builderContext, {int reference, int paramReference, List<UnlinkedTypeRefBuilder> typeArguments} ) {
1542 UnlinkedTypeRefBuilder builder = new UnlinkedTypeRefBuilder(builderContext); 2259 UnlinkedTypeRefBuilder builder = new UnlinkedTypeRefBuilder(builderContext);
1543 builder.reference = reference; 2260 builder.reference = reference;
1544 builder.paramReference = paramReference; 2261 builder.paramReference = paramReference;
1545 builder.typeArguments = typeArguments; 2262 builder.typeArguments = typeArguments;
1546 return builder; 2263 return builder;
1547 } 2264 }
1548 2265
2266 /**
2267 * Unlinked summary information about a compilation unit ("part file").
2268 */
1549 class UnlinkedUnit extends base.SummaryClass { 2269 class UnlinkedUnit extends base.SummaryClass {
1550 String _libraryName; 2270 String _libraryName;
1551 UnlinkedPublicNamespace _publicNamespace; 2271 UnlinkedPublicNamespace _publicNamespace;
1552 List<UnlinkedReference> _references; 2272 List<UnlinkedReference> _references;
1553 List<UnlinkedClass> _classes; 2273 List<UnlinkedClass> _classes;
1554 List<UnlinkedEnum> _enums; 2274 List<UnlinkedEnum> _enums;
1555 List<UnlinkedExecutable> _executables; 2275 List<UnlinkedExecutable> _executables;
1556 List<UnlinkedImport> _imports; 2276 List<UnlinkedImport> _imports;
1557 List<UnlinkedTypedef> _typedefs; 2277 List<UnlinkedTypedef> _typedefs;
1558 List<UnlinkedVariable> _variables; 2278 List<UnlinkedVariable> _variables;
(...skipping 17 matching lines...) Expand all
1576 "classes": classes, 2296 "classes": classes,
1577 "enums": enums, 2297 "enums": enums,
1578 "executables": executables, 2298 "executables": executables,
1579 "imports": imports, 2299 "imports": imports,
1580 "typedefs": typedefs, 2300 "typedefs": typedefs,
1581 "variables": variables, 2301 "variables": variables,
1582 }; 2302 };
1583 2303
1584 UnlinkedUnit.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8.dec ode(buffer))); 2304 UnlinkedUnit.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8.dec ode(buffer)));
1585 2305
2306 /**
2307 * Name of the library (from a "library" declaration, if present).
2308 */
1586 String get libraryName => _libraryName ?? ''; 2309 String get libraryName => _libraryName ?? '';
2310
2311 /**
2312 * Unlinked public namespace of this compilation unit.
2313 */
1587 UnlinkedPublicNamespace get publicNamespace => _publicNamespace; 2314 UnlinkedPublicNamespace get publicNamespace => _publicNamespace;
2315
2316 /**
2317 * Top level and prefixed names referred to by this compilation unit. The
2318 * zeroth element of this array is always populated and always represents a
2319 * reference to the pseudo-type "dynamic".
2320 */
1588 List<UnlinkedReference> get references => _references ?? const <UnlinkedRefere nce>[]; 2321 List<UnlinkedReference> get references => _references ?? const <UnlinkedRefere nce>[];
2322
2323 /**
2324 * Classes declared in the compilation unit.
2325 */
1589 List<UnlinkedClass> get classes => _classes ?? const <UnlinkedClass>[]; 2326 List<UnlinkedClass> get classes => _classes ?? const <UnlinkedClass>[];
2327
2328 /**
2329 * Enums declared in the compilation unit.
2330 */
1590 List<UnlinkedEnum> get enums => _enums ?? const <UnlinkedEnum>[]; 2331 List<UnlinkedEnum> get enums => _enums ?? const <UnlinkedEnum>[];
2332
2333 /**
2334 * Top level executable objects (functions, getters, and setters) declared in
2335 * the compilation unit.
2336 */
1591 List<UnlinkedExecutable> get executables => _executables ?? const <UnlinkedExe cutable>[]; 2337 List<UnlinkedExecutable> get executables => _executables ?? const <UnlinkedExe cutable>[];
2338
2339 /**
2340 * Import declarations in the compilation unit.
2341 */
1592 List<UnlinkedImport> get imports => _imports ?? const <UnlinkedImport>[]; 2342 List<UnlinkedImport> get imports => _imports ?? const <UnlinkedImport>[];
2343
2344 /**
2345 * Typedefs declared in the compilation unit.
2346 */
1593 List<UnlinkedTypedef> get typedefs => _typedefs ?? const <UnlinkedTypedef>[]; 2347 List<UnlinkedTypedef> get typedefs => _typedefs ?? const <UnlinkedTypedef>[];
2348
2349 /**
2350 * Top level variables declared in the compilation unit.
2351 */
1594 List<UnlinkedVariable> get variables => _variables ?? const <UnlinkedVariable> []; 2352 List<UnlinkedVariable> get variables => _variables ?? const <UnlinkedVariable> [];
1595 } 2353 }
1596 2354
1597 class UnlinkedUnitBuilder { 2355 class UnlinkedUnitBuilder {
1598 final Map _json = {}; 2356 final Map _json = {};
1599 2357
1600 bool _finished = false; 2358 bool _finished = false;
1601 2359
1602 UnlinkedUnitBuilder(base.BuilderContext context); 2360 UnlinkedUnitBuilder(base.BuilderContext context);
1603 2361
2362 /**
2363 * Name of the library (from a "library" declaration, if present).
2364 */
1604 void set libraryName(String _value) { 2365 void set libraryName(String _value) {
1605 assert(!_finished); 2366 assert(!_finished);
1606 assert(!_json.containsKey("libraryName")); 2367 assert(!_json.containsKey("libraryName"));
1607 if (_value != null) { 2368 if (_value != null) {
1608 _json["libraryName"] = _value; 2369 _json["libraryName"] = _value;
1609 } 2370 }
1610 } 2371 }
1611 2372
2373 /**
2374 * Unlinked public namespace of this compilation unit.
2375 */
1612 void set publicNamespace(UnlinkedPublicNamespaceBuilder _value) { 2376 void set publicNamespace(UnlinkedPublicNamespaceBuilder _value) {
1613 assert(!_finished); 2377 assert(!_finished);
1614 assert(!_json.containsKey("publicNamespace")); 2378 assert(!_json.containsKey("publicNamespace"));
1615 if (_value != null) { 2379 if (_value != null) {
1616 _json["publicNamespace"] = _value.finish(); 2380 _json["publicNamespace"] = _value.finish();
1617 } 2381 }
1618 } 2382 }
1619 2383
2384 /**
2385 * Top level and prefixed names referred to by this compilation unit. The
2386 * zeroth element of this array is always populated and always represents a
2387 * reference to the pseudo-type "dynamic".
2388 */
1620 void set references(List<UnlinkedReferenceBuilder> _value) { 2389 void set references(List<UnlinkedReferenceBuilder> _value) {
1621 assert(!_finished); 2390 assert(!_finished);
1622 assert(!_json.containsKey("references")); 2391 assert(!_json.containsKey("references"));
1623 if (!(_value == null || _value.isEmpty)) { 2392 if (!(_value == null || _value.isEmpty)) {
1624 _json["references"] = _value.map((b) => b.finish()).toList(); 2393 _json["references"] = _value.map((b) => b.finish()).toList();
1625 } 2394 }
1626 } 2395 }
1627 2396
2397 /**
2398 * Classes declared in the compilation unit.
2399 */
1628 void set classes(List<UnlinkedClassBuilder> _value) { 2400 void set classes(List<UnlinkedClassBuilder> _value) {
1629 assert(!_finished); 2401 assert(!_finished);
1630 assert(!_json.containsKey("classes")); 2402 assert(!_json.containsKey("classes"));
1631 if (!(_value == null || _value.isEmpty)) { 2403 if (!(_value == null || _value.isEmpty)) {
1632 _json["classes"] = _value.map((b) => b.finish()).toList(); 2404 _json["classes"] = _value.map((b) => b.finish()).toList();
1633 } 2405 }
1634 } 2406 }
1635 2407
2408 /**
2409 * Enums declared in the compilation unit.
2410 */
1636 void set enums(List<UnlinkedEnumBuilder> _value) { 2411 void set enums(List<UnlinkedEnumBuilder> _value) {
1637 assert(!_finished); 2412 assert(!_finished);
1638 assert(!_json.containsKey("enums")); 2413 assert(!_json.containsKey("enums"));
1639 if (!(_value == null || _value.isEmpty)) { 2414 if (!(_value == null || _value.isEmpty)) {
1640 _json["enums"] = _value.map((b) => b.finish()).toList(); 2415 _json["enums"] = _value.map((b) => b.finish()).toList();
1641 } 2416 }
1642 } 2417 }
1643 2418
2419 /**
2420 * Top level executable objects (functions, getters, and setters) declared in
2421 * the compilation unit.
2422 */
1644 void set executables(List<UnlinkedExecutableBuilder> _value) { 2423 void set executables(List<UnlinkedExecutableBuilder> _value) {
1645 assert(!_finished); 2424 assert(!_finished);
1646 assert(!_json.containsKey("executables")); 2425 assert(!_json.containsKey("executables"));
1647 if (!(_value == null || _value.isEmpty)) { 2426 if (!(_value == null || _value.isEmpty)) {
1648 _json["executables"] = _value.map((b) => b.finish()).toList(); 2427 _json["executables"] = _value.map((b) => b.finish()).toList();
1649 } 2428 }
1650 } 2429 }
1651 2430
2431 /**
2432 * Import declarations in the compilation unit.
2433 */
1652 void set imports(List<UnlinkedImportBuilder> _value) { 2434 void set imports(List<UnlinkedImportBuilder> _value) {
1653 assert(!_finished); 2435 assert(!_finished);
1654 assert(!_json.containsKey("imports")); 2436 assert(!_json.containsKey("imports"));
1655 if (!(_value == null || _value.isEmpty)) { 2437 if (!(_value == null || _value.isEmpty)) {
1656 _json["imports"] = _value.map((b) => b.finish()).toList(); 2438 _json["imports"] = _value.map((b) => b.finish()).toList();
1657 } 2439 }
1658 } 2440 }
1659 2441
2442 /**
2443 * Typedefs declared in the compilation unit.
2444 */
1660 void set typedefs(List<UnlinkedTypedefBuilder> _value) { 2445 void set typedefs(List<UnlinkedTypedefBuilder> _value) {
1661 assert(!_finished); 2446 assert(!_finished);
1662 assert(!_json.containsKey("typedefs")); 2447 assert(!_json.containsKey("typedefs"));
1663 if (!(_value == null || _value.isEmpty)) { 2448 if (!(_value == null || _value.isEmpty)) {
1664 _json["typedefs"] = _value.map((b) => b.finish()).toList(); 2449 _json["typedefs"] = _value.map((b) => b.finish()).toList();
1665 } 2450 }
1666 } 2451 }
1667 2452
2453 /**
2454 * Top level variables declared in the compilation unit.
2455 */
1668 void set variables(List<UnlinkedVariableBuilder> _value) { 2456 void set variables(List<UnlinkedVariableBuilder> _value) {
1669 assert(!_finished); 2457 assert(!_finished);
1670 assert(!_json.containsKey("variables")); 2458 assert(!_json.containsKey("variables"));
1671 if (!(_value == null || _value.isEmpty)) { 2459 if (!(_value == null || _value.isEmpty)) {
1672 _json["variables"] = _value.map((b) => b.finish()).toList(); 2460 _json["variables"] = _value.map((b) => b.finish()).toList();
1673 } 2461 }
1674 } 2462 }
1675 2463
1676 List<int> toBuffer() => UTF8.encode(JSON.encode(finish())); 2464 List<int> toBuffer() => UTF8.encode(JSON.encode(finish()));
1677 2465
(...skipping 11 matching lines...) Expand all
1689 builder.references = references; 2477 builder.references = references;
1690 builder.classes = classes; 2478 builder.classes = classes;
1691 builder.enums = enums; 2479 builder.enums = enums;
1692 builder.executables = executables; 2480 builder.executables = executables;
1693 builder.imports = imports; 2481 builder.imports = imports;
1694 builder.typedefs = typedefs; 2482 builder.typedefs = typedefs;
1695 builder.variables = variables; 2483 builder.variables = variables;
1696 return builder; 2484 return builder;
1697 } 2485 }
1698 2486
2487 /**
2488 * Unlinked summary information about a top level variable, local variable, or
2489 * a field.
2490 */
1699 class UnlinkedVariable extends base.SummaryClass { 2491 class UnlinkedVariable extends base.SummaryClass {
1700 String _name; 2492 String _name;
1701 UnlinkedTypeRef _type; 2493 UnlinkedTypeRef _type;
1702 bool _isStatic; 2494 bool _isStatic;
1703 bool _isFinal; 2495 bool _isFinal;
1704 bool _isConst; 2496 bool _isConst;
1705 bool _hasImplicitType; 2497 bool _hasImplicitType;
1706 2498
1707 UnlinkedVariable.fromJson(Map json) 2499 UnlinkedVariable.fromJson(Map json)
1708 : _name = json["name"], 2500 : _name = json["name"],
1709 _type = json["type"] == null ? null : new UnlinkedTypeRef.fromJson(json["t ype"]), 2501 _type = json["type"] == null ? null : new UnlinkedTypeRef.fromJson(json["t ype"]),
1710 _isStatic = json["isStatic"], 2502 _isStatic = json["isStatic"],
1711 _isFinal = json["isFinal"], 2503 _isFinal = json["isFinal"],
1712 _isConst = json["isConst"], 2504 _isConst = json["isConst"],
1713 _hasImplicitType = json["hasImplicitType"]; 2505 _hasImplicitType = json["hasImplicitType"];
1714 2506
1715 @override 2507 @override
1716 Map<String, Object> toMap() => { 2508 Map<String, Object> toMap() => {
1717 "name": name, 2509 "name": name,
1718 "type": type, 2510 "type": type,
1719 "isStatic": isStatic, 2511 "isStatic": isStatic,
1720 "isFinal": isFinal, 2512 "isFinal": isFinal,
1721 "isConst": isConst, 2513 "isConst": isConst,
1722 "hasImplicitType": hasImplicitType, 2514 "hasImplicitType": hasImplicitType,
1723 }; 2515 };
1724 2516
2517 /**
2518 * Name of the variable.
2519 */
1725 String get name => _name ?? ''; 2520 String get name => _name ?? '';
2521
2522 /**
2523 * Declared type of the variable. Note that when strong mode is enabled, the
2524 * actual type of the variable may be different due to type inference.
2525 */
1726 UnlinkedTypeRef get type => _type; 2526 UnlinkedTypeRef get type => _type;
2527
2528 /**
2529 * Indicates whether the variable is declared using the `static` keyword.
2530 *
2531 * Note that for top level variables, this flag is false, since they are not
2532 * declared using the `static` keyword (even though they are considered
2533 * static for semantic purposes).
2534 */
1727 bool get isStatic => _isStatic ?? false; 2535 bool get isStatic => _isStatic ?? false;
2536
2537 /**
2538 * Indicates whether the variable is declared using the `final` keyword.
2539 */
1728 bool get isFinal => _isFinal ?? false; 2540 bool get isFinal => _isFinal ?? false;
2541
2542 /**
2543 * Indicates whether the variable is declared using the `const` keyword.
2544 */
1729 bool get isConst => _isConst ?? false; 2545 bool get isConst => _isConst ?? false;
2546
2547 /**
2548 * Indicates whether this variable lacks an explicit type declaration.
2549 */
1730 bool get hasImplicitType => _hasImplicitType ?? false; 2550 bool get hasImplicitType => _hasImplicitType ?? false;
1731 } 2551 }
1732 2552
1733 class UnlinkedVariableBuilder { 2553 class UnlinkedVariableBuilder {
1734 final Map _json = {}; 2554 final Map _json = {};
1735 2555
1736 bool _finished = false; 2556 bool _finished = false;
1737 2557
1738 UnlinkedVariableBuilder(base.BuilderContext context); 2558 UnlinkedVariableBuilder(base.BuilderContext context);
1739 2559
2560 /**
2561 * Name of the variable.
2562 */
1740 void set name(String _value) { 2563 void set name(String _value) {
1741 assert(!_finished); 2564 assert(!_finished);
1742 assert(!_json.containsKey("name")); 2565 assert(!_json.containsKey("name"));
1743 if (_value != null) { 2566 if (_value != null) {
1744 _json["name"] = _value; 2567 _json["name"] = _value;
1745 } 2568 }
1746 } 2569 }
1747 2570
2571 /**
2572 * Declared type of the variable. Note that when strong mode is enabled, the
2573 * actual type of the variable may be different due to type inference.
2574 */
1748 void set type(UnlinkedTypeRefBuilder _value) { 2575 void set type(UnlinkedTypeRefBuilder _value) {
1749 assert(!_finished); 2576 assert(!_finished);
1750 assert(!_json.containsKey("type")); 2577 assert(!_json.containsKey("type"));
1751 if (_value != null) { 2578 if (_value != null) {
1752 _json["type"] = _value.finish(); 2579 _json["type"] = _value.finish();
1753 } 2580 }
1754 } 2581 }
1755 2582
2583 /**
2584 * Indicates whether the variable is declared using the `static` keyword.
2585 *
2586 * Note that for top level variables, this flag is false, since they are not
2587 * declared using the `static` keyword (even though they are considered
2588 * static for semantic purposes).
2589 */
1756 void set isStatic(bool _value) { 2590 void set isStatic(bool _value) {
1757 assert(!_finished); 2591 assert(!_finished);
1758 assert(!_json.containsKey("isStatic")); 2592 assert(!_json.containsKey("isStatic"));
1759 if (_value != null) { 2593 if (_value != null) {
1760 _json["isStatic"] = _value; 2594 _json["isStatic"] = _value;
1761 } 2595 }
1762 } 2596 }
1763 2597
2598 /**
2599 * Indicates whether the variable is declared using the `final` keyword.
2600 */
1764 void set isFinal(bool _value) { 2601 void set isFinal(bool _value) {
1765 assert(!_finished); 2602 assert(!_finished);
1766 assert(!_json.containsKey("isFinal")); 2603 assert(!_json.containsKey("isFinal"));
1767 if (_value != null) { 2604 if (_value != null) {
1768 _json["isFinal"] = _value; 2605 _json["isFinal"] = _value;
1769 } 2606 }
1770 } 2607 }
1771 2608
2609 /**
2610 * Indicates whether the variable is declared using the `const` keyword.
2611 */
1772 void set isConst(bool _value) { 2612 void set isConst(bool _value) {
1773 assert(!_finished); 2613 assert(!_finished);
1774 assert(!_json.containsKey("isConst")); 2614 assert(!_json.containsKey("isConst"));
1775 if (_value != null) { 2615 if (_value != null) {
1776 _json["isConst"] = _value; 2616 _json["isConst"] = _value;
1777 } 2617 }
1778 } 2618 }
1779 2619
2620 /**
2621 * Indicates whether this variable lacks an explicit type declaration.
2622 */
1780 void set hasImplicitType(bool _value) { 2623 void set hasImplicitType(bool _value) {
1781 assert(!_finished); 2624 assert(!_finished);
1782 assert(!_json.containsKey("hasImplicitType")); 2625 assert(!_json.containsKey("hasImplicitType"));
1783 if (_value != null) { 2626 if (_value != null) {
1784 _json["hasImplicitType"] = _value; 2627 _json["hasImplicitType"] = _value;
1785 } 2628 }
1786 } 2629 }
1787 2630
1788 Map finish() { 2631 Map finish() {
1789 assert(!_finished); 2632 assert(!_finished);
1790 _finished = true; 2633 _finished = true;
1791 return _json; 2634 return _json;
1792 } 2635 }
1793 } 2636 }
1794 2637
1795 UnlinkedVariableBuilder encodeUnlinkedVariable(base.BuilderContext builderContex t, {String name, UnlinkedTypeRefBuilder type, bool isStatic, bool isFinal, bool isConst, bool hasImplicitType}) { 2638 UnlinkedVariableBuilder encodeUnlinkedVariable(base.BuilderContext builderContex t, {String name, UnlinkedTypeRefBuilder type, bool isStatic, bool isFinal, bool isConst, bool hasImplicitType}) {
1796 UnlinkedVariableBuilder builder = new UnlinkedVariableBuilder(builderContext); 2639 UnlinkedVariableBuilder builder = new UnlinkedVariableBuilder(builderContext);
1797 builder.name = name; 2640 builder.name = name;
1798 builder.type = type; 2641 builder.type = type;
1799 builder.isStatic = isStatic; 2642 builder.isStatic = isStatic;
1800 builder.isFinal = isFinal; 2643 builder.isFinal = isFinal;
1801 builder.isConst = isConst; 2644 builder.isConst = isConst;
1802 builder.hasImplicitType = hasImplicitType; 2645 builder.hasImplicitType = hasImplicitType;
1803 return builder; 2646 return builder;
1804 } 2647 }
1805 2648
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/tool/summary/generate.dart » ('j') | pkg/analyzer/tool/summary/generate.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698