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

Unified Diff: pkg/analyzer/lib/src/summary/link.dart

Issue 1837813002: Fix semantics of CompilationUnitElementForLink.types. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/link.dart
diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart
index 28930fc20225b214648e446eea47b0723fc320d4..70ffce63841a5637852da45a82eb660785e1e7b3 100644
--- a/pkg/analyzer/lib/src/summary/link.dart
+++ b/pkg/analyzer/lib/src/summary/link.dart
@@ -343,9 +343,10 @@ abstract class CompilationUnitElementForLink implements CompilationUnitElement {
*/
final List<ReferenceableElementForLink> _references;
- List<ClassElementForLink> _types;
+ List<ClassElementForLink_Class> _types;
Map<String, ReferenceableElementForLink> _containedNames;
List<TopLevelVariableElementForLink> _topLevelVariables;
+ List<ClassElementForLink_Enum> _enums;
@override
final LibraryElementForLink enclosingElement;
@@ -357,6 +358,20 @@ abstract class CompilationUnitElementForLink implements CompilationUnitElement {
_unlinkedUnit = unlinkedUnit;
@override
+ List<ClassElementForLink_Enum> get enums {
+ if (_enums == null) {
+ _enums = <ClassElementForLink_Enum>[];
+ for (UnlinkedEnum unlinkedEnum in _unlinkedUnit.enums) {
+ _enums.add(new ClassElementForLink_Enum(unlinkedEnum));
+ }
+ }
+ return _enums;
+ }
+
+ /**
+ * Indicates whether this compilation element is part of the build unit
+ * currently being linked.
+ */
bool get isInBuildUnit;
@override
@@ -372,15 +387,12 @@ abstract class CompilationUnitElementForLink implements CompilationUnitElement {
}
@override
- List<ClassElementForLink> get types {
+ List<ClassElementForLink_Class> get types {
if (_types == null) {
- _types = <ClassElementForLink>[];
+ _types = <ClassElementForLink_Class>[];
for (UnlinkedClass unlinkedClass in _unlinkedUnit.classes) {
_types.add(new ClassElementForLink_Class(this, unlinkedClass));
}
- for (UnlinkedEnum unlinkedEnum in _unlinkedUnit.enums) {
- _types.add(new ClassElementForLink_Enum(unlinkedEnum));
- }
}
return _types;
}
@@ -399,9 +411,12 @@ abstract class CompilationUnitElementForLink implements CompilationUnitElement {
if (_containedNames == null) {
_containedNames = <String, ReferenceableElementForLink>{};
// TODO(paulberry): what's the correct way to handle name conflicts?
- for (ClassElementForLink type in types) {
+ for (ClassElementForLink_Class type in types) {
_containedNames[type.name] = type;
}
+ for (ClassElementForLink_Enum enm in enums) {
+ _containedNames[enm.name] = enm;
+ }
for (TopLevelVariableElementForLink variable in topLevelVariables) {
_containedNames[variable.name] = variable;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698