| OLD | NEW |
| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // committed to the current version. | 52 // committed to the current version. |
| 53 DEFINE_FLAG(bool, | 53 DEFINE_FLAG(bool, |
| 54 conditional_directives, | 54 conditional_directives, |
| 55 true, | 55 true, |
| 56 "Enable conditional directives"); | 56 "Enable conditional directives"); |
| 57 DEFINE_FLAG(bool, | 57 DEFINE_FLAG(bool, |
| 58 generic_method_syntax, | 58 generic_method_syntax, |
| 59 true, | 59 true, |
| 60 "Enable generic function syntax."); | 60 "Enable generic function syntax."); |
| 61 DEFINE_FLAG(bool, | 61 DEFINE_FLAG(bool, |
| 62 generic_method_semantics, | |
| 63 false, | |
| 64 "Enable generic function semantics (not yet supported)."); | |
| 65 DEFINE_FLAG(bool, | |
| 66 initializing_formal_access, | 62 initializing_formal_access, |
| 67 true, | 63 true, |
| 68 "Make initializing formal parameters visible in initializer list."); | 64 "Make initializing formal parameters visible in initializer list."); |
| 69 DEFINE_FLAG(bool, | 65 DEFINE_FLAG(bool, |
| 70 warn_super, | 66 warn_super, |
| 71 false, | 67 false, |
| 72 "Warning if super initializer not last in initializer list."); | 68 "Warning if super initializer not last in initializer list."); |
| 73 DEFINE_FLAG( | 69 DEFINE_FLAG( |
| 74 bool, | 70 bool, |
| 75 await_is_keyword, | 71 await_is_keyword, |
| (...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 kTestOnly); | 1171 kTestOnly); |
| 1176 } else { | 1172 } else { |
| 1177 instantiator = parser.LookupReceiver(node_sequence->scope(), kTestOnly); | 1173 instantiator = parser.LookupReceiver(node_sequence->scope(), kTestOnly); |
| 1178 } | 1174 } |
| 1179 if (!parser.current_function().IsLocalFunction() || | 1175 if (!parser.current_function().IsLocalFunction() || |
| 1180 ((instantiator != NULL) && instantiator->is_captured())) { | 1176 ((instantiator != NULL) && instantiator->is_captured())) { |
| 1181 parsed_function->set_instantiator(instantiator); | 1177 parsed_function->set_instantiator(instantiator); |
| 1182 } | 1178 } |
| 1183 } | 1179 } |
| 1184 // ParseFunc has recorded the generic function type arguments variable. | 1180 // ParseFunc has recorded the generic function type arguments variable. |
| 1185 ASSERT(!FLAG_generic_method_semantics || | 1181 ASSERT(!FLAG_reify_generic_functions || |
| 1186 !parser.current_function().IsGeneric() || | 1182 !parser.current_function().IsGeneric() || |
| 1187 (parsed_function->function_type_arguments() != NULL)); | 1183 (parsed_function->function_type_arguments() != NULL)); |
| 1188 } | 1184 } |
| 1189 | 1185 |
| 1190 | 1186 |
| 1191 RawObject* Parser::ParseMetadata(const Field& meta_data) { | 1187 RawObject* Parser::ParseMetadata(const Field& meta_data) { |
| 1192 LongJumpScope jump; | 1188 LongJumpScope jump; |
| 1193 if (setjmp(*jump.Set()) == 0) { | 1189 if (setjmp(*jump.Set()) == 0) { |
| 1194 Thread* thread = Thread::Current(); | 1190 Thread* thread = Thread::Current(); |
| 1195 StackZone stack_zone(thread); | 1191 StackZone stack_zone(thread); |
| (...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3457 | 3453 |
| 3458 if (func.IsGenerativeConstructor()) { | 3454 if (func.IsGenerativeConstructor()) { |
| 3459 SequenceNode* statements = ParseConstructor(func); | 3455 SequenceNode* statements = ParseConstructor(func); |
| 3460 last_used_try_index_ = saved_try_index; | 3456 last_used_try_index_ = saved_try_index; |
| 3461 return statements; | 3457 return statements; |
| 3462 } | 3458 } |
| 3463 | 3459 |
| 3464 ASSERT(!func.IsGenerativeConstructor()); | 3460 ASSERT(!func.IsGenerativeConstructor()); |
| 3465 OpenFunctionBlock(func); // Build local scope for function. | 3461 OpenFunctionBlock(func); // Build local scope for function. |
| 3466 | 3462 |
| 3467 if (FLAG_generic_method_semantics && func.IsGeneric()) { | 3463 if (FLAG_reify_generic_functions && func.IsGeneric()) { |
| 3468 // Lookup function type arguments variable in parent function scope, if any. | 3464 // Lookup function type arguments variable in parent function scope, if any. |
| 3469 if (func.HasGenericParent()) { | 3465 if (func.HasGenericParent()) { |
| 3470 const String* variable_name = &Symbols::FunctionTypeArgumentsVar(); | 3466 const String* variable_name = &Symbols::FunctionTypeArgumentsVar(); |
| 3471 LocalVariable* parent_type_arguments = | 3467 LocalVariable* parent_type_arguments = |
| 3472 current_block_->scope->LookupVariable(*variable_name, true); | 3468 current_block_->scope->LookupVariable(*variable_name, true); |
| 3473 ASSERT(parent_type_arguments != NULL); | 3469 ASSERT(parent_type_arguments != NULL); |
| 3474 // TODO(regis): It may be too early to capture parent_type_arguments here. | 3470 // TODO(regis): It may be too early to capture parent_type_arguments here. |
| 3475 // In case it is never used, we could save capturing and concatenating. | 3471 // In case it is never used, we could save capturing and concatenating. |
| 3476 current_block_->scope->CaptureVariable(parent_type_arguments); | 3472 current_block_->scope->CaptureVariable(parent_type_arguments); |
| 3477 parsed_function_->set_parent_type_arguments(parent_type_arguments); | 3473 parsed_function_->set_parent_type_arguments(parent_type_arguments); |
| (...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5523 for (intptr_t i = 0; i < index; i++) { | 5519 for (intptr_t i = 0; i < index; i++) { |
| 5524 existing_type_parameter ^= type_parameters_array.At(i)->raw(); | 5520 existing_type_parameter ^= type_parameters_array.At(i)->raw(); |
| 5525 existing_type_parameter_name = existing_type_parameter.name(); | 5521 existing_type_parameter_name = existing_type_parameter.name(); |
| 5526 if (existing_type_parameter_name.Equals(type_parameter_name)) { | 5522 if (existing_type_parameter_name.Equals(type_parameter_name)) { |
| 5527 ReportError(type_parameter_pos, "duplicate type parameter '%s'", | 5523 ReportError(type_parameter_pos, "duplicate type parameter '%s'", |
| 5528 type_parameter_name.ToCString()); | 5524 type_parameter_name.ToCString()); |
| 5529 } | 5525 } |
| 5530 } | 5526 } |
| 5531 if ((CurrentToken() == Token::kEXTENDS) || | 5527 if ((CurrentToken() == Token::kEXTENDS) || |
| 5532 (!parameterizing_class && (CurrentToken() == Token::kSUPER))) { | 5528 (!parameterizing_class && (CurrentToken() == Token::kSUPER))) { |
| 5529 const bool is_lower_bound = CurrentToken() == Token::kSUPER; |
| 5533 ConsumeToken(); | 5530 ConsumeToken(); |
| 5534 // TODO(regis): Handle 'super' differently than 'extends'. | |
| 5535 // A bound may refer to the owner of the type parameter it applies to, | 5531 // A bound may refer to the owner of the type parameter it applies to, |
| 5536 // i.e. to the class or function currently being parsed. | 5532 // i.e. to the class or function currently being parsed. |
| 5537 // Postpone resolution in order to avoid resolving the owner and its | 5533 // Postpone resolution in order to avoid resolving the owner and its |
| 5538 // type parameters, as they are not fully parsed yet. | 5534 // type parameters, as they are not fully parsed yet. |
| 5539 type_parameter_bound = ParseType(ClassFinalizer::kDoNotResolve); | 5535 type_parameter_bound = ParseType(ClassFinalizer::kDoNotResolve); |
| 5536 if (is_lower_bound) { |
| 5537 // TODO(regis): Handle 'super' differently than 'extends' if lower |
| 5538 // bounds make it in the final specification and if run time support |
| 5539 // for lower bounds is required. |
| 5540 // For now, we parse but ignore lower bounds and only support upper |
| 5541 // bounds. |
| 5542 type_parameter_bound = I->object_store()->object_type(); |
| 5543 } |
| 5540 } else { | 5544 } else { |
| 5541 type_parameter_bound = I->object_store()->object_type(); | 5545 type_parameter_bound = I->object_store()->object_type(); |
| 5542 } | 5546 } |
| 5543 // Note that we cannot yet calculate the final index of a function type | 5547 // Note that we cannot yet calculate the final index of a function type |
| 5544 // parameter, because we may not have parsed the parent function yet. | 5548 // parameter, because we may not have parsed the parent function yet. |
| 5545 type_parameter = TypeParameter::New( | 5549 type_parameter = TypeParameter::New( |
| 5546 parameterizing_class ? current_class() : Class::Handle(Z), | 5550 parameterizing_class ? current_class() : Class::Handle(Z), |
| 5547 parameterizing_class ? Function::Handle(Z) : innermost_function(), | 5551 parameterizing_class ? Function::Handle(Z) : innermost_function(), |
| 5548 index, type_parameter_name, type_parameter_bound, declaration_pos); | 5552 index, type_parameter_name, type_parameter_bound, declaration_pos); |
| 5549 type_parameters_array.Add( | 5553 type_parameters_array.Add( |
| (...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6890 body = found_func.raw(); | 6894 body = found_func.raw(); |
| 6891 body_closure_name = body.name(); | 6895 body_closure_name = body.name(); |
| 6892 } else { | 6896 } else { |
| 6893 // Create the closure containing the body of this generator function. | 6897 // Create the closure containing the body of this generator function. |
| 6894 String& generator_name = String::Handle(Z, innermost_function().name()); | 6898 String& generator_name = String::Handle(Z, innermost_function().name()); |
| 6895 body_closure_name = | 6899 body_closure_name = |
| 6896 Symbols::NewFormatted(T, "<%s_sync_body>", generator_name.ToCString()); | 6900 Symbols::NewFormatted(T, "<%s_sync_body>", generator_name.ToCString()); |
| 6897 body = Function::NewClosureFunction(body_closure_name, innermost_function(), | 6901 body = Function::NewClosureFunction(body_closure_name, innermost_function(), |
| 6898 func_pos); | 6902 func_pos); |
| 6899 body.set_is_generated_body(true); | 6903 body.set_is_generated_body(true); |
| 6904 // TODO(regis): Handle generic generator function. |
| 6900 body.set_result_type(Object::dynamic_type()); | 6905 body.set_result_type(Object::dynamic_type()); |
| 6901 is_new_closure = true; | 6906 is_new_closure = true; |
| 6902 } | 6907 } |
| 6903 | 6908 |
| 6904 ParamList closure_params; | 6909 ParamList closure_params; |
| 6905 AddSyncGenClosureParameters(&closure_params); | 6910 AddSyncGenClosureParameters(&closure_params); |
| 6906 | 6911 |
| 6907 if (is_new_closure) { | 6912 if (is_new_closure) { |
| 6908 // Add the parameters to the newly created closure. | 6913 // Add the parameters to the newly created closure. |
| 6909 AddFormalParamsToFunction(&closure_params, body); | 6914 AddFormalParamsToFunction(&closure_params, body); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7018 } else { | 7023 } else { |
| 7019 // Create the closure containing the body of this async function. | 7024 // Create the closure containing the body of this async function. |
| 7020 const String& async_func_name = | 7025 const String& async_func_name = |
| 7021 String::Handle(Z, innermost_function().name()); | 7026 String::Handle(Z, innermost_function().name()); |
| 7022 String& closure_name = | 7027 String& closure_name = |
| 7023 String::Handle(Z, Symbols::NewFormatted(T, "<%s_async_body>", | 7028 String::Handle(Z, Symbols::NewFormatted(T, "<%s_async_body>", |
| 7024 async_func_name.ToCString())); | 7029 async_func_name.ToCString())); |
| 7025 closure = Function::NewClosureFunction(closure_name, innermost_function(), | 7030 closure = Function::NewClosureFunction(closure_name, innermost_function(), |
| 7026 async_func_pos); | 7031 async_func_pos); |
| 7027 closure.set_is_generated_body(true); | 7032 closure.set_is_generated_body(true); |
| 7033 // TODO(regis): Handle generic async function. |
| 7028 closure.set_result_type(Object::dynamic_type()); | 7034 closure.set_result_type(Object::dynamic_type()); |
| 7029 is_new_closure = true; | 7035 is_new_closure = true; |
| 7030 } | 7036 } |
| 7031 // Create the parameter list for the async body closure. | 7037 // Create the parameter list for the async body closure. |
| 7032 ParamList closure_params; | 7038 ParamList closure_params; |
| 7033 AddAsyncClosureParameters(&closure_params); | 7039 AddAsyncClosureParameters(&closure_params); |
| 7034 if (is_new_closure) { | 7040 if (is_new_closure) { |
| 7035 // Add the parameters to the newly created closure. | 7041 // Add the parameters to the newly created closure. |
| 7036 AddFormalParamsToFunction(&closure_params, closure); | 7042 AddFormalParamsToFunction(&closure_params, closure); |
| 7037 ResolveSignature(closure); | 7043 ResolveSignature(closure); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7154 } else { | 7160 } else { |
| 7155 // Create the closure containing the body of this async generator function. | 7161 // Create the closure containing the body of this async generator function. |
| 7156 const String& async_generator_name = | 7162 const String& async_generator_name = |
| 7157 String::Handle(Z, innermost_function().name()); | 7163 String::Handle(Z, innermost_function().name()); |
| 7158 const String& closure_name = String::Handle( | 7164 const String& closure_name = String::Handle( |
| 7159 Z, Symbols::NewFormatted(T, "<%s_async_gen_body>", | 7165 Z, Symbols::NewFormatted(T, "<%s_async_gen_body>", |
| 7160 async_generator_name.ToCString())); | 7166 async_generator_name.ToCString())); |
| 7161 closure = Function::NewClosureFunction(closure_name, innermost_function(), | 7167 closure = Function::NewClosureFunction(closure_name, innermost_function(), |
| 7162 async_func_pos); | 7168 async_func_pos); |
| 7163 closure.set_is_generated_body(true); | 7169 closure.set_is_generated_body(true); |
| 7170 // TODO(regis): Handle generic async generator function. |
| 7164 closure.set_result_type(Object::dynamic_type()); | 7171 closure.set_result_type(Object::dynamic_type()); |
| 7165 is_new_closure = true; | 7172 is_new_closure = true; |
| 7166 } | 7173 } |
| 7167 | 7174 |
| 7168 ParamList closure_params; | 7175 ParamList closure_params; |
| 7169 AddAsyncGenClosureParameters(&closure_params); | 7176 AddAsyncGenClosureParameters(&closure_params); |
| 7170 | 7177 |
| 7171 if (is_new_closure) { | 7178 if (is_new_closure) { |
| 7172 // Add the parameters to the newly created closure. | 7179 // Add the parameters to the newly created closure. |
| 7173 AddFormalParamsToFunction(&closure_params, closure); | 7180 AddFormalParamsToFunction(&closure_params, closure); |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7735 ? &Symbols::TypeArgumentsParameter() | 7742 ? &Symbols::TypeArgumentsParameter() |
| 7736 : &Symbols::This(); | 7743 : &Symbols::This(); |
| 7737 current_block_->scope->CaptureVariable( | 7744 current_block_->scope->CaptureVariable( |
| 7738 current_block_->scope->LookupVariable(*variable_name, true)); | 7745 current_block_->scope->LookupVariable(*variable_name, true)); |
| 7739 } | 7746 } |
| 7740 | 7747 |
| 7741 | 7748 |
| 7742 void Parser::CaptureFunctionTypeArguments() { | 7749 void Parser::CaptureFunctionTypeArguments() { |
| 7743 ASSERT(InGenericFunctionScope()); | 7750 ASSERT(InGenericFunctionScope()); |
| 7744 ASSERT(FunctionLevel() > 0); | 7751 ASSERT(FunctionLevel() > 0); |
| 7745 if (!FLAG_generic_method_semantics) { | 7752 if (!FLAG_reify_generic_functions) { |
| 7746 return; | 7753 return; |
| 7747 } | 7754 } |
| 7748 const String* variable_name = &Symbols::FunctionTypeArgumentsVar(); | 7755 const String* variable_name = &Symbols::FunctionTypeArgumentsVar(); |
| 7749 current_block_->scope->CaptureVariable( | 7756 current_block_->scope->CaptureVariable( |
| 7750 current_block_->scope->LookupVariable(*variable_name, true)); | 7757 current_block_->scope->LookupVariable(*variable_name, true)); |
| 7751 } | 7758 } |
| 7752 | 7759 |
| 7753 | 7760 |
| 7754 void Parser::CaptureAllInstantiators() { | 7761 void Parser::CaptureAllInstantiators() { |
| 7755 if (IsInstantiatorRequired()) { | 7762 if (IsInstantiatorRequired()) { |
| (...skipping 4133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11889 "from static function", | 11896 "from static function", |
| 11890 name.ToCString()); | 11897 name.ToCString()); |
| 11891 } | 11898 } |
| 11892 if (FunctionLevel() > 0) { | 11899 if (FunctionLevel() > 0) { |
| 11893 // Make sure that the class instantiator is captured. | 11900 // Make sure that the class instantiator is captured. |
| 11894 CaptureInstantiator(); | 11901 CaptureInstantiator(); |
| 11895 } | 11902 } |
| 11896 type_parameter ^= CanonicalizeType(type_parameter); | 11903 type_parameter ^= CanonicalizeType(type_parameter); |
| 11897 } else { | 11904 } else { |
| 11898 ASSERT(type_parameter.IsFunctionTypeParameter()); | 11905 ASSERT(type_parameter.IsFunctionTypeParameter()); |
| 11899 if (!FLAG_generic_method_semantics) { | 11906 if (!FLAG_reify_generic_functions) { |
| 11900 Type& type = Type::ZoneHandle(Z, Type::DynamicType()); | 11907 Type& type = Type::ZoneHandle(Z, Type::DynamicType()); |
| 11901 return new (Z) TypeNode(primary_pos, type); | 11908 return new (Z) TypeNode(primary_pos, type); |
| 11902 } | 11909 } |
| 11903 if (FunctionLevel() > 0) { | 11910 if (FunctionLevel() > 0) { |
| 11904 // Make sure that the parent function type arguments are captured. | 11911 // Make sure that the parent function type arguments are captured. |
| 11905 CaptureFunctionTypeArguments(); | 11912 CaptureFunctionTypeArguments(); |
| 11906 } | 11913 } |
| 11907 } | 11914 } |
| 11908 ASSERT(type_parameter.IsFinalized()); | 11915 ASSERT(type_parameter.IsFinalized()); |
| 11909 ASSERT(!type_parameter.IsMalformed()); | 11916 ASSERT(!type_parameter.IsMalformed()); |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12398 // A type parameter cannot be parameterized, so make the type | 12405 // A type parameter cannot be parameterized, so make the type |
| 12399 // malformed if type arguments have previously been parsed. | 12406 // malformed if type arguments have previously been parsed. |
| 12400 if (type->arguments() != TypeArguments::null()) { | 12407 if (type->arguments() != TypeArguments::null()) { |
| 12401 *type = ClassFinalizer::NewFinalizedMalformedType( | 12408 *type = ClassFinalizer::NewFinalizedMalformedType( |
| 12402 Error::Handle(Z), // No previous error. | 12409 Error::Handle(Z), // No previous error. |
| 12403 script_, type_parameter.token_pos(), | 12410 script_, type_parameter.token_pos(), |
| 12404 "type parameter '%s' cannot be parameterized", | 12411 "type parameter '%s' cannot be parameterized", |
| 12405 String::Handle(Z, type_parameter.name()).ToCString()); | 12412 String::Handle(Z, type_parameter.name()).ToCString()); |
| 12406 return; | 12413 return; |
| 12407 } | 12414 } |
| 12408 if (FLAG_generic_method_semantics) { | 12415 if (FLAG_reify_generic_functions) { |
| 12409 ASSERT(!type_parameter.IsMalformed()); | 12416 ASSERT(!type_parameter.IsMalformed()); |
| 12410 *type = type_parameter.raw(); | 12417 *type = type_parameter.raw(); |
| 12411 } else { | 12418 } else { |
| 12412 *type = Type::DynamicType(); | 12419 *type = Type::DynamicType(); |
| 12413 } | 12420 } |
| 12414 return; | 12421 return; |
| 12415 } | 12422 } |
| 12416 } | 12423 } |
| 12417 // Then check if the type is a class type parameter. | 12424 // Then check if the type is a class type parameter. |
| 12418 const TypeParameter& type_parameter = TypeParameter::Handle( | 12425 const TypeParameter& type_parameter = TypeParameter::Handle( |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13004 ResolveIdentInLocalScope(ident_pos, ident, &resolved, &resolved_func_level); | 13011 ResolveIdentInLocalScope(ident_pos, ident, &resolved, &resolved_func_level); |
| 13005 if (InGenericFunctionScope()) { | 13012 if (InGenericFunctionScope()) { |
| 13006 intptr_t type_param_func_level = FunctionLevel(); | 13013 intptr_t type_param_func_level = FunctionLevel(); |
| 13007 const TypeParameter& type_parameter = | 13014 const TypeParameter& type_parameter = |
| 13008 TypeParameter::ZoneHandle(Z, innermost_function().LookupTypeParameter( | 13015 TypeParameter::ZoneHandle(Z, innermost_function().LookupTypeParameter( |
| 13009 ident, &type_param_func_level)); | 13016 ident, &type_param_func_level)); |
| 13010 if (!type_parameter.IsNull()) { | 13017 if (!type_parameter.IsNull()) { |
| 13011 if ((resolved == NULL) || (resolved_func_level < type_param_func_level)) { | 13018 if ((resolved == NULL) || (resolved_func_level < type_param_func_level)) { |
| 13012 // The identifier is a function type parameter, possibly shadowing | 13019 // The identifier is a function type parameter, possibly shadowing |
| 13013 // 'resolved'. | 13020 // 'resolved'. |
| 13014 if (!FLAG_generic_method_semantics) { | 13021 if (!FLAG_reify_generic_functions) { |
| 13015 Type& type = Type::ZoneHandle(Z, Type::DynamicType()); | 13022 Type& type = Type::ZoneHandle(Z, Type::DynamicType()); |
| 13016 return new (Z) TypeNode(ident_pos, type); | 13023 return new (Z) TypeNode(ident_pos, type); |
| 13017 } | 13024 } |
| 13018 ASSERT(type_parameter.IsFinalized()); | 13025 ASSERT(type_parameter.IsFinalized()); |
| 13019 ASSERT(!type_parameter.IsMalformed()); | 13026 ASSERT(!type_parameter.IsMalformed()); |
| 13020 return new (Z) TypeNode(ident_pos, type_parameter); | 13027 return new (Z) TypeNode(ident_pos, type_parameter); |
| 13021 } | 13028 } |
| 13022 } | 13029 } |
| 13023 } | 13030 } |
| 13024 if (resolved == NULL) { | 13031 if (resolved == NULL) { |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13852 ParseFormalParameters(ctr, ¶ms); | 13859 ParseFormalParameters(ctr, ¶ms); |
| 13853 // Per language spec, the type of the closure parameters is dynamic. | 13860 // Per language spec, the type of the closure parameters is dynamic. |
| 13854 // Replace the types parsed from the constructor. | 13861 // Replace the types parsed from the constructor. |
| 13855 params.EraseParameterTypes(); | 13862 params.EraseParameterTypes(); |
| 13856 | 13863 |
| 13857 closure = Function::NewClosureFunction(closure_name, innermost_function(), | 13864 closure = Function::NewClosureFunction(closure_name, innermost_function(), |
| 13858 token_pos); | 13865 token_pos); |
| 13859 closure.set_is_generated_body(true); | 13866 closure.set_is_generated_body(true); |
| 13860 closure.set_is_debuggable(false); | 13867 closure.set_is_debuggable(false); |
| 13861 closure.set_is_visible(false); | 13868 closure.set_is_visible(false); |
| 13869 // TODO(regis): Verify that the closure cannot be generic. |
| 13862 closure.set_result_type(Object::dynamic_type()); | 13870 closure.set_result_type(Object::dynamic_type()); |
| 13863 AddFormalParamsToFunction(¶ms, closure); | 13871 AddFormalParamsToFunction(¶ms, closure); |
| 13864 ResolveSignature(closure); | 13872 ResolveSignature(closure); |
| 13865 | 13873 |
| 13866 // Finalize function type. | 13874 // Finalize function type. |
| 13867 Type& signature_type = Type::Handle(Z, closure.SignatureType()); | 13875 Type& signature_type = Type::Handle(Z, closure.SignatureType()); |
| 13868 signature_type ^= CanonicalizeType(signature_type); | 13876 signature_type ^= CanonicalizeType(signature_type); |
| 13869 closure.SetSignatureType(signature_type); | 13877 closure.SetSignatureType(signature_type); |
| 13870 // Finalization would be premature when top-level parsing. | 13878 // Finalization would be premature when top-level parsing. |
| 13871 ASSERT(!is_top_level_); | 13879 ASSERT(!is_top_level_); |
| (...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15162 const ArgumentListNode& function_args, | 15170 const ArgumentListNode& function_args, |
| 15163 const LocalVariable* temp_for_last_arg, | 15171 const LocalVariable* temp_for_last_arg, |
| 15164 bool is_super_invocation) { | 15172 bool is_super_invocation) { |
| 15165 UNREACHABLE(); | 15173 UNREACHABLE(); |
| 15166 return NULL; | 15174 return NULL; |
| 15167 } | 15175 } |
| 15168 | 15176 |
| 15169 } // namespace dart | 15177 } // namespace dart |
| 15170 | 15178 |
| 15171 #endif // DART_PRECOMPILED_RUNTIME | 15179 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |