Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: runtime/vm/parser.cc

Issue 1751523003: Dump functions on circular dependency parser error (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/observatory/tests/service/developer_extension_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); 44 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations.");
45 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef."); 45 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef.");
46 DEFINE_FLAG(bool, conditional_directives, false, 46 DEFINE_FLAG(bool, conditional_directives, false,
47 "Enable conditional directives"); 47 "Enable conditional directives");
48 DEFINE_FLAG(bool, warn_super, false, 48 DEFINE_FLAG(bool, warn_super, false,
49 "Warning if super initializer not last in initializer list."); 49 "Warning if super initializer not last in initializer list.");
50 DEFINE_FLAG(bool, await_is_keyword, false, 50 DEFINE_FLAG(bool, await_is_keyword, false,
51 "await and yield are treated as proper keywords in synchronous code."); 51 "await and yield are treated as proper keywords in synchronous code.");
52 52
53 DECLARE_FLAG(bool, profile_vm); 53 DECLARE_FLAG(bool, profile_vm);
54 DECLARE_FLAG(bool, trace_service);
54 55
55 // Quick access to the current thread, isolate and zone. 56 // Quick access to the current thread, isolate and zone.
56 #define T (thread()) 57 #define T (thread())
57 #define I (isolate()) 58 #define I (isolate())
58 #define Z (zone()) 59 #define Z (zone())
59 60
60 // Quick synthetic token position. 61 // Quick synthetic token position.
61 #define ST(token_pos) ((token_pos).ToSynthetic()) 62 #define ST(token_pos) ((token_pos).ToSynthetic())
62 63
63 #if defined(DEBUG) 64 #if defined(DEBUG)
(...skipping 2885 matching lines...) Expand 10 before | Expand all | Expand 10 after
2949 } 2950 }
2950 CheckFieldsInitialized(current_class()); 2951 CheckFieldsInitialized(current_class());
2951 2952
2952 // Empty constructor body. 2953 // Empty constructor body.
2953 current_block_->statements->Add(new ReturnNode(ST(ctor_pos))); 2954 current_block_->statements->Add(new ReturnNode(ST(ctor_pos)));
2954 SequenceNode* statements = CloseBlock(); 2955 SequenceNode* statements = CloseBlock();
2955 return statements; 2956 return statements;
2956 } 2957 }
2957 2958
2958 2959
2960 // Returns a zone allocated string.
2961 static char* DumpPendingFunctions(
2962 Zone* zone,
2963 const GrowableObjectArray& pending_functions) {
2964 ASSERT(zone != NULL);
2965 char* result = OS::SCreate(zone, "Pending Functions:\n");
2966 for (intptr_t i = 0; i < pending_functions.Length(); i++) {
2967 const Function& func =
2968 Function::Handle(zone, Function::RawCast(pending_functions.At(i)));
2969 const String& fname = String::Handle(zone, func.UserVisibleName());
2970 result = OS::SCreate(zone, "%s%" Pd ": %s\n", result, i, fname.ToCString());
2971 }
2972 return result;
2973 }
2974
2975
2959 void Parser::CheckRecursiveInvocation() { 2976 void Parser::CheckRecursiveInvocation() {
2960 const GrowableObjectArray& pending_functions = 2977 const GrowableObjectArray& pending_functions =
2961 GrowableObjectArray::Handle(Z, T->pending_functions()); 2978 GrowableObjectArray::Handle(Z, T->pending_functions());
2962 ASSERT(!pending_functions.IsNull()); 2979 ASSERT(!pending_functions.IsNull());
2963 for (int i = 0; i < pending_functions.Length(); i++) { 2980 for (int i = 0; i < pending_functions.Length(); i++) {
2964 if (pending_functions.At(i) == current_function().raw()) { 2981 if (pending_functions.At(i) == current_function().raw()) {
2965 const String& fname = 2982 const String& fname =
2966 String::Handle(Z, current_function().UserVisibleName()); 2983 String::Handle(Z, current_function().UserVisibleName());
2967 ReportError("circular dependency for function %s", fname.ToCString()); 2984 if (FLAG_trace_service) {
2985 const char* pending_function_dump =
2986 DumpPendingFunctions(Z, pending_functions);
2987 ASSERT(pending_function_dump != NULL);
2988 ReportError("circular dependency for function %s\n%s",
2989 fname.ToCString(),
2990 pending_function_dump);
2991 } else {
2992 ReportError("circular dependency for function %s", fname.ToCString());
2993 }
2968 } 2994 }
2969 } 2995 }
2970 ASSERT(!unregister_pending_function_); 2996 ASSERT(!unregister_pending_function_);
2971 pending_functions.Add(current_function(), Heap::kOld); 2997 pending_functions.Add(current_function(), Heap::kOld);
2972 unregister_pending_function_ = true; 2998 unregister_pending_function_ = true;
2973 } 2999 }
2974 3000
2975 3001
2976 // Parser is at the opening parenthesis of the formal parameter declaration 3002 // Parser is at the opening parenthesis of the formal parameter declaration
2977 // of function. Parse the formal parameters, initializers and code. 3003 // of function. Parse the formal parameters, initializers and code.
(...skipping 11436 matching lines...) Expand 10 before | Expand all | Expand 10 after
14414 const ArgumentListNode& function_args, 14440 const ArgumentListNode& function_args,
14415 const LocalVariable* temp_for_last_arg, 14441 const LocalVariable* temp_for_last_arg,
14416 bool is_super_invocation) { 14442 bool is_super_invocation) {
14417 UNREACHABLE(); 14443 UNREACHABLE();
14418 return NULL; 14444 return NULL;
14419 } 14445 }
14420 14446
14421 } // namespace dart 14447 } // namespace dart
14422 14448
14423 #endif // DART_PRECOMPILED_RUNTIME 14449 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/developer_extension_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698