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

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

Issue 1650833002: Resynthesize type references. (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
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 6e9e8b58de96b75255654888ef5fa1fcc8b14ddc..7ce0954d021b50f6c102f895998cdbf421c5af14 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -411,6 +411,16 @@ class _ConstExprBuilder {
_pushMap(AstFactory.typeArgumentList(<TypeName>[keyType, valueType]));
break;
case UnlinkedConstOperation.pushReference:
+ EntityRef ref = uc.references[refPtr++];
+ _ReferenceInfo info = resynthesizer.referenceInfos[ref.reference];
+ if (info.type != null) {
Paul Berry 2016/01/31 13:41:02 This won't work properly if the class in question
scheglov 2016/01/31 18:55:29 Done.
+ Identifier node = _buildTypeIdentifierAst(info.type);
+ _push(node);
+ } else {
+ throw new StateError(
+ 'Unsupported reference ${info.element?.runtimeType}');
+ }
+ break;
case UnlinkedConstOperation.invokeConstructor:
case UnlinkedConstOperation.length:
return AstFactory.nullLiteral();
@@ -437,6 +447,15 @@ class _ConstExprBuilder {
throw new StateError('Unsupported type $type');
}
+ Identifier _buildTypeIdentifierAst(DartType type) {
+ String name = type.name;
+ SimpleIdentifier node = AstFactory.identifier3(name);
+ node.staticElement = type.element;
+ // TODO(scheglov) it seems that resolver does not do this
+// node.staticType = resynthesizer.summaryResynthesizer.typeProvider.typeType;
Paul Berry 2016/01/31 13:41:02 I'm confused about this commented out code and the
scheglov 2016/01/31 18:55:29 1. We should do this. 2. Resolver does not do this
scheglov 2016/01/31 20:24:01 Actually, I'm wrong. Resolver does set the type co
+ return node;
+ }
+
InterpolationElement _newInterpolationElement(Expression expr) {
if (expr is SimpleStringLiteral) {
return new InterpolationString(expr.literal, expr.value);
@@ -1591,8 +1610,8 @@ class _ReferenceInfo {
/**
* Create a new [_ReferenceInfo] object referring to an element called [name]
- * via the element handle [elementHandle], and having [numTypeParameters]
- * type parameters.
+ * via the element handle [element], and having [numTypeParameters] type
+ * parameters.
*
* For the special types `dynamic` and `void`, [specialType] should point to
* the type itself. Otherwise, pass `null` and the type will be computed

Powered by Google App Engine
This is Rietveld 408576698