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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/lib/lib.status » ('j') | 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 5044 matching lines...) Expand 10 before | Expand all | Expand 10 after
5055 // Parse the formal parameters of the function type. 5055 // Parse the formal parameters of the function type.
5056 CheckToken(Token::kLPAREN, "formal parameter list expected"); 5056 CheckToken(Token::kLPAREN, "formal parameter list expected");
5057 ParamList func_params; 5057 ParamList func_params;
5058 5058
5059 // Add implicit closure object parameter. 5059 // Add implicit closure object parameter.
5060 func_params.AddFinalParameter( 5060 func_params.AddFinalParameter(
5061 TokenPos(), 5061 TokenPos(),
5062 &Symbols::ClosureParameter(), 5062 &Symbols::ClosureParameter(),
5063 &Object::dynamic_type()); 5063 &Object::dynamic_type());
5064 5064
5065 // Mark the current class as a typedef class (by setting its signature
5066 // function field to a non-null function) before parsing its formal parameters
5067 // so that parsed function types are aware that their owner class is a
5068 // typedef class.
5069 Function& signature_function =
5070 Function::Handle(Z, Function::NewSignatureFunction(function_type_alias,
5071 alias_name_pos));
5072 // Set the signature function in the function type alias class.
5073 function_type_alias.set_signature_function(signature_function);
5074
5065 const bool no_explicit_default_values = false; 5075 const bool no_explicit_default_values = false;
5066 ParseFormalParameterList(no_explicit_default_values, false, &func_params); 5076 ParseFormalParameterList(no_explicit_default_values, false, &func_params);
5067 ExpectSemicolon(); 5077 ExpectSemicolon();
5068 Function& signature_function =
5069 Function::Handle(Z, Function::NewSignatureFunction(function_type_alias,
5070 alias_name_pos));
5071 signature_function.set_result_type(result_type); 5078 signature_function.set_result_type(result_type);
5072 AddFormalParamsToFunction(&func_params, signature_function); 5079 AddFormalParamsToFunction(&func_params, signature_function);
5073 5080
5074 // Set the signature function in the function type alias class.
5075 function_type_alias.set_signature_function(signature_function);
5076
5077 if (FLAG_trace_parser) { 5081 if (FLAG_trace_parser) {
5078 OS::Print("TopLevel parsing function type alias '%s'\n", 5082 OS::Print("TopLevel parsing function type alias '%s'\n",
5079 String::Handle(Z, signature_function.Signature()).ToCString()); 5083 String::Handle(Z, signature_function.Signature()).ToCString());
5080 } 5084 }
5081 // The alias should not be marked as finalized yet, since it needs to be 5085 // The alias should not be marked as finalized yet, since it needs to be
5082 // checked in the class finalizer for illegal self references. 5086 // checked in the class finalizer for illegal self references.
5083 ASSERT(!function_type_alias.is_finalized()); 5087 ASSERT(!function_type_alias.is_finalized());
5084 pending_classes.Add(function_type_alias, Heap::kOld); 5088 pending_classes.Add(function_type_alias, Heap::kOld);
5085 if (FLAG_enable_mirrors && metadata_pos.IsReal()) { 5089 if (FLAG_enable_mirrors && metadata_pos.IsReal()) {
5086 library_.AddClassMetadata(function_type_alias, 5090 library_.AddClassMetadata(function_type_alias,
(...skipping 9394 matching lines...) Expand 10 before | Expand all | Expand 10 after
14481 const ArgumentListNode& function_args, 14485 const ArgumentListNode& function_args,
14482 const LocalVariable* temp_for_last_arg, 14486 const LocalVariable* temp_for_last_arg,
14483 bool is_super_invocation) { 14487 bool is_super_invocation) {
14484 UNREACHABLE(); 14488 UNREACHABLE();
14485 return NULL; 14489 return NULL;
14486 } 14490 }
14487 14491
14488 } // namespace dart 14492 } // namespace dart
14489 14493
14490 #endif // DART_PRECOMPILED_RUNTIME 14494 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« 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