Chromium Code Reviews| Index: runtime/vm/parser.cc |
| diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
| index b4e3ac90af693b1137aa2faa1fd1b18be23d2a80..ba281af8eecf10ccb57e49b55f8965897dcbfc03 100644 |
| --- a/runtime/vm/parser.cc |
| +++ b/runtime/vm/parser.cc |
| @@ -2956,6 +2956,22 @@ SequenceNode* Parser::MakeImplicitConstructor(const Function& func) { |
| } |
| +// Returns a zone allocated string. |
| +static char* DumpPendingFunctions( |
| + Zone* zone, |
| + const GrowableObjectArray& pending_functions) { |
| + ASSERT(zone != NULL); |
| + char* result = OS::SCreate(zone, "Pending Functions:\n"); |
| + for (intptr_t i = 0; i < pending_functions.Length(); i++) { |
| + const Function& func = |
| + Function::Handle(zone, Function::RawCast(pending_functions.At(i))); |
| + const String& fname = String::Handle(zone, func.UserVisibleName()); |
| + 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
|
| + } |
| + return result; |
| +} |
| + |
| + |
| void Parser::CheckRecursiveInvocation() { |
| const GrowableObjectArray& pending_functions = |
| GrowableObjectArray::Handle(Z, T->pending_functions()); |
| @@ -2964,7 +2980,12 @@ void Parser::CheckRecursiveInvocation() { |
| if (pending_functions.At(i) == current_function().raw()) { |
| const String& fname = |
| String::Handle(Z, current_function().UserVisibleName()); |
| - ReportError("circular dependency for function %s", fname.ToCString()); |
| + const char* pending_function_dump = |
| + DumpPendingFunctions(Z, pending_functions); |
| + ASSERT(pending_function_dump != NULL); |
| + ReportError("circular dependency for function %s\n%s", |
| + fname.ToCString(), |
| + pending_function_dump); |
| } |
| } |
| ASSERT(!unregister_pending_function_); |