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

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

Issue 1686453002: Fix for constant instance creation without type arguments. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 def5628c85c2b14912f77034b9b71c3d98bff407..0a71496444444bf9e37861ad870854b1333120c0 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -455,8 +455,10 @@ class _ConstExprBuilder {
(node.name as SimpleIdentifier).staticElement = type.element;
return node;
} else if (type is InterfaceType) {
- List<TypeName> argumentNodes =
- type.typeArguments.map(_buildTypeAst).toList();
+ List<DartType> typeArguments = type.typeArguments;
+ List<TypeName> 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;
@@ -476,8 +478,13 @@ class _ConstExprBuilder {
_ReferenceInfo classInfo = isClass ? info : info.enclosing;
List<DartType> typeArguments =
typeArgumentRefs.map(resynthesizer.buildType).toList();
- InterfaceType classType =
- classInfo.buildType((i) => typeArguments[i], const <int>[]);
+ InterfaceType classType = classInfo.buildType((i) {
+ if (i < typeArguments.length) {
+ return typeArguments[i];
+ } else {
+ return DynamicTypeImpl.instance;
+ }
+ }, const <int>[]);
String name = isClass ? '' : info.name;
return new _DeferredConstructorElement(classType, name);
}
« 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