| 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 "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/bootstrap.h" | 9 #include "vm/bootstrap.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 initialized_fields->Add(&field); | 2372 initialized_fields->Add(&field); |
| 2373 } | 2373 } |
| 2374 AstNode* init_expr = NULL; | 2374 AstNode* init_expr = NULL; |
| 2375 if (current_class().raw() != field.origin()) { | 2375 if (current_class().raw() != field.origin()) { |
| 2376 init_expr = ParseExternalInitializedField(field); | 2376 init_expr = ParseExternalInitializedField(field); |
| 2377 } else { | 2377 } else { |
| 2378 SetPosition(field.token_pos()); | 2378 SetPosition(field.token_pos()); |
| 2379 ASSERT(IsIdentifier()); | 2379 ASSERT(IsIdentifier()); |
| 2380 ConsumeToken(); | 2380 ConsumeToken(); |
| 2381 ExpectToken(Token::kASSIGN); | 2381 ExpectToken(Token::kASSIGN); |
| 2382 if (field.is_const()) { | 2382 if (current_class().is_const()) { |
| 2383 // If the class has a const contructor, the initializer |
| 2384 // expression must be a compile-time constant. |
| 2383 init_expr = ParseConstExpr(); | 2385 init_expr = ParseConstExpr(); |
| 2384 } else { | 2386 } else { |
| 2385 intptr_t expr_pos = TokenPos(); | 2387 intptr_t expr_pos = TokenPos(); |
| 2386 init_expr = ParseExpr(kAllowConst, kConsumeCascades); | 2388 init_expr = ParseExpr(kAllowConst, kConsumeCascades); |
| 2387 if (init_expr->EvalConstExpr() != NULL) { | 2389 if (init_expr->EvalConstExpr() != NULL) { |
| 2388 init_expr = new LiteralNode(field.token_pos(), | 2390 init_expr = new LiteralNode(field.token_pos(), |
| 2389 EvaluateConstExpr(expr_pos, init_expr)); | 2391 EvaluateConstExpr(expr_pos, init_expr)); |
| 2390 } | 2392 } |
| 2391 } | 2393 } |
| 2392 } | 2394 } |
| (...skipping 8930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11323 void Parser::SkipQualIdent() { | 11325 void Parser::SkipQualIdent() { |
| 11324 ASSERT(IsIdentifier()); | 11326 ASSERT(IsIdentifier()); |
| 11325 ConsumeToken(); | 11327 ConsumeToken(); |
| 11326 if (CurrentToken() == Token::kPERIOD) { | 11328 if (CurrentToken() == Token::kPERIOD) { |
| 11327 ConsumeToken(); // Consume the kPERIOD token. | 11329 ConsumeToken(); // Consume the kPERIOD token. |
| 11328 ExpectIdentifier("identifier expected after '.'"); | 11330 ExpectIdentifier("identifier expected after '.'"); |
| 11329 } | 11331 } |
| 11330 } | 11332 } |
| 11331 | 11333 |
| 11332 } // namespace dart | 11334 } // namespace dart |
| OLD | NEW |