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

Side by Side Diff: runtime/vm/parser.cc

Issue 25873005: Compile error on const instance variables (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/compile_time_constant_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 3299 matching lines...) Expand 10 before | Expand all | Expand 10 after
3310 3310
3311 if (field->has_abstract) { 3311 if (field->has_abstract) {
3312 ErrorMsg("keyword 'abstract' not allowed in field declaration"); 3312 ErrorMsg("keyword 'abstract' not allowed in field declaration");
3313 } 3313 }
3314 if (field->has_external) { 3314 if (field->has_external) {
3315 ErrorMsg("keyword 'external' not allowed in field declaration"); 3315 ErrorMsg("keyword 'external' not allowed in field declaration");
3316 } 3316 }
3317 if (field->has_factory) { 3317 if (field->has_factory) {
3318 ErrorMsg("keyword 'factory' not allowed in field declaration"); 3318 ErrorMsg("keyword 'factory' not allowed in field declaration");
3319 } 3319 }
3320 if (!field->has_static && field->has_const) {
3321 ErrorMsg(field->name_pos, "instance field may not be 'const'");
3322 }
3320 if (members->FieldNameExists(*field->name, !field->has_final)) { 3323 if (members->FieldNameExists(*field->name, !field->has_final)) {
3321 ErrorMsg(field->name_pos, 3324 ErrorMsg(field->name_pos,
3322 "field or method '%s' already defined", field->name->ToCString()); 3325 "field or method '%s' already defined", field->name->ToCString());
3323 } 3326 }
3324 Function& getter = Function::Handle(); 3327 Function& getter = Function::Handle();
3325 Function& setter = Function::Handle(); 3328 Function& setter = Function::Handle();
3326 Field& class_field = Field::Handle(); 3329 Field& class_field = Field::Handle();
3327 Instance& init_value = Instance::Handle(); 3330 Instance& init_value = Instance::Handle();
3328 while (true) { 3331 while (true) {
3329 bool has_initializer = CurrentToken() == Token::kASSIGN; 3332 bool has_initializer = CurrentToken() == Token::kASSIGN;
(...skipping 7290 matching lines...) Expand 10 before | Expand all | Expand 10 after
10620 void Parser::SkipQualIdent() { 10623 void Parser::SkipQualIdent() {
10621 ASSERT(IsIdentifier()); 10624 ASSERT(IsIdentifier());
10622 ConsumeToken(); 10625 ConsumeToken();
10623 if (CurrentToken() == Token::kPERIOD) { 10626 if (CurrentToken() == Token::kPERIOD) {
10624 ConsumeToken(); // Consume the kPERIOD token. 10627 ConsumeToken(); // Consume the kPERIOD token.
10625 ExpectIdentifier("identifier expected after '.'"); 10628 ExpectIdentifier("identifier expected after '.'");
10626 } 10629 }
10627 } 10630 }
10628 10631
10629 } // namespace dart 10632 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/compile_time_constant_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698