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

Unified Diff: runtime/vm/parser.cc

Issue 1890013002: Fix mirrors to keep typedef as scope class of function types (fixes #26187). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address comment Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index a1c0b546b7869d1c832a0826811083829f379e6c..63f69944271a36edd2cd3c1ea1bd04b8e908003f 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -5062,18 +5062,22 @@ void Parser::ParseTypedef(const GrowableObjectArray& pending_classes,
&Symbols::ClosureParameter(),
&Object::dynamic_type());
- const bool no_explicit_default_values = false;
- ParseFormalParameterList(no_explicit_default_values, false, &func_params);
- ExpectSemicolon();
+ // Mark the current class as a typedef class (by setting its signature
+ // function field to a non-null function) before parsing its formal parameters
+ // so that parsed function types are aware that their owner class is a
+ // typedef class.
Function& signature_function =
Function::Handle(Z, Function::NewSignatureFunction(function_type_alias,
alias_name_pos));
- signature_function.set_result_type(result_type);
- AddFormalParamsToFunction(&func_params, signature_function);
-
// Set the signature function in the function type alias class.
function_type_alias.set_signature_function(signature_function);
+ const bool no_explicit_default_values = false;
+ ParseFormalParameterList(no_explicit_default_values, false, &func_params);
+ ExpectSemicolon();
+ signature_function.set_result_type(result_type);
+ AddFormalParamsToFunction(&func_params, signature_function);
+
if (FLAG_trace_parser) {
OS::Print("TopLevel parsing function type alias '%s'\n",
String::Handle(Z, signature_function.Signature()).ToCString());
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698