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

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

Issue 1589573003: Include the export namespace in the prelinked summary. (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 'base.dart' as base; 10 import 'base.dart' as base;
11 import 'flat_buffers.dart' as fb; 11 import 'flat_buffers.dart' as fb;
12 12
13 /** 13 /**
14 * Enum used to indicate the kind of entity referred to by a 14 * Enum used to indicate the kind of entity referred to by a
15 * [PrelinkedReference]. 15 * [PrelinkedReference].
16 */ 16 */
17 enum PrelinkedReferenceKind { 17 enum PrelinkedReferenceKind {
18 classOrEnum, 18 classOrEnum,
19 typedef, 19 typedef,
20 other, 20 topLevelFunction,
21 topLevelPropertyAccessor,
21 prefix, 22 prefix,
22 unresolved, 23 unresolved,
23 } 24 }
24 25
25 /** 26 /**
26 * Enum used to indicate the kind of an executable. 27 * Enum used to indicate the kind of an executable.
27 */ 28 */
28 enum UnlinkedExecutableKind { 29 enum UnlinkedExecutableKind {
29 functionOrMethod, 30 functionOrMethod,
30 getter, 31 getter,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 157 }
157 158
158 abstract class _PrelinkedDependencyMixin implements PrelinkedDependency { 159 abstract class _PrelinkedDependencyMixin implements PrelinkedDependency {
159 @override 160 @override
160 Map<String, Object> toMap() => { 161 Map<String, Object> toMap() => {
161 "uri": uri, 162 "uri": uri,
162 "parts": parts, 163 "parts": parts,
163 }; 164 };
164 } 165 }
165 166
167 class PrelinkedExportNameBuilder extends Object with _PrelinkedExportNameMixin i mplements PrelinkedExportName {
168 bool _finished = false;
169
170 String _name;
171 int _dependency;
172 int _unit;
173 PrelinkedReferenceKind _kind;
174
175 PrelinkedExportNameBuilder();
176
177 @override
178 String get name => _name ?? '';
179
180 /**
181 * Name of the exported entity. TODO(paulberry): do we include the trailing
182 * '=' for a setter?
183 */
184 void set name(String _value) {
185 assert(!_finished);
186 _name = _value;
187 }
188
189 @override
190 int get dependency => _dependency ?? 0;
191
192 /**
193 * Index into [PrelinkedLibrary.dependencies] for the library in which the
194 * entity is defined.
195 */
196 void set dependency(int _value) {
197 assert(!_finished);
198 _dependency = _value;
199 }
200
201 @override
202 int get unit => _unit ?? 0;
203
204 /**
205 * Integer index indicating which unit in the imported library contains the
206 * definition of the entity. As with indices into [PrelinkedLibrary.units],
207 * zero represents the defining compilation unit, and nonzero values
208 * represent parts in the order of the corresponding `part` declarations.
209 */
210 void set unit(int _value) {
211 assert(!_finished);
212 _unit = _value;
213 }
214
215 @override
216 PrelinkedReferenceKind get kind => _kind ?? PrelinkedReferenceKind.classOrEnum ;
217
218 /**
219 * The kind of the entity being referred to.
220 */
221 void set kind(PrelinkedReferenceKind _value) {
222 assert(!_finished);
223 _kind = _value;
224 }
225
226 fb.Offset finish(fb.Builder fbBuilder) {
227 assert(!_finished);
228 _finished = true;
229 fb.Offset offset_name;
230 if (_name != null) {
231 offset_name = fbBuilder.writeString(_name);
232 }
233 fbBuilder.startTable();
234 if (offset_name != null) {
235 fbBuilder.addOffset(0, offset_name);
236 }
237 if (_dependency != null && _dependency != 0) {
238 fbBuilder.addInt32(1, _dependency);
239 }
240 if (_unit != null && _unit != 0) {
241 fbBuilder.addInt32(2, _unit);
242 }
243 if (_kind != null && _kind != PrelinkedReferenceKind.classOrEnum) {
244 fbBuilder.addInt32(3, _kind.index);
245 }
246 return fbBuilder.endTable();
247 }
248 }
249
250 PrelinkedExportNameBuilder encodePrelinkedExportName({String name, int dependenc y, int unit, PrelinkedReferenceKind kind}) {
251 PrelinkedExportNameBuilder builder = new PrelinkedExportNameBuilder();
252 builder.name = name;
253 builder.dependency = dependency;
254 builder.unit = unit;
255 builder.kind = kind;
256 return builder;
257 }
258
259 /**
260 * Information about a single name in the export namespace of the library that
261 * is not in the public namespace.
262 */
263 abstract class PrelinkedExportName extends base.SummaryClass {
264
265 /**
266 * Name of the exported entity. TODO(paulberry): do we include the trailing
267 * '=' for a setter?
268 */
269 String get name;
270
271 /**
272 * Index into [PrelinkedLibrary.dependencies] for the library in which the
273 * entity is defined.
274 */
275 int get dependency;
276
277 /**
278 * Integer index indicating which unit in the imported library contains the
279 * definition of the entity. As with indices into [PrelinkedLibrary.units],
280 * zero represents the defining compilation unit, and nonzero values
281 * represent parts in the order of the corresponding `part` declarations.
282 */
283 int get unit;
284
285 /**
286 * The kind of the entity being referred to.
287 */
288 PrelinkedReferenceKind get kind;
289 }
290
291 class _PrelinkedExportNameReader extends fb.TableReader<_PrelinkedExportNameImpl > {
292 const _PrelinkedExportNameReader();
293
294 @override
295 _PrelinkedExportNameImpl createObject(fb.BufferPointer bp) => new _PrelinkedEx portNameImpl(bp);
296 }
297
298 class _PrelinkedExportNameImpl extends Object with _PrelinkedExportNameMixin imp lements PrelinkedExportName {
299 final fb.BufferPointer _bp;
300
301 _PrelinkedExportNameImpl(this._bp);
302
303 String _name;
304 int _dependency;
305 int _unit;
306 PrelinkedReferenceKind _kind;
307
308 @override
309 String get name {
310 _name ??= const fb.StringReader().vTableGet(_bp, 0, '');
311 return _name;
312 }
313
314 @override
315 int get dependency {
316 _dependency ??= const fb.Int32Reader().vTableGet(_bp, 1, 0);
317 return _dependency;
318 }
319
320 @override
321 int get unit {
322 _unit ??= const fb.Int32Reader().vTableGet(_bp, 2, 0);
323 return _unit;
324 }
325
326 @override
327 PrelinkedReferenceKind get kind {
328 _kind ??= PrelinkedReferenceKind.values[const fb.Int32Reader().vTableGet(_bp , 3, 0)];
329 return _kind;
330 }
331 }
332
333 abstract class _PrelinkedExportNameMixin implements PrelinkedExportName {
334 @override
335 Map<String, Object> toMap() => {
336 "name": name,
337 "dependency": dependency,
338 "unit": unit,
339 "kind": kind,
340 };
341 }
342
166 class PrelinkedLibraryBuilder extends Object with _PrelinkedLibraryMixin impleme nts PrelinkedLibrary { 343 class PrelinkedLibraryBuilder extends Object with _PrelinkedLibraryMixin impleme nts PrelinkedLibrary {
167 bool _finished = false; 344 bool _finished = false;
168 345
169 List<PrelinkedUnitBuilder> _units; 346 List<PrelinkedUnitBuilder> _units;
170 List<PrelinkedDependencyBuilder> _dependencies; 347 List<PrelinkedDependencyBuilder> _dependencies;
171 List<int> _importDependencies; 348 List<int> _importDependencies;
349 List<PrelinkedExportNameBuilder> _exportNames;
172 350
173 PrelinkedLibraryBuilder(); 351 PrelinkedLibraryBuilder();
174 352
175 @override 353 @override
176 List<PrelinkedUnit> get units => _units ?? const <PrelinkedUnit>[]; 354 List<PrelinkedUnit> get units => _units ?? const <PrelinkedUnit>[];
177 355
178 /** 356 /**
179 * The pre-linked summary of all the compilation units constituting the 357 * The pre-linked summary of all the compilation units constituting the
180 * library. The summary of the defining compilation unit is listed first, 358 * library. The summary of the defining compilation unit is listed first,
181 * followed by the summary of each part, in the order of the `part` 359 * followed by the summary of each part, in the order of the `part`
(...skipping 29 matching lines...) Expand all
211 * of the library being imported. 389 * of the library being imported.
212 * 390 *
213 * TODO(paulberry): if [dependencies] is removed, this can be removed as 391 * TODO(paulberry): if [dependencies] is removed, this can be removed as
214 * well, since there will effectively be a one-to-one mapping. 392 * well, since there will effectively be a one-to-one mapping.
215 */ 393 */
216 void set importDependencies(List<int> _value) { 394 void set importDependencies(List<int> _value) {
217 assert(!_finished); 395 assert(!_finished);
218 _importDependencies = _value; 396 _importDependencies = _value;
219 } 397 }
220 398
399 @override
400 List<PrelinkedExportName> get exportNames => _exportNames ?? const <PrelinkedE xportName>[];
401
402 /**
403 * Information about entities in the export namespace of the library that are
404 * not in the public namespace of the library (that is, entities that are
405 * brought into the namespace via `export` directives).
406 *
407 * Sorted by name.
408 */
409 void set exportNames(List<PrelinkedExportNameBuilder> _value) {
410 assert(!_finished);
411 _exportNames = _value;
412 }
413
221 List<int> toBuffer() { 414 List<int> toBuffer() {
222 fb.Builder fbBuilder = new fb.Builder(); 415 fb.Builder fbBuilder = new fb.Builder();
223 return fbBuilder.finish(finish(fbBuilder)); 416 return fbBuilder.finish(finish(fbBuilder));
224 } 417 }
225 418
226 fb.Offset finish(fb.Builder fbBuilder) { 419 fb.Offset finish(fb.Builder fbBuilder) {
227 assert(!_finished); 420 assert(!_finished);
228 _finished = true; 421 _finished = true;
229 fb.Offset offset_units; 422 fb.Offset offset_units;
230 fb.Offset offset_dependencies; 423 fb.Offset offset_dependencies;
231 fb.Offset offset_importDependencies; 424 fb.Offset offset_importDependencies;
425 fb.Offset offset_exportNames;
232 if (!(_units == null || _units.isEmpty)) { 426 if (!(_units == null || _units.isEmpty)) {
233 offset_units = fbBuilder.writeList(_units.map((b) => b.finish(fbBuilder)). toList()); 427 offset_units = fbBuilder.writeList(_units.map((b) => b.finish(fbBuilder)). toList());
234 } 428 }
235 if (!(_dependencies == null || _dependencies.isEmpty)) { 429 if (!(_dependencies == null || _dependencies.isEmpty)) {
236 offset_dependencies = fbBuilder.writeList(_dependencies.map((b) => b.finis h(fbBuilder)).toList()); 430 offset_dependencies = fbBuilder.writeList(_dependencies.map((b) => b.finis h(fbBuilder)).toList());
237 } 431 }
238 if (!(_importDependencies == null || _importDependencies.isEmpty)) { 432 if (!(_importDependencies == null || _importDependencies.isEmpty)) {
239 offset_importDependencies = fbBuilder.writeListInt32(_importDependencies); 433 offset_importDependencies = fbBuilder.writeListInt32(_importDependencies);
240 } 434 }
435 if (!(_exportNames == null || _exportNames.isEmpty)) {
436 offset_exportNames = fbBuilder.writeList(_exportNames.map((b) => b.finish( fbBuilder)).toList());
437 }
241 fbBuilder.startTable(); 438 fbBuilder.startTable();
242 if (offset_units != null) { 439 if (offset_units != null) {
243 fbBuilder.addOffset(0, offset_units); 440 fbBuilder.addOffset(0, offset_units);
244 } 441 }
245 if (offset_dependencies != null) { 442 if (offset_dependencies != null) {
246 fbBuilder.addOffset(1, offset_dependencies); 443 fbBuilder.addOffset(1, offset_dependencies);
247 } 444 }
248 if (offset_importDependencies != null) { 445 if (offset_importDependencies != null) {
249 fbBuilder.addOffset(2, offset_importDependencies); 446 fbBuilder.addOffset(2, offset_importDependencies);
250 } 447 }
448 if (offset_exportNames != null) {
449 fbBuilder.addOffset(3, offset_exportNames);
450 }
251 return fbBuilder.endTable(); 451 return fbBuilder.endTable();
252 } 452 }
253 } 453 }
254 454
255 PrelinkedLibraryBuilder encodePrelinkedLibrary({List<PrelinkedUnitBuilder> units , List<PrelinkedDependencyBuilder> dependencies, List<int> importDependencies}) { 455 PrelinkedLibraryBuilder encodePrelinkedLibrary({List<PrelinkedUnitBuilder> units , List<PrelinkedDependencyBuilder> dependencies, List<int> importDependencies, L ist<PrelinkedExportNameBuilder> exportNames}) {
256 PrelinkedLibraryBuilder builder = new PrelinkedLibraryBuilder(); 456 PrelinkedLibraryBuilder builder = new PrelinkedLibraryBuilder();
257 builder.units = units; 457 builder.units = units;
258 builder.dependencies = dependencies; 458 builder.dependencies = dependencies;
259 builder.importDependencies = importDependencies; 459 builder.importDependencies = importDependencies;
460 builder.exportNames = exportNames;
260 return builder; 461 return builder;
261 } 462 }
262 463
263 /** 464 /**
264 * Pre-linked summary of a library. 465 * Pre-linked summary of a library.
265 */ 466 */
266 abstract class PrelinkedLibrary extends base.SummaryClass { 467 abstract class PrelinkedLibrary extends base.SummaryClass {
267 factory PrelinkedLibrary.fromBuffer(List<int> buffer) { 468 factory PrelinkedLibrary.fromBuffer(List<int> buffer) {
268 fb.BufferPointer rootRef = new fb.BufferPointer.fromBytes(buffer); 469 fb.BufferPointer rootRef = new fb.BufferPointer.fromBytes(buffer);
269 return const _PrelinkedLibraryReader().read(rootRef); 470 return const _PrelinkedLibraryReader().read(rootRef);
(...skipping 19 matching lines...) Expand all
289 List<PrelinkedDependency> get dependencies; 490 List<PrelinkedDependency> get dependencies;
290 491
291 /** 492 /**
292 * For each import in [UnlinkedUnit.imports], an index into [dependencies] 493 * For each import in [UnlinkedUnit.imports], an index into [dependencies]
293 * of the library being imported. 494 * of the library being imported.
294 * 495 *
295 * TODO(paulberry): if [dependencies] is removed, this can be removed as 496 * TODO(paulberry): if [dependencies] is removed, this can be removed as
296 * well, since there will effectively be a one-to-one mapping. 497 * well, since there will effectively be a one-to-one mapping.
297 */ 498 */
298 List<int> get importDependencies; 499 List<int> get importDependencies;
500
501 /**
502 * Information about entities in the export namespace of the library that are
503 * not in the public namespace of the library (that is, entities that are
504 * brought into the namespace via `export` directives).
505 *
506 * Sorted by name.
507 */
508 List<PrelinkedExportName> get exportNames;
299 } 509 }
300 510
301 class _PrelinkedLibraryReader extends fb.TableReader<_PrelinkedLibraryImpl> { 511 class _PrelinkedLibraryReader extends fb.TableReader<_PrelinkedLibraryImpl> {
302 const _PrelinkedLibraryReader(); 512 const _PrelinkedLibraryReader();
303 513
304 @override 514 @override
305 _PrelinkedLibraryImpl createObject(fb.BufferPointer bp) => new _PrelinkedLibra ryImpl(bp); 515 _PrelinkedLibraryImpl createObject(fb.BufferPointer bp) => new _PrelinkedLibra ryImpl(bp);
306 } 516 }
307 517
308 class _PrelinkedLibraryImpl extends Object with _PrelinkedLibraryMixin implement s PrelinkedLibrary { 518 class _PrelinkedLibraryImpl extends Object with _PrelinkedLibraryMixin implement s PrelinkedLibrary {
309 final fb.BufferPointer _bp; 519 final fb.BufferPointer _bp;
310 520
311 _PrelinkedLibraryImpl(this._bp); 521 _PrelinkedLibraryImpl(this._bp);
312 522
313 List<PrelinkedUnit> _units; 523 List<PrelinkedUnit> _units;
314 List<PrelinkedDependency> _dependencies; 524 List<PrelinkedDependency> _dependencies;
315 List<int> _importDependencies; 525 List<int> _importDependencies;
526 List<PrelinkedExportName> _exportNames;
316 527
317 @override 528 @override
318 List<PrelinkedUnit> get units { 529 List<PrelinkedUnit> get units {
319 _units ??= const fb.ListReader<PrelinkedUnit>(const _PrelinkedUnitReader()). vTableGet(_bp, 0, const <PrelinkedUnit>[]); 530 _units ??= const fb.ListReader<PrelinkedUnit>(const _PrelinkedUnitReader()). vTableGet(_bp, 0, const <PrelinkedUnit>[]);
320 return _units; 531 return _units;
321 } 532 }
322 533
323 @override 534 @override
324 List<PrelinkedDependency> get dependencies { 535 List<PrelinkedDependency> get dependencies {
325 _dependencies ??= const fb.ListReader<PrelinkedDependency>(const _PrelinkedD ependencyReader()).vTableGet(_bp, 1, const <PrelinkedDependency>[]); 536 _dependencies ??= const fb.ListReader<PrelinkedDependency>(const _PrelinkedD ependencyReader()).vTableGet(_bp, 1, const <PrelinkedDependency>[]);
326 return _dependencies; 537 return _dependencies;
327 } 538 }
328 539
329 @override 540 @override
330 List<int> get importDependencies { 541 List<int> get importDependencies {
331 _importDependencies ??= const fb.ListReader<int>(const fb.Int32Reader()).vTa bleGet(_bp, 2, const <int>[]); 542 _importDependencies ??= const fb.ListReader<int>(const fb.Int32Reader()).vTa bleGet(_bp, 2, const <int>[]);
332 return _importDependencies; 543 return _importDependencies;
333 } 544 }
545
546 @override
547 List<PrelinkedExportName> get exportNames {
548 _exportNames ??= const fb.ListReader<PrelinkedExportName>(const _PrelinkedEx portNameReader()).vTableGet(_bp, 3, const <PrelinkedExportName>[]);
549 return _exportNames;
550 }
334 } 551 }
335 552
336 abstract class _PrelinkedLibraryMixin implements PrelinkedLibrary { 553 abstract class _PrelinkedLibraryMixin implements PrelinkedLibrary {
337 @override 554 @override
338 Map<String, Object> toMap() => { 555 Map<String, Object> toMap() => {
339 "units": units, 556 "units": units,
340 "dependencies": dependencies, 557 "dependencies": dependencies,
341 "importDependencies": importDependencies, 558 "importDependencies": importDependencies,
559 "exportNames": exportNames,
342 }; 560 };
343 } 561 }
344 562
345 class PrelinkedReferenceBuilder extends Object with _PrelinkedReferenceMixin imp lements PrelinkedReference { 563 class PrelinkedReferenceBuilder extends Object with _PrelinkedReferenceMixin imp lements PrelinkedReference {
346 bool _finished = false; 564 bool _finished = false;
347 565
348 int _dependency; 566 int _dependency;
349 PrelinkedReferenceKind _kind; 567 PrelinkedReferenceKind _kind;
350 int _unit; 568 int _unit;
351 int _numTypeParameters; 569 int _numTypeParameters;
(...skipping 4710 matching lines...) Expand 10 before | Expand all | Expand 10 after
5062 "nameOffset": nameOffset, 5280 "nameOffset": nameOffset,
5063 "documentationComment": documentationComment, 5281 "documentationComment": documentationComment,
5064 "type": type, 5282 "type": type,
5065 "isStatic": isStatic, 5283 "isStatic": isStatic,
5066 "isFinal": isFinal, 5284 "isFinal": isFinal,
5067 "isConst": isConst, 5285 "isConst": isConst,
5068 "hasImplicitType": hasImplicitType, 5286 "hasImplicitType": hasImplicitType,
5069 }; 5287 };
5070 } 5288 }
5071 5289
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/prelink.dart » ('j') | pkg/analyzer/lib/src/summary/resynthesize.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698