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

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

Issue 1654983002: Don't use 'info.type', always set 'element'. (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 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/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index d60d4dce1b08e3e82c4aa971e37780ee6258d59c..daf1d1532e45e2880676246a5f5f587f7d3d4981 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -414,10 +414,8 @@ class _ConstExprBuilder {
EntityRef ref = uc.references[refPtr++];
_ReferenceInfo info = resynthesizer.referenceInfos[ref.reference];
if (info.element != null) {
- Identifier node = _buildElementAst(info.name, info.element);
- _push(node);
- } else if (info.type != null) {
- Identifier node = _buildElementAst(info.name, info.type.element);
+ SimpleIdentifier node = AstFactory.identifier3(info.name);
+ node.staticElement = info.element;
_push(node);
} else {
throw new StateError('Unsupported reference ${ref.toMap()}');
@@ -432,12 +430,6 @@ class _ConstExprBuilder {
return stack.single;
}
- Identifier _buildElementAst(String name, Element element) {
- SimpleIdentifier node = AstFactory.identifier3(name);
- node.staticElement = element;
- return node;
- }
-
TypeName _buildTypeAst(DartType type) {
if (type is DynamicTypeImpl) {
TypeName node = AstFactory.typeName4('dynamic');
@@ -1468,14 +1460,17 @@ class _LibraryResynthesizer {
name = linkedUnit.references[i].name;
containingReference = linkedUnit.references[i].containingReference;
}
- ElementHandle element;
+ Element element;
DartType type;
if (linkedReference.kind == ReferenceKind.unresolved) {
type = summaryResynthesizer.typeProvider.undefinedType;
+ element = type.element;
} else if (name == 'dynamic') {
type = summaryResynthesizer.typeProvider.dynamicType;
+ element = type.element;
} else if (name == 'void') {
type = VoidTypeImpl.instance;
+ element = type.element;
} else {
List<String> locationComponents;
if (containingReference != 0 &&
« 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