@@ -51,6 +51,7 @@ DEFINE_FLAG(bool, await_is_keyword, false,
51
51
"await and yield are treated as proper keywords in synchronous code.");
52
52
53
53
DECLARE_FLAG(bool, profile_vm);
54
+ DECLARE_FLAG(bool, trace_service);
54
55
55
56
// Quick access to the current thread, isolate and zone.
56
57
#define T (thread())
@@ -2956,6 +2957,22 @@ SequenceNode* Parser::MakeImplicitConstructor(const Function& func) {
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
2976
void Parser::CheckRecursiveInvocation() {
2960
2977
const GrowableObjectArray& pending_functions =
2961
2978
GrowableObjectArray::Handle(Z, T->pending_functions());
@@ -2964,7 +2981,16 @@ void Parser::CheckRecursiveInvocation() {
2964
2981
if (pending_functions.At(i) == current_function().raw()) {
2965
2982
const String& fname =
2966
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
2996
ASSERT(!unregister_pending_function_);
0 commit comments