| 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 3072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3083 safelyVisitChildren(_parameters, visitor); | 3083 safelyVisitChildren(_parameters, visitor); |
| 3084 } | 3084 } |
| 3085 } | 3085 } |
| 3086 | 3086 |
| 3087 /** | 3087 /** |
| 3088 * A concrete implementation of an [ExportElement]. | 3088 * A concrete implementation of an [ExportElement]. |
| 3089 */ | 3089 */ |
| 3090 class ExportElementImpl extends UriReferencedElementImpl | 3090 class ExportElementImpl extends UriReferencedElementImpl |
| 3091 implements ExportElement { | 3091 implements ExportElement { |
| 3092 /** | 3092 /** |
| 3093 * The unlinked representation of the export in the summary. |
| 3094 */ |
| 3095 final UnlinkedExportPublic _unlinkedExportPublic; |
| 3096 |
| 3097 /** |
| 3098 * The unlinked representation of the export in the summary. |
| 3099 */ |
| 3100 final UnlinkedExportNonPublic _unlinkedExportNonPublic; |
| 3101 |
| 3102 /** |
| 3093 * The library that is exported from this library by this export directive. | 3103 * The library that is exported from this library by this export directive. |
| 3094 */ | 3104 */ |
| 3095 LibraryElement exportedLibrary; | 3105 LibraryElement _exportedLibrary; |
| 3096 | 3106 |
| 3097 /** | 3107 /** |
| 3098 * The combinators that were specified as part of the export directive in the | 3108 * The combinators that were specified as part of the export directive in the |
| 3099 * order in which they were specified. | 3109 * order in which they were specified. |
| 3100 */ | 3110 */ |
| 3101 List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_LIST; | 3111 List<NamespaceCombinator> _combinators; |
| 3102 | 3112 |
| 3103 /** | 3113 /** |
| 3104 * Initialize a newly created export element at the given [offset]. | 3114 * Initialize a newly created export element at the given [offset]. |
| 3105 */ | 3115 */ |
| 3106 ExportElementImpl(int offset) : super(null, offset); | 3116 ExportElementImpl(int offset) |
| 3117 : _unlinkedExportPublic = null, |
| 3118 _unlinkedExportNonPublic = null, |
| 3119 super(null, offset); |
| 3120 |
| 3121 /** |
| 3122 * Initialize using the given serialized information. |
| 3123 */ |
| 3124 ExportElementImpl.forSerialized(this._unlinkedExportPublic, |
| 3125 this._unlinkedExportNonPublic, LibraryElementImpl enclosingLibrary) |
| 3126 : super.forSerialized(enclosingLibrary); |
| 3127 |
| 3128 @override |
| 3129 List<NamespaceCombinator> get combinators { |
| 3130 if (_unlinkedExportPublic != null && _combinators == null) { |
| 3131 _combinators = ImportElementImpl |
| 3132 ._buildCombinators(_unlinkedExportPublic.combinators); |
| 3133 } |
| 3134 return _combinators ?? const <NamespaceCombinator>[]; |
| 3135 } |
| 3136 |
| 3137 void set combinators(List<NamespaceCombinator> combinators) { |
| 3138 assert(_unlinkedExportPublic == null); |
| 3139 _combinators = combinators; |
| 3140 } |
| 3141 |
| 3142 @override |
| 3143 LibraryElement get exportedLibrary { |
| 3144 if (_unlinkedExportNonPublic != null && _exportedLibrary == null) { |
| 3145 LibraryElementImpl library = enclosingElement as LibraryElementImpl; |
| 3146 _exportedLibrary = library.resynthesizerContext |
| 3147 .buildExportedLibrary(_unlinkedExportPublic.uri); |
| 3148 } |
| 3149 return _exportedLibrary; |
| 3150 } |
| 3151 |
| 3152 void set exportedLibrary(LibraryElement exportedLibrary) { |
| 3153 assert(_unlinkedExportNonPublic == null); |
| 3154 _exportedLibrary = exportedLibrary; |
| 3155 } |
| 3107 | 3156 |
| 3108 @override | 3157 @override |
| 3109 String get identifier => exportedLibrary.name; | 3158 String get identifier => exportedLibrary.name; |
| 3110 | 3159 |
| 3111 @override | 3160 @override |
| 3112 ElementKind get kind => ElementKind.EXPORT; | 3161 ElementKind get kind => ElementKind.EXPORT; |
| 3113 | 3162 |
| 3114 @override | 3163 @override |
| 3164 List<ElementAnnotation> get metadata { |
| 3165 if (_unlinkedExportNonPublic != null) { |
| 3166 if (_metadata == null) { |
| 3167 CompilationUnitElementImpl definingUnit = |
| 3168 library.definingCompilationUnit as CompilationUnitElementImpl; |
| 3169 return _metadata ??= _unlinkedExportNonPublic.annotations |
| 3170 .map((a) => |
| 3171 definingUnit.resynthesizerContext.buildAnnotation(this, a)) |
| 3172 .toList(); |
| 3173 } |
| 3174 } |
| 3175 return super.metadata; |
| 3176 } |
| 3177 |
| 3178 void set metadata(List<ElementAnnotation> metadata) { |
| 3179 assert(_unlinkedExportNonPublic == null); |
| 3180 super.metadata = metadata; |
| 3181 } |
| 3182 |
| 3183 @override |
| 3184 int get nameOffset { |
| 3185 if (_unlinkedExportNonPublic != null) { |
| 3186 return _unlinkedExportNonPublic.offset; |
| 3187 } |
| 3188 return super.nameOffset; |
| 3189 } |
| 3190 |
| 3191 @override |
| 3192 String get uri { |
| 3193 if (_unlinkedExportPublic != null) { |
| 3194 return _unlinkedExportPublic.uri; |
| 3195 } |
| 3196 return super.uri; |
| 3197 } |
| 3198 |
| 3199 @override |
| 3200 void set uri(String uri) { |
| 3201 assert(_unlinkedExportPublic == null); |
| 3202 super.uri = uri; |
| 3203 } |
| 3204 |
| 3205 @override |
| 3206 int get uriEnd { |
| 3207 if (_unlinkedExportNonPublic != null) { |
| 3208 return _unlinkedExportNonPublic.uriEnd; |
| 3209 } |
| 3210 return super.uriEnd; |
| 3211 } |
| 3212 |
| 3213 @override |
| 3214 void set uriEnd(int uriEnd) { |
| 3215 assert(_unlinkedExportNonPublic == null); |
| 3216 super.uriEnd = uriEnd; |
| 3217 } |
| 3218 |
| 3219 @override |
| 3220 int get uriOffset { |
| 3221 if (_unlinkedExportNonPublic != null) { |
| 3222 return _unlinkedExportNonPublic.uriOffset; |
| 3223 } |
| 3224 return super.uriOffset; |
| 3225 } |
| 3226 |
| 3227 @override |
| 3228 void set uriOffset(int uriOffset) { |
| 3229 assert(_unlinkedExportNonPublic == null); |
| 3230 super.uriOffset = uriOffset; |
| 3231 } |
| 3232 |
| 3233 @override |
| 3115 accept(ElementVisitor visitor) => visitor.visitExportElement(this); | 3234 accept(ElementVisitor visitor) => visitor.visitExportElement(this); |
| 3116 | 3235 |
| 3117 @override | 3236 @override |
| 3118 void appendTo(StringBuffer buffer) { | 3237 void appendTo(StringBuffer buffer) { |
| 3119 buffer.write("export "); | 3238 buffer.write("export "); |
| 3120 (exportedLibrary as LibraryElementImpl).appendTo(buffer); | 3239 (exportedLibrary as LibraryElementImpl).appendTo(buffer); |
| 3121 } | 3240 } |
| 3122 } | 3241 } |
| 3123 | 3242 |
| 3124 /** | 3243 /** |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3687 /** | 3806 /** |
| 3688 * Initialize using the given serialized information. | 3807 * Initialize using the given serialized information. |
| 3689 */ | 3808 */ |
| 3690 ImportElementImpl.forSerialized(this._unlinkedImport, this._linkedDependency, | 3809 ImportElementImpl.forSerialized(this._unlinkedImport, this._linkedDependency, |
| 3691 LibraryElementImpl enclosingLibrary) | 3810 LibraryElementImpl enclosingLibrary) |
| 3692 : super.forSerialized(enclosingLibrary); | 3811 : super.forSerialized(enclosingLibrary); |
| 3693 | 3812 |
| 3694 @override | 3813 @override |
| 3695 List<NamespaceCombinator> get combinators { | 3814 List<NamespaceCombinator> get combinators { |
| 3696 if (_unlinkedImport != null && _combinators == null) { | 3815 if (_unlinkedImport != null && _combinators == null) { |
| 3697 List<UnlinkedCombinator> unlinkedCombinators = | 3816 _combinators = _buildCombinators(_unlinkedImport.combinators); |
| 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 } | 3817 } |
| 3714 return _combinators ?? const <NamespaceCombinator>[]; | 3818 return _combinators ?? const <NamespaceCombinator>[]; |
| 3715 } | 3819 } |
| 3716 | 3820 |
| 3717 void set combinators(List<NamespaceCombinator> combinators) { | 3821 void set combinators(List<NamespaceCombinator> combinators) { |
| 3718 assert(_unlinkedImport == null); | 3822 assert(_unlinkedImport == null); |
| 3719 _combinators = combinators; | 3823 _combinators = combinators; |
| 3720 } | 3824 } |
| 3721 | 3825 |
| 3722 /** | 3826 /** |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3887 void appendTo(StringBuffer buffer) { | 3991 void appendTo(StringBuffer buffer) { |
| 3888 buffer.write("import "); | 3992 buffer.write("import "); |
| 3889 (importedLibrary as LibraryElementImpl).appendTo(buffer); | 3993 (importedLibrary as LibraryElementImpl).appendTo(buffer); |
| 3890 } | 3994 } |
| 3891 | 3995 |
| 3892 @override | 3996 @override |
| 3893 void visitChildren(ElementVisitor visitor) { | 3997 void visitChildren(ElementVisitor visitor) { |
| 3894 super.visitChildren(visitor); | 3998 super.visitChildren(visitor); |
| 3895 prefix?.accept(visitor); | 3999 prefix?.accept(visitor); |
| 3896 } | 4000 } |
| 4001 |
| 4002 static List<NamespaceCombinator> _buildCombinators( |
| 4003 List<UnlinkedCombinator> unlinkedCombinators) { |
| 4004 int length = unlinkedCombinators.length; |
| 4005 if (length != 0) { |
| 4006 List<NamespaceCombinator> combinators = |
| 4007 new List<NamespaceCombinator>(length); |
| 4008 for (int i = 0; i < length; i++) { |
| 4009 UnlinkedCombinator unlinkedCombinator = unlinkedCombinators[i]; |
| 4010 combinators[i] = unlinkedCombinator.shows.isNotEmpty |
| 4011 ? new ShowElementCombinatorImpl.forSerialized(unlinkedCombinator) |
| 4012 : new HideElementCombinatorImpl.forSerialized(unlinkedCombinator); |
| 4013 } |
| 4014 return combinators; |
| 4015 } else { |
| 4016 return const <NamespaceCombinator>[]; |
| 4017 } |
| 4018 } |
| 3897 } | 4019 } |
| 3898 | 4020 |
| 3899 /** | 4021 /** |
| 3900 * A concrete implementation of a [LabelElement]. | 4022 * A concrete implementation of a [LabelElement]. |
| 3901 */ | 4023 */ |
| 3902 class LabelElementImpl extends ElementImpl implements LabelElement { | 4024 class LabelElementImpl extends ElementImpl implements LabelElement { |
| 3903 /** | 4025 /** |
| 3904 * A flag indicating whether this label is associated with a `switch` | 4026 * A flag indicating whether this label is associated with a `switch` |
| 3905 * statement. | 4027 * statement. |
| 3906 */ | 4028 */ |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3983 /** | 4105 /** |
| 3984 * A list containing specifications of all of the imports defined in this | 4106 * A list containing specifications of all of the imports defined in this |
| 3985 * library. | 4107 * library. |
| 3986 */ | 4108 */ |
| 3987 List<ImportElement> _imports; | 4109 List<ImportElement> _imports; |
| 3988 | 4110 |
| 3989 /** | 4111 /** |
| 3990 * A list containing specifications of all of the exports defined in this | 4112 * A list containing specifications of all of the exports defined in this |
| 3991 * library. | 4113 * library. |
| 3992 */ | 4114 */ |
| 3993 List<ExportElement> _exports = ExportElement.EMPTY_LIST; | 4115 List<ExportElement> _exports; |
| 3994 | 4116 |
| 3995 /** | 4117 /** |
| 3996 * A list containing the strongly connected component in the import/export | 4118 * A list containing the strongly connected component in the import/export |
| 3997 * graph in which the current library resides. Computed on demand, null | 4119 * graph in which the current library resides. Computed on demand, null |
| 3998 * if not present. If _libraryCycle is set, then the _libraryCycle field | 4120 * if not present. If _libraryCycle is set, then the _libraryCycle field |
| 3999 * for all libraries reachable from this library in the import/export graph | 4121 * for all libraries reachable from this library in the import/export graph |
| 4000 * is also set. | 4122 * is also set. |
| 4001 */ | 4123 */ |
| 4002 List<LibraryElement> _libraryCycle = null; | 4124 List<LibraryElement> _libraryCycle = null; |
| 4003 | 4125 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4130 return _entryPoint; | 4252 return _entryPoint; |
| 4131 } | 4253 } |
| 4132 | 4254 |
| 4133 void set entryPoint(FunctionElement entryPoint) { | 4255 void set entryPoint(FunctionElement entryPoint) { |
| 4134 _entryPoint = entryPoint; | 4256 _entryPoint = entryPoint; |
| 4135 } | 4257 } |
| 4136 | 4258 |
| 4137 @override | 4259 @override |
| 4138 List<LibraryElement> get exportedLibraries { | 4260 List<LibraryElement> get exportedLibraries { |
| 4139 HashSet<LibraryElement> libraries = new HashSet<LibraryElement>(); | 4261 HashSet<LibraryElement> libraries = new HashSet<LibraryElement>(); |
| 4140 for (ExportElement element in _exports) { | 4262 for (ExportElement element in exports) { |
| 4141 LibraryElement library = element.exportedLibrary; | 4263 LibraryElement library = element.exportedLibrary; |
| 4142 if (library != null) { | 4264 if (library != null) { |
| 4143 libraries.add(library); | 4265 libraries.add(library); |
| 4144 } | 4266 } |
| 4145 } | 4267 } |
| 4146 return new List.from(libraries); | 4268 return new List.from(libraries); |
| 4147 } | 4269 } |
| 4148 | 4270 |
| 4149 @override | 4271 @override |
| 4150 Namespace get exportNamespace { | 4272 Namespace get exportNamespace { |
| 4151 if (resynthesizerContext != null) { | 4273 if (resynthesizerContext != null) { |
| 4152 _exportNamespace ??= resynthesizerContext.buildExportNamespace(); | 4274 _exportNamespace ??= resynthesizerContext.buildExportNamespace(); |
| 4153 } | 4275 } |
| 4154 return _exportNamespace; | 4276 return _exportNamespace; |
| 4155 } | 4277 } |
| 4156 | 4278 |
| 4157 void set exportNamespace(Namespace exportNamespace) { | 4279 void set exportNamespace(Namespace exportNamespace) { |
| 4158 _exportNamespace = exportNamespace; | 4280 _exportNamespace = exportNamespace; |
| 4159 } | 4281 } |
| 4160 | 4282 |
| 4161 @override | 4283 @override |
| 4162 List<ExportElement> get exports => _exports; | 4284 List<ExportElement> get exports { |
| 4285 if (_unlinkedDefiningUnit != null && _exports == null) { |
| 4286 List<UnlinkedExportNonPublic> unlinkedNonPublicExports = |
| 4287 _unlinkedDefiningUnit.exports; |
| 4288 List<UnlinkedExportPublic> unlinkedPublicExports = |
| 4289 _unlinkedDefiningUnit.publicNamespace.exports; |
| 4290 assert( |
| 4291 _unlinkedDefiningUnit.exports.length == unlinkedPublicExports.length); |
| 4292 int length = unlinkedNonPublicExports.length; |
| 4293 if (length != 0) { |
| 4294 List<ExportElement> exports = new List<ExportElement>(length); |
| 4295 for (int i = 0; i < length; i++) { |
| 4296 UnlinkedExportPublic serializedExportPublic = |
| 4297 unlinkedPublicExports[i]; |
| 4298 UnlinkedExportNonPublic serializedExportNonPublic = |
| 4299 unlinkedNonPublicExports[i]; |
| 4300 exports[i] = new ExportElementImpl.forSerialized( |
| 4301 serializedExportPublic, serializedExportNonPublic, library); |
| 4302 } |
| 4303 _exports = exports; |
| 4304 } else { |
| 4305 _exports = const <ExportElement>[]; |
| 4306 } |
| 4307 } |
| 4308 return _exports ?? const <ExportElement>[]; |
| 4309 } |
| 4163 | 4310 |
| 4164 /** | 4311 /** |
| 4165 * Set the specifications of all of the exports defined in this library to the | 4312 * Set the specifications of all of the exports defined in this library to the |
| 4166 * given list of [exports]. | 4313 * given list of [exports]. |
| 4167 */ | 4314 */ |
| 4168 void set exports(List<ExportElement> exports) { | 4315 void set exports(List<ExportElement> exports) { |
| 4316 assert(_unlinkedDefiningUnit == null); |
| 4169 for (ExportElement exportElement in exports) { | 4317 for (ExportElement exportElement in exports) { |
| 4170 (exportElement as ExportElementImpl).enclosingElement = this; | 4318 (exportElement as ExportElementImpl).enclosingElement = this; |
| 4171 } | 4319 } |
| 4172 this._exports = exports; | 4320 this._exports = exports; |
| 4173 } | 4321 } |
| 4174 | 4322 |
| 4175 @override | 4323 @override |
| 4176 bool get hasExtUri => hasModifier(Modifier.HAS_EXT_URI); | 4324 bool get hasExtUri => hasModifier(Modifier.HAS_EXT_URI); |
| 4177 | 4325 |
| 4178 /** | 4326 /** |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4493 if (partImpl.identifier == identifier) { | 4641 if (partImpl.identifier == identifier) { |
| 4494 return partImpl; | 4642 return partImpl; |
| 4495 } | 4643 } |
| 4496 } | 4644 } |
| 4497 for (ImportElement importElement in imports) { | 4645 for (ImportElement importElement in imports) { |
| 4498 ImportElementImpl importElementImpl = importElement; | 4646 ImportElementImpl importElementImpl = importElement; |
| 4499 if (importElementImpl.identifier == identifier) { | 4647 if (importElementImpl.identifier == identifier) { |
| 4500 return importElementImpl; | 4648 return importElementImpl; |
| 4501 } | 4649 } |
| 4502 } | 4650 } |
| 4503 for (ExportElement exportElement in _exports) { | 4651 for (ExportElement exportElement in exports) { |
| 4504 ExportElementImpl exportElementImpl = exportElement; | 4652 ExportElementImpl exportElementImpl = exportElement; |
| 4505 if (exportElementImpl.identifier == identifier) { | 4653 if (exportElementImpl.identifier == identifier) { |
| 4506 return exportElementImpl; | 4654 return exportElementImpl; |
| 4507 } | 4655 } |
| 4508 } | 4656 } |
| 4509 return null; | 4657 return null; |
| 4510 } | 4658 } |
| 4511 | 4659 |
| 4512 @override | 4660 @override |
| 4513 List<ImportElement> getImportsWithPrefix(PrefixElement prefixElement) { | 4661 List<ImportElement> getImportsWithPrefix(PrefixElement prefixElement) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4604 void setResolutionCapability( | 4752 void setResolutionCapability( |
| 4605 LibraryResolutionCapability capability, bool value) { | 4753 LibraryResolutionCapability capability, bool value) { |
| 4606 _resolutionCapabilities = | 4754 _resolutionCapabilities = |
| 4607 BooleanArray.set(_resolutionCapabilities, capability.index, value); | 4755 BooleanArray.set(_resolutionCapabilities, capability.index, value); |
| 4608 } | 4756 } |
| 4609 | 4757 |
| 4610 @override | 4758 @override |
| 4611 void visitChildren(ElementVisitor visitor) { | 4759 void visitChildren(ElementVisitor visitor) { |
| 4612 super.visitChildren(visitor); | 4760 super.visitChildren(visitor); |
| 4613 _definingCompilationUnit?.accept(visitor); | 4761 _definingCompilationUnit?.accept(visitor); |
| 4614 safelyVisitChildren(_exports, visitor); | 4762 safelyVisitChildren(exports, visitor); |
| 4615 safelyVisitChildren(imports, visitor); | 4763 safelyVisitChildren(imports, visitor); |
| 4616 safelyVisitChildren(_parts, visitor); | 4764 safelyVisitChildren(_parts, visitor); |
| 4617 } | 4765 } |
| 4618 | 4766 |
| 4619 /** | 4767 /** |
| 4620 * Recursively fills set of visible libraries for | 4768 * Recursively fills set of visible libraries for |
| 4621 * [getVisibleElementsLibraries]. | 4769 * [getVisibleElementsLibraries]. |
| 4622 */ | 4770 */ |
| 4623 void _addVisibleLibraries( | 4771 void _addVisibleLibraries( |
| 4624 Set<LibraryElement> visibleLibraries, bool includeExports) { | 4772 Set<LibraryElement> visibleLibraries, bool includeExports) { |
| 4625 // maybe already processed | 4773 // maybe already processed |
| 4626 if (!visibleLibraries.add(this)) { | 4774 if (!visibleLibraries.add(this)) { |
| 4627 return; | 4775 return; |
| 4628 } | 4776 } |
| 4629 // add imported libraries | 4777 // add imported libraries |
| 4630 for (ImportElement importElement in imports) { | 4778 for (ImportElement importElement in imports) { |
| 4631 LibraryElement importedLibrary = importElement.importedLibrary; | 4779 LibraryElement importedLibrary = importElement.importedLibrary; |
| 4632 if (importedLibrary != null) { | 4780 if (importedLibrary != null) { |
| 4633 (importedLibrary as LibraryElementImpl) | 4781 (importedLibrary as LibraryElementImpl) |
| 4634 ._addVisibleLibraries(visibleLibraries, true); | 4782 ._addVisibleLibraries(visibleLibraries, true); |
| 4635 } | 4783 } |
| 4636 } | 4784 } |
| 4637 // add exported libraries | 4785 // add exported libraries |
| 4638 if (includeExports) { | 4786 if (includeExports) { |
| 4639 for (ExportElement exportElement in _exports) { | 4787 for (ExportElement exportElement in exports) { |
| 4640 LibraryElement exportedLibrary = exportElement.exportedLibrary; | 4788 LibraryElement exportedLibrary = exportElement.exportedLibrary; |
| 4641 if (exportedLibrary != null) { | 4789 if (exportedLibrary != null) { |
| 4642 (exportedLibrary as LibraryElementImpl) | 4790 (exportedLibrary as LibraryElementImpl) |
| 4643 ._addVisibleLibraries(visibleLibraries, true); | 4791 ._addVisibleLibraries(visibleLibraries, true); |
| 4644 } | 4792 } |
| 4645 } | 4793 } |
| 4646 } | 4794 } |
| 4647 } | 4795 } |
| 4648 | 4796 |
| 4649 /** | 4797 /** |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4714 * The context in which the library is resynthesized. | 4862 * The context in which the library is resynthesized. |
| 4715 */ | 4863 */ |
| 4716 abstract class LibraryResynthesizerContext { | 4864 abstract class LibraryResynthesizerContext { |
| 4717 /** | 4865 /** |
| 4718 * Return the [LinkedLibrary] that corresponds to the library being | 4866 * Return the [LinkedLibrary] that corresponds to the library being |
| 4719 * resynthesized. | 4867 * resynthesized. |
| 4720 */ | 4868 */ |
| 4721 LinkedLibrary get linkedLibrary; | 4869 LinkedLibrary get linkedLibrary; |
| 4722 | 4870 |
| 4723 /** | 4871 /** |
| 4872 * Return the exported [LibraryElement] for with the given [relativeUri]. |
| 4873 */ |
| 4874 LibraryElement buildExportedLibrary(String relativeUri); |
| 4875 |
| 4876 /** |
| 4724 * Return the export namespace of the library. | 4877 * Return the export namespace of the library. |
| 4725 */ | 4878 */ |
| 4726 Namespace buildExportNamespace(); | 4879 Namespace buildExportNamespace(); |
| 4727 | 4880 |
| 4881 /** |
| 4882 * Return the imported [LibraryElement] for the given dependency in the |
| 4883 * linked library. |
| 4884 */ |
| 4728 LibraryElement buildImportedLibrary(int dependency); | 4885 LibraryElement buildImportedLibrary(int dependency); |
| 4729 | 4886 |
| 4730 /** | 4887 /** |
| 4731 * Return the public namespace of the library. | 4888 * Return the public namespace of the library. |
| 4732 */ | 4889 */ |
| 4733 Namespace buildPublicNamespace(); | 4890 Namespace buildPublicNamespace(); |
| 4734 | 4891 |
| 4735 /** | 4892 /** |
| 4736 * Find the entry point of the library. | 4893 * Find the entry point of the library. |
| 4737 */ | 4894 */ |
| (...skipping 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6729 | 6886 |
| 6730 @override | 6887 @override |
| 6731 void visitElement(Element element) { | 6888 void visitElement(Element element) { |
| 6732 int offset = element.nameOffset; | 6889 int offset = element.nameOffset; |
| 6733 if (offset != -1) { | 6890 if (offset != -1) { |
| 6734 map[offset] = element; | 6891 map[offset] = element; |
| 6735 } | 6892 } |
| 6736 super.visitElement(element); | 6893 super.visitElement(element); |
| 6737 } | 6894 } |
| 6738 } | 6895 } |
| OLD | NEW |