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

Unified Diff: runtime/vm/parser.cc

Issue 10831323: Update parser to not check that all final fields are initialized for external constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « runtime/vm/parser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 1e92e4c0d4553a731497ff796724b1ebdf350dee..539acedc006c566006958c1d9197f82b1519facd 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -1679,6 +1679,13 @@ void Parser::CheckDuplicateFieldInit(intptr_t init_pos,
}
+void Parser::CheckNoInitializersInExternal() {
+ if (CurrentToken() == Token::kCOLON) {
+ ErrorMsg("initializer lists invalid for 'external' constructors");
+ }
+}
+
+
void Parser::ParseInitializers(const Class& cls,
LocalVariable* receiver,
GrowableArray<Field*>* initialized_fields) {
@@ -1914,7 +1921,12 @@ SequenceNode* Parser::ParseConstructor(const Function& func,
}
// Now parse the explicit initializer list or constructor redirection.
- ParseInitializers(cls, receiver, &initialized_fields);
+ if (!func.is_external()) {
+ ParseInitializers(cls, receiver, &initialized_fields);
+ } else {
+ // 'external' constructors should have no initializers.
+ CheckNoInitializersInExternal();
+ }
SequenceNode* init_statements = CloseBlock();
if (init_statements->length() > 0) {
« no previous file with comments | « runtime/vm/parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698