OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |