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

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

Issue 2520593003: Use AnalysisDriverUnlinkedUnit as a container for UnlinkedUnit and referenced names. (Closed)
Patch Set: Created 4 years, 1 month 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 'flat_buffers.dart' as fb; 10 import 'flat_buffers.dart' as fb;
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 "length": length, 412 "length": length,
413 "message": message, 413 "message": message,
414 "offset": offset, 414 "offset": offset,
415 "uniqueName": uniqueName, 415 "uniqueName": uniqueName,
416 }; 416 };
417 417
418 @override 418 @override
419 String toString() => convert.JSON.encode(toJson()); 419 String toString() => convert.JSON.encode(toJson());
420 } 420 }
421 421
422 class AnalysisDriverUnlinkedUnitBuilder extends Object with _AnalysisDriverUnlin kedUnitMixin implements idl.AnalysisDriverUnlinkedUnit {
423 UnlinkedUnitBuilder _unit;
424 List<String> _referencedNames;
425
426 @override
427 UnlinkedUnitBuilder get unit => _unit;
428
429 /**
430 * Unlinked information for the unit.
431 */
432 void set unit(UnlinkedUnitBuilder value) {
433 this._unit = value;
434 }
435
436 @override
437 List<String> get referencedNames => _referencedNames ??= <String>[];
438
439 /**
440 * List of external names referenced by the unit.
441 */
442 void set referencedNames(List<String> value) {
443 this._referencedNames = value;
444 }
445
446 AnalysisDriverUnlinkedUnitBuilder({UnlinkedUnitBuilder unit, List<String> refe rencedNames})
447 : _unit = unit,
448 _referencedNames = referencedNames;
449
450 /**
451 * Flush [informative] data recursively.
452 */
453 void flushInformative() {
454 _unit?.flushInformative();
455 }
456
457 /**
458 * Accumulate non-[informative] data into [signature].
459 */
460 void collectApiSignature(api_sig.ApiSignature signature) {
461 if (this._referencedNames == null) {
462 signature.addInt(0);
463 } else {
464 signature.addInt(this._referencedNames.length);
465 for (var x in this._referencedNames) {
466 signature.addString(x);
467 }
468 }
469 signature.addBool(this._unit != null);
470 this._unit?.collectApiSignature(signature);
471 }
472
473 List<int> toBuffer() {
474 fb.Builder fbBuilder = new fb.Builder();
475 return fbBuilder.finish(finish(fbBuilder), "ADUU");
476 }
477
478 fb.Offset finish(fb.Builder fbBuilder) {
479 fb.Offset offset_unit;
480 fb.Offset offset_referencedNames;
481 if (_unit != null) {
482 offset_unit = _unit.finish(fbBuilder);
483 }
484 if (!(_referencedNames == null || _referencedNames.isEmpty)) {
485 offset_referencedNames = fbBuilder.writeList(_referencedNames.map((b) => f bBuilder.writeString(b)).toList());
486 }
487 fbBuilder.startTable();
488 if (offset_unit != null) {
489 fbBuilder.addOffset(1, offset_unit);
490 }
491 if (offset_referencedNames != null) {
492 fbBuilder.addOffset(0, offset_referencedNames);
493 }
494 return fbBuilder.endTable();
495 }
496 }
497
498 idl.AnalysisDriverUnlinkedUnit readAnalysisDriverUnlinkedUnit(List<int> buffer) {
499 fb.BufferContext rootRef = new fb.BufferContext.fromBytes(buffer);
500 return const _AnalysisDriverUnlinkedUnitReader().read(rootRef, 0);
501 }
502
503 class _AnalysisDriverUnlinkedUnitReader extends fb.TableReader<_AnalysisDriverUn linkedUnitImpl> {
504 const _AnalysisDriverUnlinkedUnitReader();
505
506 @override
507 _AnalysisDriverUnlinkedUnitImpl createObject(fb.BufferContext bc, int offset) => new _AnalysisDriverUnlinkedUnitImpl(bc, offset);
508 }
509
510 class _AnalysisDriverUnlinkedUnitImpl extends Object with _AnalysisDriverUnlinke dUnitMixin implements idl.AnalysisDriverUnlinkedUnit {
511 final fb.BufferContext _bc;
512 final int _bcOffset;
513
514 _AnalysisDriverUnlinkedUnitImpl(this._bc, this._bcOffset);
515
516 idl.UnlinkedUnit _unit;
517 List<String> _referencedNames;
518
519 @override
520 idl.UnlinkedUnit get unit {
521 _unit ??= const _UnlinkedUnitReader().vTableGet(_bc, _bcOffset, 1, null);
522 return _unit;
523 }
524
525 @override
526 List<String> get referencedNames {
527 _referencedNames ??= const fb.ListReader<String>(const fb.StringReader()).vT ableGet(_bc, _bcOffset, 0, const <String>[]);
528 return _referencedNames;
529 }
530 }
531
532 abstract class _AnalysisDriverUnlinkedUnitMixin implements idl.AnalysisDriverUnl inkedUnit {
533 @override
534 Map<String, Object> toJson() {
535 Map<String, Object> _result = <String, Object>{};
536 if (unit != null) _result["unit"] = unit.toJson();
537 if (referencedNames.isNotEmpty) _result["referencedNames"] = referencedNames ;
538 return _result;
539 }
540
541 @override
542 Map<String, Object> toMap() => {
543 "unit": unit,
544 "referencedNames": referencedNames,
545 };
546
547 @override
548 String toString() => convert.JSON.encode(toJson());
549 }
550
422 class CodeRangeBuilder extends Object with _CodeRangeMixin implements idl.CodeRa nge { 551 class CodeRangeBuilder extends Object with _CodeRangeMixin implements idl.CodeRa nge {
423 int _length; 552 int _length;
424 int _offset; 553 int _offset;
425 554
426 @override 555 @override
427 int get length => _length ??= 0; 556 int get length => _length ??= 0;
428 557
429 /** 558 /**
430 * Length of the element code. 559 * Length of the element code.
431 */ 560 */
(...skipping 9416 matching lines...) Expand 10 before | Expand all | Expand 10 after
9848 "propagatedTypeSlot": propagatedTypeSlot, 9977 "propagatedTypeSlot": propagatedTypeSlot,
9849 "type": type, 9978 "type": type,
9850 "visibleLength": visibleLength, 9979 "visibleLength": visibleLength,
9851 "visibleOffset": visibleOffset, 9980 "visibleOffset": visibleOffset,
9852 }; 9981 };
9853 9982
9854 @override 9983 @override
9855 String toString() => convert.JSON.encode(toJson()); 9984 String toString() => convert.JSON.encode(toJson());
9856 } 9985 }
9857 9986
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698