| 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 5321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5332 AstNode* initialization = NULL; | 5332 AstNode* initialization = NULL; |
| 5333 if (CurrentToken() == Token::kASSIGN) { | 5333 if (CurrentToken() == Token::kASSIGN) { |
| 5334 // Variable initialization. | 5334 // Variable initialization. |
| 5335 const intptr_t assign_pos = TokenPos(); | 5335 const intptr_t assign_pos = TokenPos(); |
| 5336 ConsumeToken(); | 5336 ConsumeToken(); |
| 5337 AstNode* expr = ParseExpr(is_const, kConsumeCascades); | 5337 AstNode* expr = ParseExpr(is_const, kConsumeCascades); |
| 5338 initialization = new StoreLocalNode(assign_pos, variable, expr); | 5338 initialization = new StoreLocalNode(assign_pos, variable, expr); |
| 5339 if (is_const) { | 5339 if (is_const) { |
| 5340 ASSERT(expr->IsLiteralNode()); | 5340 ASSERT(expr->IsLiteralNode()); |
| 5341 variable->SetConstValue(expr->AsLiteralNode()->literal()); | 5341 variable->SetConstValue(expr->AsLiteralNode()->literal()); |
| 5342 } else if (is_final && expr->IsLiteralNode()) { |
| 5343 variable->SetConstValue(expr->AsLiteralNode()->literal()); |
| 5342 } | 5344 } |
| 5343 } else if (is_final || is_const) { | 5345 } else if (is_final || is_const) { |
| 5344 ErrorMsg(ident_pos, | 5346 ErrorMsg(ident_pos, |
| 5345 "missing initialization of 'final' or 'const' variable"); | 5347 "missing initialization of 'final' or 'const' variable"); |
| 5346 } else { | 5348 } else { |
| 5347 // Initialize variable with null. | 5349 // Initialize variable with null. |
| 5348 AstNode* null_expr = new LiteralNode(ident_pos, Instance::ZoneHandle()); | 5350 AstNode* null_expr = new LiteralNode(ident_pos, Instance::ZoneHandle()); |
| 5349 initialization = new StoreLocalNode(ident_pos, variable, null_expr); | 5351 initialization = new StoreLocalNode(ident_pos, variable, null_expr); |
| 5350 } | 5352 } |
| 5351 // Add variable to scope after parsing the initalizer expression. | 5353 // Add variable to scope after parsing the initalizer expression. |
| (...skipping 5194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10546 void Parser::SkipQualIdent() { | 10548 void Parser::SkipQualIdent() { |
| 10547 ASSERT(IsIdentifier()); | 10549 ASSERT(IsIdentifier()); |
| 10548 ConsumeToken(); | 10550 ConsumeToken(); |
| 10549 if (CurrentToken() == Token::kPERIOD) { | 10551 if (CurrentToken() == Token::kPERIOD) { |
| 10550 ConsumeToken(); // Consume the kPERIOD token. | 10552 ConsumeToken(); // Consume the kPERIOD token. |
| 10551 ExpectIdentifier("identifier expected after '.'"); | 10553 ExpectIdentifier("identifier expected after '.'"); |
| 10552 } | 10554 } |
| 10553 } | 10555 } |
| 10554 | 10556 |
| 10555 } // namespace dart | 10557 } // namespace dart |
| OLD | NEW |