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

Unified Diff: pkg/kernel/lib/analyzer/ast_from_analyzer.dart

Issue 2533793005: Check that invocations have well-formed targets in kernel verifier. (Closed)
Patch Set: Created 4 years, 1 month 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/kernel/lib/transformations/continuation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/analyzer/ast_from_analyzer.dart
diff --git a/pkg/kernel/lib/analyzer/ast_from_analyzer.dart b/pkg/kernel/lib/analyzer/ast_from_analyzer.dart
index 9847b5987d91e16fc620094b6d6d34c1e452633c..caece790dd1000e80cf9d058c069d893a67a65a1 100644
--- a/pkg/kernel/lib/analyzer/ast_from_analyzer.dart
+++ b/pkg/kernel/lib/analyzer/ast_from_analyzer.dart
@@ -1677,6 +1677,15 @@ class ExpressionBuilder
return element;
}
+ /// Forces the list of type arguments to have the specified length. If the
+ /// length was changed, all type arguments are changed to `dynamic`.
+ void _coerceTypeArgumentArity(List<ast.DartType> typeArguments, int arity) {
+ if (typeArguments.length != arity) {
+ typeArguments.length = arity;
+ typeArguments.fillRange(0, arity, const ast.DynamicType());
+ }
+ }
+
ast.Expression visitInstanceCreationExpression(
InstanceCreationExpression node) {
ConstructorElement element = node.staticElement;
@@ -1729,6 +1738,8 @@ class ExpressionBuilder
if (classElement.isEnum) {
return scope.emitCompileTimeError(CompileTimeErrorCode.INSTANTIATE_ENUM);
}
+ _coerceTypeArgumentArity(
+ arguments.types, classElement.typeParameters.length);
if (element.isFactory) {
ast.Member target = scope.resolveConcreteMethod(element);
if (target is ast.Procedure &&
« no previous file with comments | « no previous file | pkg/kernel/lib/transformations/continuation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698