OLD | NEW |
---|---|
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.src.dart.element.element; | 5 library analyzer.src.dart.element.element; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 3574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3585 safelyVisitChildren(_parameters, visitor); | 3585 safelyVisitChildren(_parameters, visitor); |
3586 safelyVisitChildren(_typeParameters, visitor); | 3586 safelyVisitChildren(_typeParameters, visitor); |
3587 } | 3587 } |
3588 } | 3588 } |
3589 | 3589 |
3590 /** | 3590 /** |
3591 * A concrete implementation of a [HideElementCombinator]. | 3591 * A concrete implementation of a [HideElementCombinator]. |
3592 */ | 3592 */ |
3593 class HideElementCombinatorImpl implements HideElementCombinator { | 3593 class HideElementCombinatorImpl implements HideElementCombinator { |
3594 /** | 3594 /** |
3595 * The unlinked representation of the combinator in the summary. | |
3596 */ | |
3597 final UnlinkedCombinator _unlinkedCombinator; | |
3598 | |
3599 /** | |
3595 * The names that are not to be made visible in the importing library even if | 3600 * The names that are not to be made visible in the importing library even if |
3596 * they are defined in the imported library. | 3601 * they are defined in the imported library. |
3597 */ | 3602 */ |
3598 List<String> hiddenNames = StringUtilities.EMPTY_ARRAY; | 3603 List<String> _hiddenNames; |
3604 | |
3605 HideElementCombinatorImpl() : _unlinkedCombinator = null; | |
3606 | |
3607 /** | |
3608 * Initialize using the given serialized information. | |
3609 */ | |
3610 HideElementCombinatorImpl.forSerialized(this._unlinkedCombinator); | |
3611 | |
3612 @override | |
3613 List<String> get hiddenNames { | |
3614 if (_unlinkedCombinator != null) { | |
3615 _hiddenNames ??= _unlinkedCombinator.hides.toList(growable: false); | |
3616 } | |
3617 return _hiddenNames ?? StringUtilities.EMPTY_ARRAY; | |
Paul Berry
2016/05/23 15:43:52
Nit: personally, I'd use `const <String>[]` here.
scheglov
2016/05/23 15:48:42
Done.
| |
3618 } | |
3619 | |
3620 void set hiddenNames(List<String> hiddenNames) { | |
3621 assert(_unlinkedCombinator == null); | |
3622 _hiddenNames = hiddenNames; | |
3623 } | |
3599 | 3624 |
3600 @override | 3625 @override |
3601 String toString() { | 3626 String toString() { |
3602 StringBuffer buffer = new StringBuffer(); | 3627 StringBuffer buffer = new StringBuffer(); |
3603 buffer.write("show "); | 3628 buffer.write("show "); |
3604 int count = hiddenNames.length; | 3629 int count = hiddenNames.length; |
3605 for (int i = 0; i < count; i++) { | 3630 for (int i = 0; i < count; i++) { |
3606 if (i > 0) { | 3631 if (i > 0) { |
3607 buffer.write(", "); | 3632 buffer.write(", "); |
3608 } | 3633 } |
(...skipping 26 matching lines...) Expand all Loading... | |
3635 | 3660 |
3636 /** | 3661 /** |
3637 * The library that is imported into this library by this import directive. | 3662 * The library that is imported into this library by this import directive. |
3638 */ | 3663 */ |
3639 LibraryElement _importedLibrary; | 3664 LibraryElement _importedLibrary; |
3640 | 3665 |
3641 /** | 3666 /** |
3642 * The combinators that were specified as part of the import directive in the | 3667 * The combinators that were specified as part of the import directive in the |
3643 * order in which they were specified. | 3668 * order in which they were specified. |
3644 */ | 3669 */ |
3645 List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_LIST; | 3670 List<NamespaceCombinator> _combinators; |
3646 | 3671 |
3647 /** | 3672 /** |
3648 * The prefix that was specified as part of the import directive, or `null` if | 3673 * The prefix that was specified as part of the import directive, or `null` if |
3649 * there was no prefix specified. | 3674 * there was no prefix specified. |
3650 */ | 3675 */ |
3651 PrefixElement _prefix; | 3676 PrefixElement _prefix; |
3652 | 3677 |
3653 /** | 3678 /** |
3654 * Initialize a newly created import element at the given [offset]. | 3679 * Initialize a newly created import element at the given [offset]. |
3655 * The offset may be `-1` if the import is synthetic. | 3680 * The offset may be `-1` if the import is synthetic. |
3656 */ | 3681 */ |
3657 ImportElementImpl(int offset) | 3682 ImportElementImpl(int offset) |
3658 : _unlinkedImport = null, | 3683 : _unlinkedImport = null, |
3659 _linkedDependency = null, | 3684 _linkedDependency = null, |
3660 super(null, offset); | 3685 super(null, offset); |
3661 | 3686 |
3662 /** | 3687 /** |
3663 * Initialize using the given serialized information. | 3688 * Initialize using the given serialized information. |
3664 */ | 3689 */ |
3665 ImportElementImpl.forSerialized(this._unlinkedImport, this._linkedDependency, | 3690 ImportElementImpl.forSerialized(this._unlinkedImport, this._linkedDependency, |
3666 LibraryElementImpl enclosingLibrary) | 3691 LibraryElementImpl enclosingLibrary) |
3667 : super.forSerialized(enclosingLibrary); | 3692 : super.forSerialized(enclosingLibrary); |
3668 | 3693 |
3694 @override | |
3695 List<NamespaceCombinator> get combinators { | |
3696 if (_unlinkedImport != null && _combinators == null) { | |
3697 List<UnlinkedCombinator> unlinkedCombinators = | |
3698 _unlinkedImport.combinators; | |
3699 int length = unlinkedCombinators.length; | |
3700 if (length != 0) { | |
3701 List<NamespaceCombinator> combinators = | |
3702 new List<NamespaceCombinator>(length); | |
3703 for (int i = 0; i < length; i++) { | |
3704 UnlinkedCombinator unlinkedCombinator = unlinkedCombinators[i]; | |
3705 combinators[i] = unlinkedCombinator.shows.isNotEmpty | |
3706 ? new ShowElementCombinatorImpl.forSerialized(unlinkedCombinator) | |
3707 : new HideElementCombinatorImpl.forSerialized(unlinkedCombinator); | |
3708 } | |
3709 _combinators = combinators; | |
3710 } else { | |
3711 _combinators = const <NamespaceCombinator>[]; | |
3712 } | |
3713 } | |
3714 return _combinators ?? const <NamespaceCombinator>[]; | |
3715 } | |
3716 | |
3717 void set combinators(List<NamespaceCombinator> combinators) { | |
3718 assert(_unlinkedImport == null); | |
3719 _combinators = combinators; | |
3720 } | |
3721 | |
3669 /** | 3722 /** |
3670 * Set whether this import is for a deferred library. | 3723 * Set whether this import is for a deferred library. |
3671 */ | 3724 */ |
3672 void set deferred(bool isDeferred) { | 3725 void set deferred(bool isDeferred) { |
3673 assert(_unlinkedImport == null); | 3726 assert(_unlinkedImport == null); |
3674 setModifier(Modifier.DEFERRED, isDeferred); | 3727 setModifier(Modifier.DEFERRED, isDeferred); |
3675 } | 3728 } |
3676 | 3729 |
3677 @override | 3730 @override |
3678 String get identifier => "${importedLibrary.identifier}@$nameOffset"; | 3731 String get identifier => "${importedLibrary.identifier}@$nameOffset"; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3924 /** | 3977 /** |
3925 * The entry point for this library, or `null` if this library does not have | 3978 * The entry point for this library, or `null` if this library does not have |
3926 * an entry point. | 3979 * an entry point. |
3927 */ | 3980 */ |
3928 FunctionElement _entryPoint; | 3981 FunctionElement _entryPoint; |
3929 | 3982 |
3930 /** | 3983 /** |
3931 * A list containing specifications of all of the imports defined in this | 3984 * A list containing specifications of all of the imports defined in this |
3932 * library. | 3985 * library. |
3933 */ | 3986 */ |
3934 List<ImportElement> _imports = ImportElement.EMPTY_LIST; | 3987 List<ImportElement> _imports; |
3935 | 3988 |
3936 /** | 3989 /** |
3937 * A list containing specifications of all of the exports defined in this | 3990 * A list containing specifications of all of the exports defined in this |
3938 * library. | 3991 * library. |
3939 */ | 3992 */ |
3940 List<ExportElement> _exports = ExportElement.EMPTY_LIST; | 3993 List<ExportElement> _exports = ExportElement.EMPTY_LIST; |
3941 | 3994 |
3942 /** | 3995 /** |
3943 * A list containing the strongly connected component in the import/export | 3996 * A list containing the strongly connected component in the import/export |
3944 * graph in which the current library resides. Computed on demand, null | 3997 * graph in which the current library resides. Computed on demand, null |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4127 } | 4180 } |
4128 return false; | 4181 return false; |
4129 } | 4182 } |
4130 | 4183 |
4131 @override | 4184 @override |
4132 String get identifier => _definingCompilationUnit.source.encoding; | 4185 String get identifier => _definingCompilationUnit.source.encoding; |
4133 | 4186 |
4134 @override | 4187 @override |
4135 List<LibraryElement> get importedLibraries { | 4188 List<LibraryElement> get importedLibraries { |
4136 HashSet<LibraryElement> libraries = new HashSet<LibraryElement>(); | 4189 HashSet<LibraryElement> libraries = new HashSet<LibraryElement>(); |
4137 for (ImportElement element in _imports) { | 4190 for (ImportElement element in imports) { |
4138 LibraryElement library = element.importedLibrary; | 4191 LibraryElement library = element.importedLibrary; |
4139 if (library != null) { | 4192 if (library != null) { |
4140 libraries.add(library); | 4193 libraries.add(library); |
4141 } | 4194 } |
4142 } | 4195 } |
4143 return new List.from(libraries); | 4196 return new List.from(libraries); |
4144 } | 4197 } |
4145 | 4198 |
4146 @override | 4199 @override |
4147 List<ImportElement> get imports => _imports; | 4200 List<ImportElement> get imports { |
4201 if (_unlinkedDefiningUnit != null && _imports == null) { | |
4202 List<UnlinkedImport> unlinkedImports = _unlinkedDefiningUnit.imports; | |
4203 int length = unlinkedImports.length; | |
4204 if (length != 0) { | |
4205 List<ImportElement> imports = new List<ImportElement>(length); | |
4206 LinkedLibrary linkedLibrary = resynthesizerContext.linkedLibrary; | |
4207 for (int i = 0; i < length; i++) { | |
4208 imports[i] = new ImportElementImpl.forSerialized( | |
4209 unlinkedImports[i], linkedLibrary.importDependencies[i], library); | |
4210 } | |
4211 _imports = imports; | |
4212 } else { | |
4213 _imports = const <ImportElement>[]; | |
4214 } | |
4215 } | |
4216 return _imports ?? ImportElement.EMPTY_LIST; | |
4217 } | |
4148 | 4218 |
4149 /** | 4219 /** |
4150 * Set the specifications of all of the imports defined in this library to the | 4220 * Set the specifications of all of the imports defined in this library to the |
4151 * given list of [imports]. | 4221 * given list of [imports]. |
4152 */ | 4222 */ |
4153 void set imports(List<ImportElement> imports) { | 4223 void set imports(List<ImportElement> imports) { |
4224 assert(_unlinkedDefiningUnit == null); | |
4154 for (ImportElement importElement in imports) { | 4225 for (ImportElement importElement in imports) { |
4155 (importElement as ImportElementImpl).enclosingElement = this; | 4226 (importElement as ImportElementImpl).enclosingElement = this; |
4156 PrefixElementImpl prefix = importElement.prefix as PrefixElementImpl; | 4227 PrefixElementImpl prefix = importElement.prefix as PrefixElementImpl; |
4157 if (prefix != null) { | 4228 if (prefix != null) { |
4158 prefix.enclosingElement = this; | 4229 prefix.enclosingElement = this; |
4159 } | 4230 } |
4160 } | 4231 } |
4161 this._imports = imports; | 4232 this._imports = imports; |
4162 } | 4233 } |
4163 | 4234 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4325 assert((compilationUnit as CompilationUnitElementImpl).librarySource == | 4396 assert((compilationUnit as CompilationUnitElementImpl).librarySource == |
4326 source); | 4397 source); |
4327 (compilationUnit as CompilationUnitElementImpl).enclosingElement = this; | 4398 (compilationUnit as CompilationUnitElementImpl).enclosingElement = this; |
4328 } | 4399 } |
4329 this._parts = parts; | 4400 this._parts = parts; |
4330 } | 4401 } |
4331 | 4402 |
4332 @override | 4403 @override |
4333 List<PrefixElement> get prefixes { | 4404 List<PrefixElement> get prefixes { |
4334 HashSet<PrefixElement> prefixes = new HashSet<PrefixElement>(); | 4405 HashSet<PrefixElement> prefixes = new HashSet<PrefixElement>(); |
4335 for (ImportElement element in _imports) { | 4406 for (ImportElement element in imports) { |
4336 PrefixElement prefix = element.prefix; | 4407 PrefixElement prefix = element.prefix; |
4337 if (prefix != null) { | 4408 if (prefix != null) { |
4338 prefixes.add(prefix); | 4409 prefixes.add(prefix); |
4339 } | 4410 } |
4340 } | 4411 } |
4341 return new List.from(prefixes); | 4412 return new List.from(prefixes); |
4342 } | 4413 } |
4343 | 4414 |
4344 @override | 4415 @override |
4345 Namespace get publicNamespace { | 4416 Namespace get publicNamespace { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4398 CompilationUnitElementImpl unitImpl = _definingCompilationUnit; | 4469 CompilationUnitElementImpl unitImpl = _definingCompilationUnit; |
4399 if (unitImpl.identifier == identifier) { | 4470 if (unitImpl.identifier == identifier) { |
4400 return unitImpl; | 4471 return unitImpl; |
4401 } | 4472 } |
4402 for (CompilationUnitElement part in _parts) { | 4473 for (CompilationUnitElement part in _parts) { |
4403 CompilationUnitElementImpl partImpl = part; | 4474 CompilationUnitElementImpl partImpl = part; |
4404 if (partImpl.identifier == identifier) { | 4475 if (partImpl.identifier == identifier) { |
4405 return partImpl; | 4476 return partImpl; |
4406 } | 4477 } |
4407 } | 4478 } |
4408 for (ImportElement importElement in _imports) { | 4479 for (ImportElement importElement in imports) { |
4409 ImportElementImpl importElementImpl = importElement; | 4480 ImportElementImpl importElementImpl = importElement; |
4410 if (importElementImpl.identifier == identifier) { | 4481 if (importElementImpl.identifier == identifier) { |
4411 return importElementImpl; | 4482 return importElementImpl; |
4412 } | 4483 } |
4413 } | 4484 } |
4414 for (ExportElement exportElement in _exports) { | 4485 for (ExportElement exportElement in _exports) { |
4415 ExportElementImpl exportElementImpl = exportElement; | 4486 ExportElementImpl exportElementImpl = exportElement; |
4416 if (exportElementImpl.identifier == identifier) { | 4487 if (exportElementImpl.identifier == identifier) { |
4417 return exportElementImpl; | 4488 return exportElementImpl; |
4418 } | 4489 } |
4419 } | 4490 } |
4420 return null; | 4491 return null; |
4421 } | 4492 } |
4422 | 4493 |
4423 @override | 4494 @override |
4424 List<ImportElement> getImportsWithPrefix(PrefixElement prefixElement) { | 4495 List<ImportElement> getImportsWithPrefix(PrefixElement prefixElement) { |
4425 int count = _imports.length; | 4496 var imports = this.imports; |
4497 int count = imports.length; | |
4426 List<ImportElement> importList = new List<ImportElement>(); | 4498 List<ImportElement> importList = new List<ImportElement>(); |
4427 for (int i = 0; i < count; i++) { | 4499 for (int i = 0; i < count; i++) { |
4428 if (identical(_imports[i].prefix, prefixElement)) { | 4500 if (identical(imports[i].prefix, prefixElement)) { |
4429 importList.add(_imports[i]); | 4501 importList.add(imports[i]); |
4430 } | 4502 } |
4431 } | 4503 } |
4432 return importList; | 4504 return importList; |
4433 } | 4505 } |
4434 | 4506 |
4435 @override | 4507 @override |
4436 ClassElement getType(String className) { | 4508 ClassElement getType(String className) { |
4437 ClassElement type = _definingCompilationUnit.getType(className); | 4509 ClassElement type = _definingCompilationUnit.getType(className); |
4438 if (type != null) { | 4510 if (type != null) { |
4439 return type; | 4511 return type; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4505 bool isUpToDate(int timeStamp) { | 4577 bool isUpToDate(int timeStamp) { |
4506 Set<LibraryElement> visitedLibraries = new Set(); | 4578 Set<LibraryElement> visitedLibraries = new Set(); |
4507 return _safeIsUpToDate(this, timeStamp, visitedLibraries); | 4579 return _safeIsUpToDate(this, timeStamp, visitedLibraries); |
4508 } | 4580 } |
4509 | 4581 |
4510 @override | 4582 @override |
4511 void visitChildren(ElementVisitor visitor) { | 4583 void visitChildren(ElementVisitor visitor) { |
4512 super.visitChildren(visitor); | 4584 super.visitChildren(visitor); |
4513 _definingCompilationUnit?.accept(visitor); | 4585 _definingCompilationUnit?.accept(visitor); |
4514 safelyVisitChildren(_exports, visitor); | 4586 safelyVisitChildren(_exports, visitor); |
4515 safelyVisitChildren(_imports, visitor); | 4587 safelyVisitChildren(imports, visitor); |
4516 safelyVisitChildren(_parts, visitor); | 4588 safelyVisitChildren(_parts, visitor); |
4517 } | 4589 } |
4518 | 4590 |
4519 /** | 4591 /** |
4520 * Recursively fills set of visible libraries for | 4592 * Recursively fills set of visible libraries for |
4521 * [getVisibleElementsLibraries]. | 4593 * [getVisibleElementsLibraries]. |
4522 */ | 4594 */ |
4523 void _addVisibleLibraries( | 4595 void _addVisibleLibraries( |
4524 Set<LibraryElement> visibleLibraries, bool includeExports) { | 4596 Set<LibraryElement> visibleLibraries, bool includeExports) { |
4525 // maybe already processed | 4597 // maybe already processed |
4526 if (!visibleLibraries.add(this)) { | 4598 if (!visibleLibraries.add(this)) { |
4527 return; | 4599 return; |
4528 } | 4600 } |
4529 // add imported libraries | 4601 // add imported libraries |
4530 for (ImportElement importElement in _imports) { | 4602 for (ImportElement importElement in imports) { |
4531 LibraryElement importedLibrary = importElement.importedLibrary; | 4603 LibraryElement importedLibrary = importElement.importedLibrary; |
4532 if (importedLibrary != null) { | 4604 if (importedLibrary != null) { |
4533 (importedLibrary as LibraryElementImpl) | 4605 (importedLibrary as LibraryElementImpl) |
4534 ._addVisibleLibraries(visibleLibraries, true); | 4606 ._addVisibleLibraries(visibleLibraries, true); |
4535 } | 4607 } |
4536 } | 4608 } |
4537 // add exported libraries | 4609 // add exported libraries |
4538 if (includeExports) { | 4610 if (includeExports) { |
4539 for (ExportElement exportElement in _exports) { | 4611 for (ExportElement exportElement in _exports) { |
4540 LibraryElement exportedLibrary = exportElement.exportedLibrary; | 4612 LibraryElement exportedLibrary = exportElement.exportedLibrary; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4583 } | 4655 } |
4584 return true; | 4656 return true; |
4585 } | 4657 } |
4586 } | 4658 } |
4587 | 4659 |
4588 /** | 4660 /** |
4589 * The context in which the library is resynthesized. | 4661 * The context in which the library is resynthesized. |
4590 */ | 4662 */ |
4591 abstract class LibraryResynthesizerContext { | 4663 abstract class LibraryResynthesizerContext { |
4592 /** | 4664 /** |
4665 * Return the [LinkedLibrary] that corresponds to the library being | |
4666 * resynthesized. | |
4667 */ | |
4668 LinkedLibrary get linkedLibrary; | |
4669 | |
4670 /** | |
4593 * Return the export namespace of the library. | 4671 * Return the export namespace of the library. |
4594 */ | 4672 */ |
4595 Namespace buildExportNamespace(); | 4673 Namespace buildExportNamespace(); |
4596 | 4674 |
4597 LibraryElement buildImportedLibrary(int dependency); | 4675 LibraryElement buildImportedLibrary(int dependency); |
4598 | 4676 |
4599 /** | 4677 /** |
4600 * Return the public namespace of the library. | 4678 * Return the public namespace of the library. |
4601 */ | 4679 */ |
4602 Namespace buildPublicNamespace(); | 4680 Namespace buildPublicNamespace(); |
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5996 DartType resolveTypeRef( | 6074 DartType resolveTypeRef( |
5997 EntityRef type, TypeParameterizedElementMixin typeParameterContext, | 6075 EntityRef type, TypeParameterizedElementMixin typeParameterContext, |
5998 {bool defaultVoid: false, bool instantiateToBoundsAllowed: true}); | 6076 {bool defaultVoid: false, bool instantiateToBoundsAllowed: true}); |
5999 } | 6077 } |
6000 | 6078 |
6001 /** | 6079 /** |
6002 * A concrete implementation of a [ShowElementCombinator]. | 6080 * A concrete implementation of a [ShowElementCombinator]. |
6003 */ | 6081 */ |
6004 class ShowElementCombinatorImpl implements ShowElementCombinator { | 6082 class ShowElementCombinatorImpl implements ShowElementCombinator { |
6005 /** | 6083 /** |
6084 * The unlinked representation of the combinator in the summary. | |
6085 */ | |
6086 final UnlinkedCombinator _unlinkedCombinator; | |
6087 | |
6088 /** | |
6006 * The names that are to be made visible in the importing library if they are | 6089 * The names that are to be made visible in the importing library if they are |
6007 * defined in the imported library. | 6090 * defined in the imported library. |
6008 */ | 6091 */ |
6009 List<String> shownNames = StringUtilities.EMPTY_ARRAY; | 6092 List<String> _shownNames; |
6010 | 6093 |
6011 /** | 6094 /** |
6012 * The offset of the character immediately following the last character of | 6095 * The offset of the character immediately following the last character of |
6013 * this node. | 6096 * this node. |
6014 */ | 6097 */ |
6015 int end = -1; | 6098 int _end = -1; |
6016 | 6099 |
6017 /** | 6100 /** |
6018 * The offset of the 'show' keyword of this element. | 6101 * The offset of the 'show' keyword of this element. |
6019 */ | 6102 */ |
6020 int offset = 0; | 6103 int _offset = 0; |
6104 | |
6105 ShowElementCombinatorImpl() : _unlinkedCombinator = null; | |
6106 | |
6107 /** | |
6108 * Initialize using the given serialized information. | |
6109 */ | |
6110 ShowElementCombinatorImpl.forSerialized(this._unlinkedCombinator); | |
6111 | |
6112 @override | |
6113 int get end { | |
6114 if (_unlinkedCombinator != null) { | |
6115 return _unlinkedCombinator.end; | |
6116 } | |
6117 return _end; | |
6118 } | |
6119 | |
6120 void set end(int end) { | |
6121 assert(_unlinkedCombinator == null); | |
6122 _end = end; | |
6123 } | |
6124 | |
6125 @override | |
6126 int get offset { | |
6127 if (_unlinkedCombinator != null) { | |
6128 return _unlinkedCombinator.offset; | |
6129 } | |
6130 return _offset; | |
6131 } | |
6132 | |
6133 void set offset(int offset) { | |
6134 assert(_unlinkedCombinator == null); | |
6135 _offset = offset; | |
6136 } | |
6137 | |
6138 @override | |
6139 List<String> get shownNames { | |
6140 if (_unlinkedCombinator != null) { | |
6141 _shownNames ??= _unlinkedCombinator.shows.toList(growable: false); | |
6142 } | |
6143 return _shownNames ?? StringUtilities.EMPTY_ARRAY; | |
6144 } | |
6145 | |
6146 void set shownNames(List<String> shownNames) { | |
6147 assert(_unlinkedCombinator == null); | |
6148 _shownNames = shownNames; | |
6149 } | |
6021 | 6150 |
6022 @override | 6151 @override |
6023 String toString() { | 6152 String toString() { |
6024 StringBuffer buffer = new StringBuffer(); | 6153 StringBuffer buffer = new StringBuffer(); |
6025 buffer.write("show "); | 6154 buffer.write("show "); |
6026 int count = shownNames.length; | 6155 int count = shownNames.length; |
6027 for (int i = 0; i < count; i++) { | 6156 for (int i = 0; i < count; i++) { |
6028 if (i > 0) { | 6157 if (i > 0) { |
6029 buffer.write(", "); | 6158 buffer.write(", "); |
6030 } | 6159 } |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6547 | 6676 |
6548 @override | 6677 @override |
6549 void visitElement(Element element) { | 6678 void visitElement(Element element) { |
6550 int offset = element.nameOffset; | 6679 int offset = element.nameOffset; |
6551 if (offset != -1) { | 6680 if (offset != -1) { |
6552 map[offset] = element; | 6681 map[offset] = element; |
6553 } | 6682 } |
6554 super.visitElement(element); | 6683 super.visitElement(element); |
6555 } | 6684 } |
6556 } | 6685 } |
OLD | NEW |