| 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 #include "vm/flags.h" | 6 #include "vm/flags.h" |
| 7 | 7 |
| 8 #ifndef DART_PRECOMPILED_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME |
| 9 | 9 |
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 ASSERT(tokens_iterator_.IsValid()); | 416 ASSERT(tokens_iterator_.IsValid()); |
| 417 ASSERT(!current_function().IsNull()); | 417 ASSERT(!current_function().IsNull()); |
| 418 EnsureExpressionTemp(); | 418 EnsureExpressionTemp(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 | 421 |
| 422 Parser::~Parser() { | 422 Parser::~Parser() { |
| 423 if (unregister_pending_function_) { | 423 if (unregister_pending_function_) { |
| 424 const GrowableObjectArray& pending_functions = | 424 const GrowableObjectArray& pending_functions = |
| 425 GrowableObjectArray::Handle(T->pending_functions()); | 425 GrowableObjectArray::Handle(T->pending_functions()); |
| 426 ASSERT(!pending_functions.IsNull()); |
| 426 ASSERT(pending_functions.Length() > 0); | 427 ASSERT(pending_functions.Length() > 0); |
| 427 ASSERT(pending_functions.At(pending_functions.Length() - 1) == | 428 ASSERT(pending_functions.At(pending_functions.Length() - 1) == |
| 428 current_function().raw()); | 429 current_function().raw()); |
| 429 pending_functions.RemoveLast(); | 430 pending_functions.RemoveLast(); |
| 430 } | 431 } |
| 431 } | 432 } |
| 432 | 433 |
| 433 | 434 |
| 434 // Each try in this function gets its own try index. | 435 // Each try in this function gets its own try index. |
| 435 // See definition of RawPcDescriptors::PcDescriptor. | 436 // See definition of RawPcDescriptors::PcDescriptor. |
| (...skipping 2518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2954 // Empty constructor body. | 2955 // Empty constructor body. |
| 2955 current_block_->statements->Add(new ReturnNode(ST(ctor_pos))); | 2956 current_block_->statements->Add(new ReturnNode(ST(ctor_pos))); |
| 2956 SequenceNode* statements = CloseBlock(); | 2957 SequenceNode* statements = CloseBlock(); |
| 2957 return statements; | 2958 return statements; |
| 2958 } | 2959 } |
| 2959 | 2960 |
| 2960 | 2961 |
| 2961 void Parser::CheckRecursiveInvocation() { | 2962 void Parser::CheckRecursiveInvocation() { |
| 2962 const GrowableObjectArray& pending_functions = | 2963 const GrowableObjectArray& pending_functions = |
| 2963 GrowableObjectArray::Handle(Z, T->pending_functions()); | 2964 GrowableObjectArray::Handle(Z, T->pending_functions()); |
| 2965 ASSERT(!pending_functions.IsNull()); |
| 2964 for (int i = 0; i < pending_functions.Length(); i++) { | 2966 for (int i = 0; i < pending_functions.Length(); i++) { |
| 2965 if (pending_functions.At(i) == current_function().raw()) { | 2967 if (pending_functions.At(i) == current_function().raw()) { |
| 2966 const String& fname = | 2968 const String& fname = |
| 2967 String::Handle(Z, current_function().UserVisibleName()); | 2969 String::Handle(Z, current_function().UserVisibleName()); |
| 2968 ReportError("circular dependency for function %s", fname.ToCString()); | 2970 ReportError("circular dependency for function %s", fname.ToCString()); |
| 2969 } | 2971 } |
| 2970 } | 2972 } |
| 2971 ASSERT(!unregister_pending_function_); | 2973 ASSERT(!unregister_pending_function_); |
| 2972 pending_functions.Add(current_function()); | 2974 pending_functions.Add(current_function(), Heap::kOld); |
| 2973 unregister_pending_function_ = true; | 2975 unregister_pending_function_ = true; |
| 2974 } | 2976 } |
| 2975 | 2977 |
| 2976 | 2978 |
| 2977 // Parser is at the opening parenthesis of the formal parameter declaration | 2979 // Parser is at the opening parenthesis of the formal parameter declaration |
| 2978 // of function. Parse the formal parameters, initializers and code. | 2980 // of function. Parse the formal parameters, initializers and code. |
| 2979 SequenceNode* Parser::ParseConstructor(const Function& func) { | 2981 SequenceNode* Parser::ParseConstructor(const Function& func) { |
| 2980 TRACE_PARSER("ParseConstructor"); | 2982 TRACE_PARSER("ParseConstructor"); |
| 2981 ASSERT(func.IsGenerativeConstructor()); | 2983 ASSERT(func.IsGenerativeConstructor()); |
| 2982 ASSERT(!func.IsFactory()); | 2984 ASSERT(!func.IsFactory()); |
| (...skipping 11436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14419 const ArgumentListNode& function_args, | 14421 const ArgumentListNode& function_args, |
| 14420 const LocalVariable* temp_for_last_arg, | 14422 const LocalVariable* temp_for_last_arg, |
| 14421 bool is_super_invocation) { | 14423 bool is_super_invocation) { |
| 14422 UNREACHABLE(); | 14424 UNREACHABLE(); |
| 14423 return NULL; | 14425 return NULL; |
| 14424 } | 14426 } |
| 14425 | 14427 |
| 14426 } // namespace dart | 14428 } // namespace dart |
| 14427 | 14429 |
| 14428 #endif // DART_PRECOMPILED_RUNTIME | 14430 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |