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

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

Issue 1837063002: Resynthesize any type reference in constant expressions. (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 | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | 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 b79cf76d27469da4e09b35f53960663f2cc8e059..de36f0a16d7d5d8ab9f05102e0c12520dccf7a9f 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -480,22 +480,17 @@ class _ConstExprBuilder {
}
TypeName _buildTypeAst(DartType type) {
- if (type is DynamicTypeImpl) {
- TypeName node = AstFactory.typeName4('dynamic');
- node.type = type;
- (node.name as SimpleIdentifier).staticElement = type.element;
- return node;
- } else if (type is InterfaceType) {
+ List<TypeName> argumentNodes;
+ if (type is ParameterizedType) {
List<DartType> typeArguments = type.typeArguments;
- List<TypeName> argumentNodes = typeArguments.every((a) => a.isDynamic)
+ argumentNodes = typeArguments.every((a) => a.isDynamic)
? null
: typeArguments.map(_buildTypeAst).toList();
- TypeName node = AstFactory.typeName4(type.name, argumentNodes);
- node.type = type;
- (node.name as SimpleIdentifier).staticElement = type.element;
- return node;
}
- throw new StateError('Unsupported type $type');
+ TypeName node = AstFactory.typeName4(type.name, argumentNodes);
+ node.type = type;
+ (node.name as SimpleIdentifier).staticElement = type.element;
+ return node;
}
InterpolationElement _newInterpolationElement(Expression expr) {
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698