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

Side by Side Diff: runtime/vm/parser.cc

Issue 1584223006: Remove signature classes from the VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
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 8 #ifndef DART_PRECOMPILED
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 ASSERT(desc.Count() > 0); 1617 ASSERT(desc.Count() > 0);
1618 1618
1619 // Set up scope for this function. 1619 // Set up scope for this function.
1620 BuildDispatcherScope(func, desc); 1620 BuildDispatcherScope(func, desc);
1621 1621
1622 // Receiver is local 0. 1622 // Receiver is local 0.
1623 LocalScope* scope = current_block_->scope; 1623 LocalScope* scope = current_block_->scope;
1624 ArgumentListNode* no_args = new ArgumentListNode(token_pos); 1624 ArgumentListNode* no_args = new ArgumentListNode(token_pos);
1625 LoadLocalNode* receiver = new LoadLocalNode(token_pos, scope->VariableAt(0)); 1625 LoadLocalNode* receiver = new LoadLocalNode(token_pos, scope->VariableAt(0));
1626 1626
1627 const Class& function_impl = Class::Handle(Type::Handle( 1627 const Class& closure_cls = Class::Handle(
1628 Isolate::Current()->object_store()->function_impl_type()).type_class()); 1628 Isolate::Current()->object_store()->closure_class());
1629 1629
1630 const Class& owner = Class::Handle(Z, func.Owner()); 1630 const Class& owner = Class::Handle(Z, func.Owner());
1631 ASSERT(!owner.IsNull()); 1631 ASSERT(!owner.IsNull());
1632 const String& name = String::Handle(Z, func.name()); 1632 const String& name = String::Handle(Z, func.name());
1633 AstNode* function_object = NULL; 1633 AstNode* function_object = NULL;
1634 if (owner.raw() == function_impl.raw() && name.Equals(Symbols::Call())) { 1634 if (owner.raw() == closure_cls.raw() && name.Equals(Symbols::Call())) {
1635 function_object = receiver; 1635 function_object = receiver;
1636 } else { 1636 } else {
1637 const String& getter_name = String::ZoneHandle(Z, 1637 const String& getter_name = String::ZoneHandle(Z,
1638 Symbols::New(String::Handle(Z, Field::GetterSymbol(name)))); 1638 Symbols::New(String::Handle(Z, Field::GetterSymbol(name))));
1639 function_object = new(Z) InstanceCallNode( 1639 function_object = new(Z) InstanceCallNode(
1640 token_pos, receiver, getter_name, no_args); 1640 token_pos, receiver, getter_name, no_args);
1641 } 1641 }
1642 1642
1643 // Pass arguments 1..n to the closure call. 1643 // Pass arguments 1..n to the closure call.
1644 ArgumentListNode* args = new(Z) ArgumentListNode(token_pos); 1644 ArgumentListNode* args = new(Z) ArgumentListNode(token_pos);
1645 const Array& names = Array::Handle( 1645 const Array& names = Array::Handle(
1646 Z, Array::New(desc.NamedCount(), Heap::kOld)); 1646 Z, Array::New(desc.NamedCount(), Heap::kOld));
1647 // Positional parameters. 1647 // Positional parameters.
1648 intptr_t i = 1; 1648 intptr_t i = 1;
1649 for (; i < desc.PositionalCount(); ++i) { 1649 for (; i < desc.PositionalCount(); ++i) {
1650 args->Add(new LoadLocalNode(token_pos, scope->VariableAt(i))); 1650 args->Add(new LoadLocalNode(token_pos, scope->VariableAt(i)));
1651 } 1651 }
1652 // Named parameters. 1652 // Named parameters.
1653 for (; i < desc.Count(); i++) { 1653 for (; i < desc.Count(); i++) {
1654 args->Add(new(Z) LoadLocalNode(token_pos, scope->VariableAt(i))); 1654 args->Add(new(Z) LoadLocalNode(token_pos, scope->VariableAt(i)));
1655 intptr_t index = i - desc.PositionalCount(); 1655 intptr_t index = i - desc.PositionalCount();
1656 names.SetAt(index, String::Handle(Z, desc.NameAt(index))); 1656 names.SetAt(index, String::Handle(Z, desc.NameAt(index)));
1657 } 1657 }
1658 args->set_names(names); 1658 args->set_names(names);
1659 1659
1660 AstNode* result = NULL; 1660 AstNode* result = NULL;
1661 if (owner.raw() == function_impl.raw() && name.Equals(Symbols::Call())) { 1661 if (owner.raw() == closure_cls.raw() && name.Equals(Symbols::Call())) {
1662 result = new ClosureCallNode(token_pos, function_object, args); 1662 result = new ClosureCallNode(token_pos, function_object, args);
1663 } else { 1663 } else {
1664 result = BuildClosureCall(token_pos, function_object, args); 1664 result = BuildClosureCall(token_pos, function_object, args);
1665 } 1665 }
1666 1666
1667 ReturnNode* return_node = new ReturnNode(token_pos, result); 1667 ReturnNode* return_node = new ReturnNode(token_pos, result);
1668 current_block_->statements->Add(return_node); 1668 current_block_->statements->Add(return_node);
1669 return CloseBlock(); 1669 return CloseBlock();
1670 } 1670 }
1671 1671
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 // Add implicit closure object parameter. 1872 // Add implicit closure object parameter.
1873 func_params.AddFinalParameter( 1873 func_params.AddFinalParameter(
1874 TokenPos(), 1874 TokenPos(),
1875 &Symbols::ClosureParameter(), 1875 &Symbols::ClosureParameter(),
1876 &Object::dynamic_type()); 1876 &Object::dynamic_type());
1877 1877
1878 const bool no_explicit_default_values = false; 1878 const bool no_explicit_default_values = false;
1879 ParseFormalParameterList(no_explicit_default_values, false, &func_params); 1879 ParseFormalParameterList(no_explicit_default_values, false, &func_params);
1880 1880
1881 // In top-level and mixin functions, the source may be in a different 1881 // In top-level and mixin functions, the source may be in a different
1882 // script than the script of the current class. 1882 // script than the script of the current class. However, we never reparse
1883 Object& sig_func_owner = Object::Handle(Z, current_class().raw()); 1883 // signature functions (except typedef signature functions), therefore
1884 if (current_class().script() != script_.raw()) { 1884 // we do not need to keep the correct script via a patch class. Use the
1885 sig_func_owner = PatchClass::New(current_class(), script_); 1885 // actual current class as owner of the signature function.
1886 const Function& signature_function = Function::Handle(Z,
1887 Function::NewSignatureFunction(current_class(),
1888 Scanner::kNoSourcePos));
1889 signature_function.set_result_type(result_type);
1890 AddFormalParamsToFunction(&func_params, signature_function);
1891 FunctionType& signature_type =
1892 FunctionType::ZoneHandle(Z, signature_function.SignatureType());
1893 if (!is_top_level_) {
1894 signature_type ^= ClassFinalizer::FinalizeType(
1895 current_class(), signature_type, ClassFinalizer::kCanonicalize);
1896 signature_function.SetSignatureType(signature_type);
1886 } 1897 }
1887
1888 // The field 'is_static' has no meaning for signature functions.
1889 const Function& signature_function = Function::Handle(Z,
1890 Function::New(*parameter.name,
1891 RawFunction::kSignatureFunction,
1892 /* is_static = */ false,
1893 /* is_const = */ false,
1894 /* is_abstract = */ false,
1895 /* is_external = */ false,
1896 /* is_native = */ false,
1897 sig_func_owner,
1898 parameter.name_pos));
1899 signature_function.set_result_type(result_type);
1900 signature_function.set_is_debuggable(false);
1901 AddFormalParamsToFunction(&func_params, signature_function);
1902 const String& signature =
1903 String::Handle(Z, signature_function.Signature());
1904 // Lookup the signature class, i.e. the class whose name is the signature.
1905 // We only lookup in the current library, but not in its imports, and only
1906 // create a new canonical signature class if it does not exist yet.
1907 Class& signature_class =
1908 Class::ZoneHandle(Z, library_.LookupLocalClass(signature));
1909 if (signature_class.IsNull()) {
1910 signature_class = Class::NewSignatureClass(signature,
1911 signature_function,
1912 script_,
1913 parameter.name_pos);
1914 // Record the function signature class in the current library, unless
1915 // we are currently skipping a formal parameter list, in which case
1916 // the signature class could remain unfinalized.
1917 if (!params->skipped) {
1918 library_.AddClass(signature_class);
1919 }
1920 } else {
1921 signature_function.set_signature_class(signature_class);
1922 }
1923 ASSERT(signature_function.signature_class() == signature_class.raw());
1924 if (!is_top_level_) {
1925 // Finalize types in signature class here, so that the
1926 // signature type is not computed twice.
1927 ClassFinalizer::FinalizeTypesInClass(signature_class);
1928 }
1929 const Type& signature_type =
1930 Type::ZoneHandle(Z, signature_class.SignatureType());
1931 ASSERT(is_top_level_ || signature_type.IsFinalized()); 1898 ASSERT(is_top_level_ || signature_type.IsFinalized());
1932 // A signature type itself cannot be malformed or malbounded, only its 1899 // A signature type itself cannot be malformed or malbounded, only its
1933 // signature function's result type or parameter types may be. 1900 // signature function's result type or parameter types may be.
1934 ASSERT(!signature_type.IsMalformed()); 1901 ASSERT(!signature_type.IsMalformed());
1935 ASSERT(!signature_type.IsMalbounded()); 1902 ASSERT(!signature_type.IsMalbounded());
1936 // The type of the parameter is now the signature type. 1903 // The type of the parameter is now the signature type.
1937 parameter.type = &signature_type; 1904 parameter.type = &signature_type;
1938 } 1905 }
1939 } 1906 }
1940 1907
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
2305 ClosureNode* Parser::CreateImplicitClosureNode(const Function& func, 2272 ClosureNode* Parser::CreateImplicitClosureNode(const Function& func,
2306 intptr_t token_pos, 2273 intptr_t token_pos,
2307 AstNode* receiver) { 2274 AstNode* receiver) {
2308 Function& implicit_closure_function = 2275 Function& implicit_closure_function =
2309 Function::ZoneHandle(Z, func.ImplicitClosureFunction()); 2276 Function::ZoneHandle(Z, func.ImplicitClosureFunction());
2310 if (receiver != NULL) { 2277 if (receiver != NULL) {
2311 // If we create an implicit instance closure from inside a closure of a 2278 // If we create an implicit instance closure from inside a closure of a
2312 // parameterized class, make sure that the receiver is captured as 2279 // parameterized class, make sure that the receiver is captured as
2313 // instantiator. 2280 // instantiator.
2314 if (current_block_->scope->function_level() > 0) { 2281 if (current_block_->scope->function_level() > 0) {
2315 const Class& signature_class = Class::Handle(Z, 2282 const FunctionType& signature_type = FunctionType::Handle(Z,
2316 implicit_closure_function.signature_class()); 2283 implicit_closure_function.SignatureType());
2317 if (signature_class.NumTypeParameters() > 0) { 2284 const Class& scope_class = Class::Handle(Z, signature_type.type_class());
2285 if (scope_class.IsGeneric()) {
2318 CaptureInstantiator(); 2286 CaptureInstantiator();
2319 } 2287 }
2320 } 2288 }
2321 } 2289 }
2322 return new ClosureNode(token_pos, implicit_closure_function, receiver, NULL); 2290 return new ClosureNode(token_pos, implicit_closure_function, receiver, NULL);
2323 } 2291 }
2324 2292
2325 2293
2326 AstNode* Parser::ParseSuperFieldAccess(const String& field_name, 2294 AstNode* Parser::ParseSuperFieldAccess(const String& field_name,
2327 intptr_t field_pos) { 2295 intptr_t field_pos) {
(...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after
4373 } else { 4341 } else {
4374 if (!obj.IsClass()) { 4342 if (!obj.IsClass()) {
4375 ReportError(classname_pos, "'%s' is already defined", 4343 ReportError(classname_pos, "'%s' is already defined",
4376 class_name.ToCString()); 4344 class_name.ToCString());
4377 } 4345 }
4378 cls ^= obj.raw(); 4346 cls ^= obj.raw();
4379 if (is_patch) { 4347 if (is_patch) {
4380 // Preserve and reuse the original type parameters and bounds since the 4348 // Preserve and reuse the original type parameters and bounds since the
4381 // ones defined in the patch class will not be finalized. 4349 // ones defined in the patch class will not be finalized.
4382 orig_type_parameters = cls.type_parameters(); 4350 orig_type_parameters = cls.type_parameters();
4383 // A patch class must be given the same name as the class it is patching,
4384 // otherwise the generic signature classes it defines will not match the
4385 // patched generic signature classes. Therefore, new signature classes
4386 // will be introduced and the original ones will not get finalized.
4387 cls = Class::New(class_name, script_, declaration_pos); 4351 cls = Class::New(class_name, script_, declaration_pos);
4388 cls.set_library(library_); 4352 cls.set_library(library_);
4389 } else { 4353 } else {
4390 // Not patching a class, but it has been found. This must be one of the 4354 // Not patching a class, but it has been found. This must be one of the
4391 // pre-registered classes from object.cc or a duplicate definition. 4355 // pre-registered classes from object.cc or a duplicate definition.
4392 if (!(cls.is_prefinalized() || 4356 if (!(cls.is_prefinalized() ||
4393 RawObject::IsImplicitFieldClassId(cls.id()))) { 4357 RawObject::IsImplicitFieldClassId(cls.id()))) {
4394 ReportError(classname_pos, "class '%s' is already defined", 4358 ReportError(classname_pos, "class '%s' is already defined",
4395 class_name.ToCString()); 4359 class_name.ToCString());
4396 } 4360 }
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
4960 4924
4961 // Lookup alias name and report an error if it is already defined in 4925 // Lookup alias name and report an error if it is already defined in
4962 // the library scope. 4926 // the library scope.
4963 const Object& obj = 4927 const Object& obj =
4964 Object::Handle(Z, library_.LookupLocalObject(*alias_name)); 4928 Object::Handle(Z, library_.LookupLocalObject(*alias_name));
4965 if (!obj.IsNull()) { 4929 if (!obj.IsNull()) {
4966 ReportError(alias_name_pos, 4930 ReportError(alias_name_pos,
4967 "'%s' is already defined", alias_name->ToCString()); 4931 "'%s' is already defined", alias_name->ToCString());
4968 } 4932 }
4969 4933
4970 // Create the function type alias signature class. It will be linked to its 4934 // Create the function type alias scope class. It will be linked to its
4971 // signature function after it has been parsed. The type parameters, in order 4935 // signature function after it has been parsed. The type parameters, in order
4972 // to be properly finalized, need to be associated to this signature class as 4936 // to be properly finalized, need to be associated to this scope class as
4973 // they are parsed. 4937 // they are parsed.
4974 const Class& function_type_alias = Class::Handle(Z, 4938 const Class& function_type_alias = Class::Handle(Z,
4975 Class::NewSignatureClass(*alias_name, 4939 Class::New(*alias_name, script_, declaration_pos));
4976 Function::Handle(Z), 4940 function_type_alias.set_is_synthesized_class();
4977 script_, 4941 function_type_alias.set_is_abstract();
4978 declaration_pos)); 4942 function_type_alias.set_is_prefinalized();
4979 library_.AddClass(function_type_alias); 4943 library_.AddClass(function_type_alias);
4980 set_current_class(function_type_alias); 4944 set_current_class(function_type_alias);
4981 // Parse the type parameters of the function type. 4945 // Parse the type parameters of the function type.
4982 ParseTypeParameters(function_type_alias); 4946 ParseTypeParameters(function_type_alias);
4983 // At this point, the type parameters have been parsed, so we can resolve the 4947 // At this point, the type parameters have been parsed, so we can resolve the
4984 // result type. 4948 // result type.
4985 if (!result_type.IsNull()) { 4949 if (!result_type.IsNull()) {
4986 ResolveTypeFromClass(function_type_alias, 4950 ResolveTypeFromClass(function_type_alias,
4987 ClassFinalizer::kResolveTypeParameters, 4951 ClassFinalizer::kResolveTypeParameters,
4988 &result_type); 4952 &result_type);
4989 } 4953 }
4990 // Parse the formal parameters of the function type. 4954 // Parse the formal parameters of the function type.
4991 CheckToken(Token::kLPAREN, "formal parameter list expected"); 4955 CheckToken(Token::kLPAREN, "formal parameter list expected");
4992 ParamList func_params; 4956 ParamList func_params;
4993 4957
4994 // Add implicit closure object parameter. 4958 // Add implicit closure object parameter.
4995 func_params.AddFinalParameter( 4959 func_params.AddFinalParameter(
4996 TokenPos(), 4960 TokenPos(),
4997 &Symbols::ClosureParameter(), 4961 &Symbols::ClosureParameter(),
4998 &Object::dynamic_type()); 4962 &Object::dynamic_type());
4999 4963
5000 const bool no_explicit_default_values = false; 4964 const bool no_explicit_default_values = false;
5001 ParseFormalParameterList(no_explicit_default_values, false, &func_params); 4965 ParseFormalParameterList(no_explicit_default_values, false, &func_params);
5002 ExpectSemicolon(); 4966 ExpectSemicolon();
5003 // The field 'is_static' has no meaning for signature functions. 4967 Function& signature_function =
5004 Function& signature_function = Function::Handle(Z, 4968 Function::Handle(Z, Function::NewSignatureFunction(function_type_alias,
5005 Function::New(*alias_name, 4969 alias_name_pos));
5006 RawFunction::kSignatureFunction,
5007 /* is_static = */ false,
5008 /* is_const = */ false,
5009 /* is_abstract = */ false,
5010 /* is_external = */ false,
5011 /* is_native = */ false,
5012 function_type_alias,
5013 alias_name_pos));
5014 signature_function.set_result_type(result_type); 4970 signature_function.set_result_type(result_type);
5015 signature_function.set_is_debuggable(false);
5016 AddFormalParamsToFunction(&func_params, signature_function); 4971 AddFormalParamsToFunction(&func_params, signature_function);
5017 4972
5018 // Patch the signature function in the signature class. 4973 // Set the signature function in the function type alias class.
5019 function_type_alias.PatchSignatureFunction(signature_function); 4974 function_type_alias.set_signature_function(signature_function);
5020 4975
5021 const String& signature = String::Handle(Z,
5022 signature_function.Signature());
5023 if (FLAG_trace_parser) { 4976 if (FLAG_trace_parser) {
5024 OS::Print("TopLevel parsing function type alias '%s'\n", 4977 OS::Print("TopLevel parsing function type alias '%s'\n",
5025 signature.ToCString()); 4978 String::Handle(Z, signature_function.Signature()).ToCString());
5026 } 4979 }
5027 // Lookup the signature class, i.e. the class whose name is the signature.
5028 // We only lookup in the current library, but not in its imports, and only
5029 // create a new canonical signature class if it does not exist yet.
5030 Class& signature_class =
5031 Class::ZoneHandle(Z, library_.LookupLocalClass(signature));
5032 if (signature_class.IsNull()) {
5033 signature_class = Class::NewSignatureClass(signature,
5034 signature_function,
5035 script_,
5036 alias_name_pos);
5037 // Record the function signature class in the current library.
5038 library_.AddClass(signature_class);
5039 } else {
5040 // Forget the just created signature function and use the existing one.
5041 signature_function = signature_class.signature_function();
5042 function_type_alias.PatchSignatureFunction(signature_function);
5043 }
5044 ASSERT(signature_function.signature_class() == signature_class.raw());
5045
5046 // The alias should not be marked as finalized yet, since it needs to be 4980 // The alias should not be marked as finalized yet, since it needs to be
5047 // checked in the class finalizer for illegal self references. 4981 // checked in the class finalizer for illegal self references.
5048 ASSERT(!function_type_alias.IsCanonicalSignatureClass());
5049 ASSERT(!function_type_alias.is_finalized()); 4982 ASSERT(!function_type_alias.is_finalized());
5050 pending_classes.Add(function_type_alias, Heap::kOld); 4983 pending_classes.Add(function_type_alias, Heap::kOld);
5051 if (FLAG_enable_mirrors && (metadata_pos >= 0)) { 4984 if (FLAG_enable_mirrors && (metadata_pos >= 0)) {
5052 library_.AddClassMetadata(function_type_alias, 4985 library_.AddClassMetadata(function_type_alias,
5053 tl_owner, 4986 tl_owner,
5054 metadata_pos); 4987 metadata_pos);
5055 } 4988 }
5056 } 4989 }
5057 4990
5058 4991
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
6544 is_new_closure = true; 6477 is_new_closure = true;
6545 } 6478 }
6546 6479
6547 ParamList closure_params; 6480 ParamList closure_params;
6548 AddSyncGenClosureParameters(&closure_params); 6481 AddSyncGenClosureParameters(&closure_params);
6549 6482
6550 if (is_new_closure) { 6483 if (is_new_closure) {
6551 // Add the parameters to the newly created closure. 6484 // Add the parameters to the newly created closure.
6552 AddFormalParamsToFunction(&closure_params, body); 6485 AddFormalParamsToFunction(&closure_params, body);
6553 6486
6554 // Create and set the signature class of the closure. 6487 // Finalize function type.
6555 const String& sig = String::Handle(Z, body.Signature()); 6488 FunctionType& signature_type =
6556 Class& sig_cls = Class::Handle(Z, library_.LookupLocalClass(sig)); 6489 FunctionType::Handle(Z, body.SignatureType());
6557 if (sig_cls.IsNull()) { 6490 signature_type ^= ClassFinalizer::FinalizeType(
6558 sig_cls = Class::NewSignatureClass(sig, body, script_, body.token_pos()); 6491 current_class(), signature_type, ClassFinalizer::kCanonicalize);
6559 library_.AddClass(sig_cls); 6492 body.SetSignatureType(signature_type);
6560 }
6561 body.set_signature_class(sig_cls);
6562 // Finalize types in signature class here, so that the
6563 // signature type is not computed twice.
6564 ClassFinalizer::FinalizeTypesInClass(sig_cls);
6565 const Type& sig_type = Type::Handle(Z, sig_cls.SignatureType());
6566 ASSERT(sig_type.IsFinalized());
6567 ASSERT(AbstractType::Handle(Z, body.result_type()).IsResolved()); 6493 ASSERT(AbstractType::Handle(Z, body.result_type()).IsResolved());
6568 ASSERT(body.NumParameters() == closure_params.parameters->length()); 6494 ASSERT(body.NumParameters() == closure_params.parameters->length());
6569 } 6495 }
6570 6496
6571 OpenFunctionBlock(body); 6497 OpenFunctionBlock(body);
6572 AddFormalParamsToScope(&closure_params, current_block_->scope); 6498 AddFormalParamsToScope(&closure_params, current_block_->scope);
6573 async_temp_scope_ = current_block_->scope; 6499 async_temp_scope_ = current_block_->scope;
6574 return body.raw(); 6500 return body.raw();
6575 } 6501 }
6576 6502
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
6681 closure.set_result_type(Object::dynamic_type()); 6607 closure.set_result_type(Object::dynamic_type());
6682 is_new_closure = true; 6608 is_new_closure = true;
6683 } 6609 }
6684 // Create the parameter list for the async body closure. 6610 // Create the parameter list for the async body closure.
6685 ParamList closure_params; 6611 ParamList closure_params;
6686 AddAsyncClosureParameters(&closure_params); 6612 AddAsyncClosureParameters(&closure_params);
6687 if (is_new_closure) { 6613 if (is_new_closure) {
6688 // Add the parameters to the newly created closure. 6614 // Add the parameters to the newly created closure.
6689 AddFormalParamsToFunction(&closure_params, closure); 6615 AddFormalParamsToFunction(&closure_params, closure);
6690 6616
6691 // Create and set the signature class of the closure. 6617 // Finalize function type.
6692 const String& sig = String::Handle(Z, closure.Signature()); 6618 FunctionType& signature_type =
6693 Class& sig_cls = Class::Handle(Z, library_.LookupLocalClass(sig)); 6619 FunctionType::Handle(Z, closure.SignatureType());
6694 if (sig_cls.IsNull()) { 6620 signature_type ^= ClassFinalizer::FinalizeType(
6695 sig_cls = 6621 current_class(), signature_type, ClassFinalizer::kCanonicalize);
6696 Class::NewSignatureClass(sig, closure, script_, closure.token_pos()); 6622 closure.SetSignatureType(signature_type);
6697 library_.AddClass(sig_cls);
6698 }
6699 closure.set_signature_class(sig_cls);
6700 // Finalize types in signature class here, so that the
6701 // signature type is not computed twice.
6702 ClassFinalizer::FinalizeTypesInClass(sig_cls);
6703 const Type& sig_type = Type::Handle(Z, sig_cls.SignatureType());
6704 ASSERT(sig_type.IsFinalized());
6705 ASSERT(AbstractType::Handle(Z, closure.result_type()).IsResolved()); 6623 ASSERT(AbstractType::Handle(Z, closure.result_type()).IsResolved());
6706 ASSERT(closure.NumParameters() == closure_params.parameters->length()); 6624 ASSERT(closure.NumParameters() == closure_params.parameters->length());
6707 } 6625 }
6708 OpenFunctionBlock(closure); 6626 OpenFunctionBlock(closure);
6709 AddFormalParamsToScope(&closure_params, current_block_->scope); 6627 AddFormalParamsToScope(&closure_params, current_block_->scope);
6710 async_temp_scope_ = current_block_->scope; 6628 async_temp_scope_ = current_block_->scope;
6711 return closure.raw(); 6629 return closure.raw();
6712 } 6630 }
6713 6631
6714 6632
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
6816 is_new_closure = true; 6734 is_new_closure = true;
6817 } 6735 }
6818 6736
6819 ParamList closure_params; 6737 ParamList closure_params;
6820 AddAsyncGenClosureParameters(&closure_params); 6738 AddAsyncGenClosureParameters(&closure_params);
6821 6739
6822 if (is_new_closure) { 6740 if (is_new_closure) {
6823 // Add the parameters to the newly created closure. 6741 // Add the parameters to the newly created closure.
6824 AddFormalParamsToFunction(&closure_params, closure); 6742 AddFormalParamsToFunction(&closure_params, closure);
6825 6743
6826 // Create and set the signature class of the closure. 6744 // Finalize function type.
6827 const String& sig = String::Handle(Z, closure.Signature()); 6745 FunctionType& signature_type =
6828 Class& sig_cls = Class::Handle(Z, library_.LookupLocalClass(sig)); 6746 FunctionType::Handle(Z, closure.SignatureType());
6829 if (sig_cls.IsNull()) { 6747 signature_type ^= ClassFinalizer::FinalizeType(
6830 sig_cls = 6748 current_class(), signature_type, ClassFinalizer::kCanonicalize);
6831 Class::NewSignatureClass(sig, closure, script_, closure.token_pos()); 6749 closure.SetSignatureType(signature_type);
6832 library_.AddClass(sig_cls);
6833 }
6834 closure.set_signature_class(sig_cls);
6835 // Finalize types in signature class here, so that the
6836 // signature type is not computed twice.
6837 ClassFinalizer::FinalizeTypesInClass(sig_cls);
6838 const Type& sig_type = Type::Handle(Z, sig_cls.SignatureType());
6839 ASSERT(sig_type.IsFinalized());
6840 ASSERT(AbstractType::Handle(Z, closure.result_type()).IsResolved()); 6750 ASSERT(AbstractType::Handle(Z, closure.result_type()).IsResolved());
6841 ASSERT(closure.NumParameters() == closure_params.parameters->length()); 6751 ASSERT(closure.NumParameters() == closure_params.parameters->length());
6842 } 6752 }
6843 6753
6844 OpenFunctionBlock(closure); 6754 OpenFunctionBlock(closure);
6845 AddFormalParamsToScope(&closure_params, current_block_->scope); 6755 AddFormalParamsToScope(&closure_params, current_block_->scope);
6846 async_temp_scope_ = current_block_->scope; 6756 async_temp_scope_ = current_block_->scope;
6847 return closure.raw(); 6757 return closure.raw();
6848 } 6758 }
6849 6759
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
7546 } 7456 }
7547 } 7457 }
7548 CheckToken(Token::kLPAREN); 7458 CheckToken(Token::kLPAREN);
7549 7459
7550 // Check whether we have parsed this closure function before, in a previous 7460 // Check whether we have parsed this closure function before, in a previous
7551 // compilation. If so, reuse the function object, else create a new one 7461 // compilation. If so, reuse the function object, else create a new one
7552 // and register it in the current class. 7462 // and register it in the current class.
7553 // Note that we cannot share the same closure function between the closurized 7463 // Note that we cannot share the same closure function between the closurized
7554 // and non-closurized versions of the same parent function. 7464 // and non-closurized versions of the same parent function.
7555 Function& function = Function::ZoneHandle(Z); 7465 Function& function = Function::ZoneHandle(Z);
7556 bool is_new_closure = false;
7557 // TODO(hausner): There could be two different closures at the given 7466 // TODO(hausner): There could be two different closures at the given
7558 // function_pos, one enclosed in a closurized function and one enclosed in the 7467 // function_pos, one enclosed in a closurized function and one enclosed in the
7559 // non-closurized version of this same function. 7468 // non-closurized version of this same function.
7560 function = I->LookupClosureFunction(innermost_function(), function_pos); 7469 function = I->LookupClosureFunction(innermost_function(), function_pos);
7561 if (function.IsNull()) { 7470 if (function.IsNull()) {
7562 // The function will be registered in the lookup table by the 7471 // The function will be registered in the lookup table by the
7563 // EffectGraphVisitor::VisitClosureNode when the newly allocated closure 7472 // EffectGraphVisitor::VisitClosureNode when the newly allocated closure
7564 // function has been properly setup. 7473 // function has been properly setup.
7565 is_new_closure = true;
7566 function = Function::NewClosureFunction(*function_name, 7474 function = Function::NewClosureFunction(*function_name,
7567 innermost_function(), 7475 innermost_function(),
7568 function_pos); 7476 function_pos);
7569 function.set_result_type(result_type); 7477 function.set_result_type(result_type);
7570 if (FLAG_enable_mirrors && (metadata_pos >= 0)) { 7478 if (FLAG_enable_mirrors && (metadata_pos >= 0)) {
7571 library_.AddFunctionMetadata(function, metadata_pos); 7479 library_.AddFunctionMetadata(function, metadata_pos);
7572 } 7480 }
7573 } 7481 }
7574 7482
7575 // The function type needs to be finalized at compile time, since the closure 7483 // The function type needs to be finalized at compile time, since the closure
7576 // may be type checked at run time when assigned to a function variable, 7484 // may be type checked at run time when assigned to a function variable,
7577 // passed as a function argument, or returned as a function result. 7485 // passed as a function argument, or returned as a function result.
7578 7486
7579 LocalVariable* function_variable = NULL; 7487 LocalVariable* function_variable = NULL;
7580 Type& function_type = Type::ZoneHandle(Z); 7488 FunctionType& function_type = FunctionType::ZoneHandle(Z);
7581 if (variable_name != NULL) { 7489 if (variable_name != NULL) {
7582 // Since the function type depends on the signature of the closure function, 7490 // Since the function type depends on the signature of the closure function,
7583 // it cannot be determined before the formal parameter list of the closure 7491 // it cannot be determined before the formal parameter list of the closure
7584 // function is parsed. Therefore, we set the function type to a new 7492 // function is parsed. Therefore, we set the function type to a new
7585 // parameterized type to be patched after the actual type is known. 7493 // function type to be patched after the actual type is known.
7586 // We temporarily use the class of the Function interface. 7494 // We temporarily use the Closure class as scope class.
7587 const Class& unknown_signature_class = Class::Handle(Z, 7495 const Class& unknown_scope_class = Class::Handle(Z,
7588 Type::Handle(Z, Type::Function()).type_class()); 7496 I->object_store()->closure_class());
7589 function_type = Type::New(unknown_signature_class, 7497 function_type = FunctionType::New(unknown_scope_class,
7590 TypeArguments::Handle(Z), function_pos); 7498 TypeArguments::Handle(Z),
7499 function,
7500 function_pos);
7591 function_type.SetIsFinalized(); // No finalization needed. 7501 function_type.SetIsFinalized(); // No finalization needed.
7592 7502
7593 // Add the function variable to the scope before parsing the function in 7503 // Add the function variable to the scope before parsing the function in
7594 // order to allow self reference from inside the function. 7504 // order to allow self reference from inside the function.
7595 function_variable = new(Z) LocalVariable(function_pos, 7505 function_variable = new(Z) LocalVariable(function_pos,
7596 *variable_name, 7506 *variable_name,
7597 function_type); 7507 function_type);
7598 function_variable->set_is_final(); 7508 function_variable->set_is_final();
7599 ASSERT(current_block_ != NULL); 7509 ASSERT(current_block_ != NULL);
7600 ASSERT(current_block_->scope != NULL); 7510 ASSERT(current_block_->scope != NULL);
7601 if (!current_block_->scope->AddVariable(function_variable)) { 7511 if (!current_block_->scope->AddVariable(function_variable)) {
7602 LocalVariable* existing_var = 7512 LocalVariable* existing_var =
7603 current_block_->scope->LookupVariable(function_variable->name(), 7513 current_block_->scope->LookupVariable(function_variable->name(),
7604 true); 7514 true);
7605 ASSERT(existing_var != NULL); 7515 ASSERT(existing_var != NULL);
7606 // Use before define cases have already been detected and reported above. 7516 // Use before define cases have already been detected and reported above.
7607 ASSERT(existing_var->owner() == current_block_->scope); 7517 ASSERT(existing_var->owner() == current_block_->scope);
7608 ReportError(function_pos, "identifier '%s' already defined", 7518 ReportError(function_pos, "identifier '%s' already defined",
7609 function_variable->name().ToCString()); 7519 function_variable->name().ToCString());
7610 } 7520 }
7611 } 7521 }
7612 7522
7613 // Parse the local function. 7523 // Parse the local function.
7614 SequenceNode* statements = Parser::ParseFunc(function); 7524 SequenceNode* statements = Parser::ParseFunc(function);
7615 INC_STAT(thread(), num_functions_parsed, 1); 7525 INC_STAT(thread(), num_functions_parsed, 1);
7616 7526
7617 // Now that the local function has formal parameters, lookup the signature 7527 // Now that the local function has formal parameters, lookup the signature
7618 // class in the current library (but not in its imports) and only create a new 7528 FunctionType& signature_type =
7619 // canonical signature class if it does not exist yet. 7529 FunctionType::ZoneHandle(Z, function.SignatureType());
7620 const String& signature = String::Handle(Z, function.Signature()); 7530 signature_type ^= ClassFinalizer::FinalizeType(
7621 Class& signature_class = Class::ZoneHandle(Z); 7531 current_class(), signature_type, ClassFinalizer::kCanonicalize);
7622 if (!is_new_closure) { 7532 function.SetSignatureType(signature_type);
7623 signature_class = function.signature_class();
7624 }
7625 if (signature_class.IsNull()) {
7626 signature_class = library_.LookupLocalClass(signature);
7627 }
7628 if (signature_class.IsNull()) {
7629 // If we don't have a signature class yet, this must be a closure we
7630 // have not parsed before.
7631 ASSERT(is_new_closure);
7632 signature_class = Class::NewSignatureClass(signature,
7633 function,
7634 script_,
7635 function.token_pos());
7636 // Record the function signature class in the current library.
7637 library_.AddClass(signature_class);
7638 } else if (is_new_closure) {
7639 function.set_signature_class(signature_class);
7640 }
7641 ASSERT(function.signature_class() == signature_class.raw());
7642 7533
7643 // Local functions are registered in the enclosing class, but 7534 // Local functions are registered in the enclosing class, but
7644 // ignored during class finalization. The enclosing class has 7535 // ignored during class finalization. The enclosing class has
7645 // already been finalized. 7536 // already been finalized.
7646 ASSERT(current_class().is_finalized()); 7537 ASSERT(current_class().is_finalized());
7538 ASSERT(signature_type.IsFinalized());
7647 7539
7648 // Make sure that the instantiator is captured. 7540 // Make sure that the instantiator is captured.
7649 if ((signature_class.NumTypeParameters() > 0) && 7541 if ((current_block_->scope->function_level() > 0) &&
7650 (current_block_->scope->function_level() > 0)) { 7542 Class::Handle(signature_type.type_class()).IsGeneric()) {
7651 CaptureInstantiator(); 7543 CaptureInstantiator();
7652 } 7544 }
7653 7545
7654 // Finalize types in signature class here, so that the
7655 // signature type is not computed twice.
7656 ClassFinalizer::FinalizeTypesInClass(signature_class);
7657 const Type& signature_type = Type::Handle(Z, signature_class.SignatureType());
7658 ASSERT(signature_type.IsFinalized());
7659
7660 // A signature type itself cannot be malformed or malbounded, only its 7546 // A signature type itself cannot be malformed or malbounded, only its
7661 // signature function's result type or parameter types may be. 7547 // signature function's result type or parameter types may be.
7662 ASSERT(!signature_type.IsMalformed()); 7548 ASSERT(!signature_type.IsMalformed());
7663 ASSERT(!signature_type.IsMalbounded()); 7549 ASSERT(!signature_type.IsMalbounded());
7664 7550
7665 if (variable_name != NULL) { 7551 if (variable_name != NULL) {
7666 // Patch the function type of the variable now that the signature is known. 7552 // Patch the function type of the variable now that the signature is known.
7667 function_type.set_type_class(signature_class); 7553 function_type.set_scope_class(
7554 Class::Handle(Z, signature_type.scope_class()));
7668 function_type.set_arguments( 7555 function_type.set_arguments(
7669 TypeArguments::Handle(Z, signature_type.arguments())); 7556 TypeArguments::Handle(Z, signature_type.arguments()));
7557 ASSERT(function_type.signature() == function.raw());
7670 7558
7671 // The function type was initially marked as instantiated, but it may 7559 // The function type was initially marked as instantiated, but it may
7672 // actually be uninstantiated. 7560 // actually be uninstantiated.
7673 function_type.ResetIsFinalized(); 7561 function_type.ResetIsFinalized();
7674 7562
7675 // The function variable type should have been patched above. 7563 // The function variable type should have been patched above.
7676 ASSERT((function_variable == NULL) || 7564 ASSERT((function_variable == NULL) ||
7677 (function_variable->type().raw() == function_type.raw())); 7565 (function_variable->type().raw() == function_type.raw()));
7678 } 7566 }
7679 7567
(...skipping 2595 matching lines...) Expand 10 before | Expand all | Expand 10 after
10275 method_name = Library::PrivateCoreLibName( 10163 method_name = Library::PrivateCoreLibName(
10276 Symbols::ThrowNewIfNotLoaded()).raw(); 10164 Symbols::ThrowNewIfNotLoaded()).raw();
10277 } 10165 }
10278 // Object receiver. 10166 // Object receiver.
10279 // If the function is external and dynamic, pass the actual receiver, 10167 // If the function is external and dynamic, pass the actual receiver,
10280 // otherwise, pass a class literal of the unresolved method's owner. 10168 // otherwise, pass a class literal of the unresolved method's owner.
10281 if ((func != NULL) && !func->IsNull() && 10169 if ((func != NULL) && !func->IsNull() &&
10282 func->is_external() && !func->is_static()) { 10170 func->is_external() && !func->is_static()) {
10283 arguments->Add(LoadReceiver(func->token_pos())); 10171 arguments->Add(LoadReceiver(func->token_pos()));
10284 } else { 10172 } else {
10285 Type& type = Type::ZoneHandle(Z, 10173 AbstractType& type = AbstractType::ZoneHandle(Z);
10286 Type::New(cls, TypeArguments::Handle(Z), call_pos, Heap::kOld)); 10174 type ^= Type::New(cls, TypeArguments::Handle(Z), call_pos, Heap::kOld);
10287 type ^= ClassFinalizer::FinalizeType( 10175 type ^= ClassFinalizer::FinalizeType(
10288 current_class(), type, ClassFinalizer::kCanonicalize); 10176 current_class(), type, ClassFinalizer::kCanonicalize);
10289 arguments->Add(new(Z) LiteralNode(call_pos, type)); 10177 arguments->Add(new(Z) LiteralNode(call_pos, type));
10290 } 10178 }
10291 // String memberName. 10179 // String memberName.
10292 arguments->Add(new(Z) LiteralNode( 10180 arguments->Add(new(Z) LiteralNode(
10293 call_pos, String::ZoneHandle(Z, Symbols::New(function_name)))); 10181 call_pos, String::ZoneHandle(Z, Symbols::New(function_name))));
10294 // Smi invocation_type. 10182 // Smi invocation_type.
10295 if (cls.IsTopLevel()) { 10183 if (cls.IsTopLevel()) {
10296 ASSERT(im_call == InvocationMirror::kStatic || 10184 ASSERT(im_call == InvocationMirror::kStatic ||
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after
11854 current_member_->has_static && !current_member_->has_factory; 11742 current_member_->has_static && !current_member_->has_factory;
11855 } 11743 }
11856 ASSERT(!current_function().IsNull()); 11744 ASSERT(!current_function().IsNull());
11857 return 11745 return
11858 current_function().is_static() && !current_function().IsInFactoryScope(); 11746 current_function().is_static() && !current_function().IsInFactoryScope();
11859 } 11747 }
11860 11748
11861 11749
11862 const AbstractType* Parser::ReceiverType(const Class& cls) { 11750 const AbstractType* Parser::ReceiverType(const Class& cls) {
11863 ASSERT(!cls.IsNull()); 11751 ASSERT(!cls.IsNull());
11752 ASSERT(!cls.IsTypedefClass());
11753 // Note that if cls is _Closure, the returned type will be _Closure,
11754 // and not the signature type.
11864 Type& type = Type::ZoneHandle(Z, cls.CanonicalType()); 11755 Type& type = Type::ZoneHandle(Z, cls.CanonicalType());
11865 if (!type.IsNull()) { 11756 if (!type.IsNull()) {
11866 return &type; 11757 return &type;
11867 } 11758 }
11868 if (cls.IsSignatureClass()) { 11759 type = Type::New(cls,
11869 type = cls.SignatureType(); 11760 TypeArguments::Handle(Z, cls.type_parameters()), cls.token_pos());
11870 } else {
11871 type = Type::New(cls,
11872 TypeArguments::Handle(Z, cls.type_parameters()), cls.token_pos());
11873 }
11874 if (cls.is_type_finalized()) { 11761 if (cls.is_type_finalized()) {
11875 type ^= ClassFinalizer::FinalizeType( 11762 type ^= ClassFinalizer::FinalizeType(
11876 cls, type, ClassFinalizer::kCanonicalizeWellFormed); 11763 cls, type, ClassFinalizer::kCanonicalizeWellFormed);
11877 // Note that the receiver type may now be a malbounded type. 11764 // Note that the receiver type may now be a malbounded type.
11878 cls.SetCanonicalType(type); 11765 cls.SetCanonicalType(type);
11879 } 11766 }
11880 return &type; 11767 return &type;
11881 } 11768 }
11882 11769
11883 11770
11884 bool Parser::IsInstantiatorRequired() const { 11771 bool Parser::IsInstantiatorRequired() const {
11885 ASSERT(!current_function().IsNull()); 11772 ASSERT(!current_function().IsNull());
11886 if (current_function().is_static() && 11773 if (current_function().is_static() &&
11887 !current_function().IsInFactoryScope()) { 11774 !current_function().IsInFactoryScope()) {
11888 return false; 11775 return false;
11889 } 11776 }
11890 return current_class().NumTypeParameters() > 0; 11777 return current_class().IsGeneric();
11891 } 11778 }
11892 11779
11893 // We cache computed compile-time constants in a map so we can look them 11780 // We cache computed compile-time constants in a map so we can look them
11894 // up when the same code gets compiled again. The map key is a pair 11781 // up when the same code gets compiled again. The map key is a pair
11895 // (script url, token position) which is encoded in an array with 2 11782 // (script url, token position) which is encoded in an array with 2
11896 // elements: 11783 // elements:
11897 // - key[0] contains the canonicalized url of the script. 11784 // - key[0] contains the canonicalized url of the script.
11898 // - key[1] contains the token position of the constant in the script. 11785 // - key[1] contains the token position of the constant in the script.
11899 11786
11900 // ConstantPosKey allows us to look up a constant in the map without 11787 // ConstantPosKey allows us to look up a constant in the map without
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
12440 return resolved; 12327 return resolved;
12441 } 12328 }
12442 12329
12443 12330
12444 RawAbstractType* Parser::ParseType( 12331 RawAbstractType* Parser::ParseType(
12445 ClassFinalizer::FinalizationKind finalization, 12332 ClassFinalizer::FinalizationKind finalization,
12446 bool allow_deferred_type, 12333 bool allow_deferred_type,
12447 bool consume_unresolved_prefix) { 12334 bool consume_unresolved_prefix) {
12448 LibraryPrefix& prefix = LibraryPrefix::Handle(Z); 12335 LibraryPrefix& prefix = LibraryPrefix::Handle(Z);
12449 return ParseType(finalization, allow_deferred_type, 12336 return ParseType(finalization, allow_deferred_type,
12450 consume_unresolved_prefix, &prefix); 12337 consume_unresolved_prefix, &prefix);
12451 } 12338 }
12452 12339
12453 // Parses type = [ident "."] ident ["<" type { "," type } ">"], then resolve and 12340 // Parses type = [ident "."] ident ["<" type { "," type } ">"], then resolve and
12454 // finalize it according to the given type finalization mode. Returns prefix. 12341 // finalize it according to the given type finalization mode. Returns prefix.
12455 RawAbstractType* Parser::ParseType( 12342 RawAbstractType* Parser::ParseType(
12456 ClassFinalizer::FinalizationKind finalization, 12343 ClassFinalizer::FinalizationKind finalization,
12457 bool allow_deferred_type, 12344 bool allow_deferred_type,
12458 bool consume_unresolved_prefix, 12345 bool consume_unresolved_prefix,
12459 LibraryPrefix* prefix) { 12346 LibraryPrefix* prefix) {
12460 TRACE_PARSER("ParseType"); 12347 TRACE_PARSER("ParseType");
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
13125 13012
13126 closure = Function::NewClosureFunction(closure_name, 13013 closure = Function::NewClosureFunction(closure_name,
13127 innermost_function(), 13014 innermost_function(),
13128 token_pos); 13015 token_pos);
13129 closure.set_is_generated_body(true); 13016 closure.set_is_generated_body(true);
13130 closure.set_is_debuggable(false); 13017 closure.set_is_debuggable(false);
13131 closure.set_is_visible(false); 13018 closure.set_is_visible(false);
13132 closure.set_result_type(Object::dynamic_type()); 13019 closure.set_result_type(Object::dynamic_type());
13133 AddFormalParamsToFunction(&params, closure); 13020 AddFormalParamsToFunction(&params, closure);
13134 13021
13135 // Create and set the signature class of the closure. 13022 // Finalize function type.
13136 const String& sig = String::Handle(Z, closure.Signature()); 13023 FunctionType& signature_type =
13137 Class& sig_cls = Class::Handle(Z, library_.LookupLocalClass(sig)); 13024 FunctionType::Handle(Z, closure.SignatureType());
13138 if (sig_cls.IsNull()) { 13025 signature_type ^= ClassFinalizer::FinalizeType(
13139 sig_cls = Class::NewSignatureClass(sig, closure, script_, token_pos); 13026 current_class(), signature_type, ClassFinalizer::kCanonicalize);
13140 library_.AddClass(sig_cls); 13027 closure.SetSignatureType(signature_type);
13141 }
13142 closure.set_signature_class(sig_cls);
13143 // Finalize types in signature class here, so that the
13144 // signature type is not computed twice.
13145 ClassFinalizer::FinalizeTypesInClass(sig_cls);
13146 const Type& sig_type = Type::Handle(Z, sig_cls.SignatureType());
13147 ASSERT(sig_type.IsFinalized());
13148 // Finalization would be premature when top-level parsing. 13028 // Finalization would be premature when top-level parsing.
13149 ASSERT(!is_top_level_); 13029 ASSERT(!is_top_level_);
13150 return closure.raw(); 13030 return closure.raw();
13151 } 13031 }
13152 13032
13153 13033
13154 static String& BuildConstructorName(const String& type_class_name, 13034 static String& BuildConstructorName(const String& type_class_name,
13155 const String* named_constructor) { 13035 const String* named_constructor) {
13156 // By convention, the static function implementing a named constructor 'C' 13036 // By convention, the static function implementing a named constructor 'C'
13157 // for class 'A' is labeled 'A.C', and the static function implementing the 13037 // for class 'A' is labeled 'A.C', and the static function implementing the
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
14396 const ArgumentListNode& function_args, 14276 const ArgumentListNode& function_args,
14397 const LocalVariable* temp_for_last_arg, 14277 const LocalVariable* temp_for_last_arg,
14398 bool is_super_invocation) { 14278 bool is_super_invocation) {
14399 UNREACHABLE(); 14279 UNREACHABLE();
14400 return NULL; 14280 return NULL;
14401 } 14281 }
14402 14282
14403 } // namespace dart 14283 } // namespace dart
14404 14284
14405 #endif // DART_PRECOMPILED 14285 #endif // DART_PRECOMPILED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698