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 #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 2938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2949 } | 2949 } |
| 2950 CheckFieldsInitialized(current_class()); | 2950 CheckFieldsInitialized(current_class()); |
| 2951 | 2951 |
| 2952 // Empty constructor body. | 2952 // Empty constructor body. |
| 2953 current_block_->statements->Add(new ReturnNode(ST(ctor_pos))); | 2953 current_block_->statements->Add(new ReturnNode(ST(ctor_pos))); |
| 2954 SequenceNode* statements = CloseBlock(); | 2954 SequenceNode* statements = CloseBlock(); |
| 2955 return statements; | 2955 return statements; |
| 2956 } | 2956 } |
| 2957 | 2957 |
| 2958 | 2958 |
| 2959 // Returns a zone allocated string. | |
| 2960 static char* DumpPendingFunctions( | |
| 2961 Zone* zone, | |
| 2962 const GrowableObjectArray& pending_functions) { | |
| 2963 ASSERT(zone != NULL); | |
| 2964 char* result = OS::SCreate(zone, "Pending Functions:\n"); | |
| 2965 for (intptr_t i = 0; i < pending_functions.Length(); i++) { | |
| 2966 const Function& func = | |
| 2967 Function::Handle(zone, Function::RawCast(pending_functions.At(i))); | |
| 2968 const String& fname = String::Handle(zone, func.UserVisibleName()); | |
| 2969 result = OS::SCreate(zone, "%s%" Pd ": %s\n", result, i, fname.ToCString()); | |
|
turnidge
2016/02/29 19:37:56
There's kind of a quadratic thing going on here, w
| |
| 2970 } | |
| 2971 return result; | |
| 2972 } | |
| 2973 | |
| 2974 | |
| 2959 void Parser::CheckRecursiveInvocation() { | 2975 void Parser::CheckRecursiveInvocation() { |
| 2960 const GrowableObjectArray& pending_functions = | 2976 const GrowableObjectArray& pending_functions = |
| 2961 GrowableObjectArray::Handle(Z, T->pending_functions()); | 2977 GrowableObjectArray::Handle(Z, T->pending_functions()); |
| 2962 ASSERT(!pending_functions.IsNull()); | 2978 ASSERT(!pending_functions.IsNull()); |
| 2963 for (int i = 0; i < pending_functions.Length(); i++) { | 2979 for (int i = 0; i < pending_functions.Length(); i++) { |
| 2964 if (pending_functions.At(i) == current_function().raw()) { | 2980 if (pending_functions.At(i) == current_function().raw()) { |
| 2965 const String& fname = | 2981 const String& fname = |
| 2966 String::Handle(Z, current_function().UserVisibleName()); | 2982 String::Handle(Z, current_function().UserVisibleName()); |
| 2967 ReportError("circular dependency for function %s", fname.ToCString()); | 2983 const char* pending_function_dump = |
| 2984 DumpPendingFunctions(Z, pending_functions); | |
| 2985 ASSERT(pending_function_dump != NULL); | |
| 2986 ReportError("circular dependency for function %s\n%s", | |
| 2987 fname.ToCString(), | |
| 2988 pending_function_dump); | |
| 2968 } | 2989 } |
| 2969 } | 2990 } |
| 2970 ASSERT(!unregister_pending_function_); | 2991 ASSERT(!unregister_pending_function_); |
| 2971 pending_functions.Add(current_function(), Heap::kOld); | 2992 pending_functions.Add(current_function(), Heap::kOld); |
| 2972 unregister_pending_function_ = true; | 2993 unregister_pending_function_ = true; |
| 2973 } | 2994 } |
| 2974 | 2995 |
| 2975 | 2996 |
| 2976 // Parser is at the opening parenthesis of the formal parameter declaration | 2997 // Parser is at the opening parenthesis of the formal parameter declaration |
| 2977 // of function. Parse the formal parameters, initializers and code. | 2998 // of function. Parse the formal parameters, initializers and code. |
| (...skipping 11436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14414 const ArgumentListNode& function_args, | 14435 const ArgumentListNode& function_args, |
| 14415 const LocalVariable* temp_for_last_arg, | 14436 const LocalVariable* temp_for_last_arg, |
| 14416 bool is_super_invocation) { | 14437 bool is_super_invocation) { |
| 14417 UNREACHABLE(); | 14438 UNREACHABLE(); |
| 14418 return NULL; | 14439 return NULL; |
| 14419 } | 14440 } |
| 14420 | 14441 |
| 14421 } // namespace dart | 14442 } // namespace dart |
| 14422 | 14443 |
| 14423 #endif // DART_PRECOMPILED_RUNTIME | 14444 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |