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

Unified Diff: runtime/vm/parser.cc

Issue 8515024: Require legacy form of type parameters in factories and report errors if a factory class does not... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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 | « runtime/vm/parser.h ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 1463)
+++ runtime/vm/parser.cc (working copy)
@@ -6389,6 +6389,18 @@
}
+void Parser::CheckConstructorCallTypeArguments(
+ intptr_t pos, Function& constructor, const TypeArguments& type_arguments) {
+ if (!type_arguments.IsNull() &&
+ (type_arguments.Length() !=
+ Class::Handle(constructor.owner()).NumTypeArguments())) {
+ ErrorMsg(pos, "Incorrect number of type arguments, expected %d got %d",
+ Class::Handle(constructor.owner()).NumTypeArguments(),
+ type_arguments.Length());
+ }
+}
+
+
// Parse "[" [ expr { "," expr } ["," ] "]".
// Note: if the array literal is empty and the brackets have no whitespace
// between them, the scanner recognizes the opening and closing bracket
@@ -6469,6 +6481,7 @@
ASSERT(!array_ctor.IsNull());
ArgumentListNode* ctor_args = new ArgumentListNode(literal_pos);
ctor_args->Add(array);
+ CheckConstructorCallTypeArguments(literal_pos, array_ctor, type_arguments);
return new ConstructorCallNode(
literal_pos, type_arguments, array_ctor, ctor_args);
}
@@ -6833,6 +6846,7 @@
// Make sure that the instantiator is captured.
CaptureReceiver();
}
+ CheckConstructorCallTypeArguments(new_pos, constructor, type_arguments);
new_object = new ConstructorCallNode(
new_pos, type_arguments, constructor, arguments);
}
« no previous file with comments | « runtime/vm/parser.h ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698