Chromium Code Reviews| 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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 961 new LiteralNode(ident_pos, Object::transition_sentinel())); | 961 new LiteralNode(ident_pos, Object::transition_sentinel())); |
| 962 // Set field to null prior to throwing exception, so that subsequent | 962 // Set field to null prior to throwing exception, so that subsequent |
| 963 // accesses to the field do not throw again, since initializers should only | 963 // accesses to the field do not throw again, since initializers should only |
| 964 // be executed once. | 964 // be executed once. |
| 965 SequenceNode* report_circular = new SequenceNode(ident_pos, NULL); | 965 SequenceNode* report_circular = new SequenceNode(ident_pos, NULL); |
| 966 report_circular->Add( | 966 report_circular->Add( |
| 967 new StoreStaticFieldNode( | 967 new StoreStaticFieldNode( |
| 968 ident_pos, | 968 ident_pos, |
| 969 field, | 969 field, |
| 970 new LiteralNode(ident_pos, Instance::ZoneHandle()))); | 970 new LiteralNode(ident_pos, Instance::ZoneHandle()))); |
| 971 // TODO(regis, 5802): Exception to throw is not specified by spec. | 971 // call CyclicInitializationError._throwNew(field_name). |
|
srdjan
2013/10/28 21:32:02
s/call/Call/
hausner
2013/10/28 21:35:39
Done.
| |
| 972 const String& circular_error = String::ZoneHandle( | 972 ArgumentListNode* error_arguments = new ArgumentListNode(ident_pos); |
| 973 Symbols::New("circular dependency in field initialization")); | 973 error_arguments->Add(new LiteralNode(ident_pos, field_name)); |
| 974 report_circular->Add( | 974 report_circular->Add( |
| 975 new ThrowNode(ident_pos, | 975 MakeStaticCall(Symbols::CyclicInitializationError(), |
| 976 new LiteralNode(ident_pos, circular_error), | 976 Library::PrivateCoreLibName(Symbols::ThrowNew()), |
| 977 NULL)); | 977 error_arguments)); |
| 978 AstNode* circular_check = | 978 AstNode* circular_check = |
| 979 new IfNode(ident_pos, compare_circular, report_circular, NULL); | 979 new IfNode(ident_pos, compare_circular, report_circular, NULL); |
| 980 current_block_->statements->Add(circular_check); | 980 current_block_->statements->Add(circular_check); |
| 981 | 981 |
| 982 // Generate code checking for uninitialized field. | 982 // Generate code checking for uninitialized field. |
| 983 AstNode* compare_uninitialized = new ComparisonNode( | 983 AstNode* compare_uninitialized = new ComparisonNode( |
| 984 ident_pos, | 984 ident_pos, |
| 985 Token::kEQ_STRICT, | 985 Token::kEQ_STRICT, |
| 986 new LoadStaticFieldNode(ident_pos, field), | 986 new LoadStaticFieldNode(ident_pos, field), |
| 987 new LiteralNode(ident_pos, Object::sentinel())); | 987 new LiteralNode(ident_pos, Object::sentinel())); |
| (...skipping 9600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10588 void Parser::SkipQualIdent() { | 10588 void Parser::SkipQualIdent() { |
| 10589 ASSERT(IsIdentifier()); | 10589 ASSERT(IsIdentifier()); |
| 10590 ConsumeToken(); | 10590 ConsumeToken(); |
| 10591 if (CurrentToken() == Token::kPERIOD) { | 10591 if (CurrentToken() == Token::kPERIOD) { |
| 10592 ConsumeToken(); // Consume the kPERIOD token. | 10592 ConsumeToken(); // Consume the kPERIOD token. |
| 10593 ExpectIdentifier("identifier expected after '.'"); | 10593 ExpectIdentifier("identifier expected after '.'"); |
| 10594 } | 10594 } |
| 10595 } | 10595 } |
| 10596 | 10596 |
| 10597 } // namespace dart | 10597 } // namespace dart |
| OLD | NEW |