| 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 | 8 #ifndef DART_PRECOMPILED |
| 9 | 9 |
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 3949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3960 method->has_native, | 3960 method->has_native, |
| 3961 current_class(), | 3961 current_class(), |
| 3962 method->decl_begin_pos)); | 3962 method->decl_begin_pos)); |
| 3963 func.set_result_type(*method->type); | 3963 func.set_result_type(*method->type); |
| 3964 func.set_end_token_pos(method_end_pos); | 3964 func.set_end_token_pos(method_end_pos); |
| 3965 func.set_is_redirecting(is_redirecting); | 3965 func.set_is_redirecting(is_redirecting); |
| 3966 func.set_modifier(async_modifier); | 3966 func.set_modifier(async_modifier); |
| 3967 if (library_.is_dart_scheme() && library_.IsPrivate(*method->name)) { | 3967 if (library_.is_dart_scheme() && library_.IsPrivate(*method->name)) { |
| 3968 func.set_is_reflectable(false); | 3968 func.set_is_reflectable(false); |
| 3969 } | 3969 } |
| 3970 if (method->metadata_pos > 0) { | 3970 if (FLAG_enable_mirrors && (method->metadata_pos > 0)) { |
| 3971 library_.AddFunctionMetadata(func, method->metadata_pos); | 3971 library_.AddFunctionMetadata(func, method->metadata_pos); |
| 3972 } | 3972 } |
| 3973 if (method->has_native) { | 3973 if (method->has_native) { |
| 3974 func.set_native_name(*native_name); | 3974 func.set_native_name(*native_name); |
| 3975 } | 3975 } |
| 3976 | 3976 |
| 3977 // If this method is a redirecting factory, set the redirection information. | 3977 // If this method is a redirecting factory, set the redirection information. |
| 3978 if (!redirection_type.IsNull()) { | 3978 if (!redirection_type.IsNull()) { |
| 3979 ASSERT(func.IsFactory()); | 3979 ASSERT(func.IsFactory()); |
| 3980 func.SetRedirectionType(redirection_type); | 3980 func.SetRedirectionType(redirection_type); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4060 field->has_static, | 4060 field->has_static, |
| 4061 field->has_final, | 4061 field->has_final, |
| 4062 field->has_const, | 4062 field->has_const, |
| 4063 is_reflectable, | 4063 is_reflectable, |
| 4064 current_class(), | 4064 current_class(), |
| 4065 *field->type, | 4065 *field->type, |
| 4066 field->name_pos); | 4066 field->name_pos); |
| 4067 class_field.set_has_initializer(has_initializer); | 4067 class_field.set_has_initializer(has_initializer); |
| 4068 members->AddField(class_field); | 4068 members->AddField(class_field); |
| 4069 field->field_ = &class_field; | 4069 field->field_ = &class_field; |
| 4070 if (field->metadata_pos >= 0) { | 4070 if (FLAG_enable_mirrors && (field->metadata_pos >= 0)) { |
| 4071 library_.AddFieldMetadata(class_field, field->metadata_pos); | 4071 library_.AddFieldMetadata(class_field, field->metadata_pos); |
| 4072 } | 4072 } |
| 4073 | 4073 |
| 4074 // Start tracking types for fields with simple initializers in their | 4074 // Start tracking types for fields with simple initializers in their |
| 4075 // definition. This avoids some of the overhead to track this at runtime | 4075 // definition. This avoids some of the overhead to track this at runtime |
| 4076 // and rules out many fields from being unnecessary unboxing candidates. | 4076 // and rules out many fields from being unnecessary unboxing candidates. |
| 4077 if (!field->has_static && has_initializer && has_simple_literal) { | 4077 if (!field->has_static && has_initializer && has_simple_literal) { |
| 4078 class_field.RecordStore(init_value); | 4078 class_field.RecordStore(init_value); |
| 4079 if (!init_value.IsNull() && init_value.IsDouble()) { | 4079 if (!init_value.IsNull() && init_value.IsDouble()) { |
| 4080 class_field.set_is_double_initialized(true); | 4080 class_field.set_is_double_initialized(true); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4457 Object& obj = Object::Handle(Z, library_.LookupLocalObject(*enum_name)); | 4457 Object& obj = Object::Handle(Z, library_.LookupLocalObject(*enum_name)); |
| 4458 if (!obj.IsNull()) { | 4458 if (!obj.IsNull()) { |
| 4459 ReportError(name_pos, "'%s' is already defined", enum_name->ToCString()); | 4459 ReportError(name_pos, "'%s' is already defined", enum_name->ToCString()); |
| 4460 } | 4460 } |
| 4461 Class& cls = Class::Handle(Z); | 4461 Class& cls = Class::Handle(Z); |
| 4462 cls = Class::New(*enum_name, script_, declaration_pos); | 4462 cls = Class::New(*enum_name, script_, declaration_pos); |
| 4463 cls.set_library(library_); | 4463 cls.set_library(library_); |
| 4464 library_.AddClass(cls); | 4464 library_.AddClass(cls); |
| 4465 cls.set_is_synthesized_class(); | 4465 cls.set_is_synthesized_class(); |
| 4466 cls.set_is_enum_class(); | 4466 cls.set_is_enum_class(); |
| 4467 if (metadata_pos >= 0) { | 4467 if (FLAG_enable_mirrors && (metadata_pos >= 0)) { |
| 4468 library_.AddClassMetadata(cls, tl_owner, metadata_pos); | 4468 library_.AddClassMetadata(cls, tl_owner, metadata_pos); |
| 4469 } | 4469 } |
| 4470 cls.set_super_type(Type::Handle(Z, Type::ObjectType())); | 4470 cls.set_super_type(Type::Handle(Z, Type::ObjectType())); |
| 4471 pending_classes.Add(cls, Heap::kOld); | 4471 pending_classes.Add(cls, Heap::kOld); |
| 4472 } | 4472 } |
| 4473 | 4473 |
| 4474 | 4474 |
| 4475 void Parser::ParseClassDeclaration(const GrowableObjectArray& pending_classes, | 4475 void Parser::ParseClassDeclaration(const GrowableObjectArray& pending_classes, |
| 4476 const Object& tl_owner, | 4476 const Object& tl_owner, |
| 4477 intptr_t metadata_pos) { | 4477 intptr_t metadata_pos) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4580 class_name.ToCString(), | 4580 class_name.ToCString(), |
| 4581 String::Handle(orig_bound.UserVisibleName()).ToCString()); | 4581 String::Handle(orig_bound.UserVisibleName()).ToCString()); |
| 4582 } | 4582 } |
| 4583 } | 4583 } |
| 4584 cls.set_type_parameters(orig_type_parameters); | 4584 cls.set_type_parameters(orig_type_parameters); |
| 4585 } | 4585 } |
| 4586 | 4586 |
| 4587 if (is_abstract) { | 4587 if (is_abstract) { |
| 4588 cls.set_is_abstract(); | 4588 cls.set_is_abstract(); |
| 4589 } | 4589 } |
| 4590 if (metadata_pos >= 0) { | 4590 if (FLAG_enable_mirrors && (metadata_pos >= 0)) { |
| 4591 library_.AddClassMetadata(cls, tl_owner, metadata_pos); | 4591 library_.AddClassMetadata(cls, tl_owner, metadata_pos); |
| 4592 } | 4592 } |
| 4593 | 4593 |
| 4594 const bool is_mixin_declaration = (CurrentToken() == Token::kASSIGN); | 4594 const bool is_mixin_declaration = (CurrentToken() == Token::kASSIGN); |
| 4595 if (is_mixin_declaration && is_patch) { | 4595 if (is_mixin_declaration && is_patch) { |
| 4596 ReportError(classname_pos, | 4596 ReportError(classname_pos, |
| 4597 "mixin application '%s' may not be a patch class", | 4597 "mixin application '%s' may not be a patch class", |
| 4598 class_name.ToCString()); | 4598 class_name.ToCString()); |
| 4599 } | 4599 } |
| 4600 | 4600 |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5013 mixin_application.set_is_synthesized_class(); | 5013 mixin_application.set_is_synthesized_class(); |
| 5014 | 5014 |
| 5015 // This mixin application alias needs an implicit constructor, but it is | 5015 // This mixin application alias needs an implicit constructor, but it is |
| 5016 // too early to call 'AddImplicitConstructor(mixin_application)' here, | 5016 // too early to call 'AddImplicitConstructor(mixin_application)' here, |
| 5017 // because this class should be lazily compiled. | 5017 // because this class should be lazily compiled. |
| 5018 if (CurrentToken() == Token::kIMPLEMENTS) { | 5018 if (CurrentToken() == Token::kIMPLEMENTS) { |
| 5019 ParseInterfaceList(mixin_application); | 5019 ParseInterfaceList(mixin_application); |
| 5020 } | 5020 } |
| 5021 ExpectSemicolon(); | 5021 ExpectSemicolon(); |
| 5022 pending_classes.Add(mixin_application, Heap::kOld); | 5022 pending_classes.Add(mixin_application, Heap::kOld); |
| 5023 if (metadata_pos >= 0) { | 5023 if (FLAG_enable_mirrors && (metadata_pos >= 0)) { |
| 5024 library_.AddClassMetadata(mixin_application, tl_owner, metadata_pos); | 5024 library_.AddClassMetadata(mixin_application, tl_owner, metadata_pos); |
| 5025 } | 5025 } |
| 5026 } | 5026 } |
| 5027 | 5027 |
| 5028 | 5028 |
| 5029 // Look ahead to detect if we are seeing ident [ TypeParameters ] "(". | 5029 // Look ahead to detect if we are seeing ident [ TypeParameters ] "(". |
| 5030 // We need this lookahead to distinguish between the optional return type | 5030 // We need this lookahead to distinguish between the optional return type |
| 5031 // and the alias name of a function type alias. | 5031 // and the alias name of a function type alias. |
| 5032 // Token position remains unchanged. | 5032 // Token position remains unchanged. |
| 5033 bool Parser::IsFunctionTypeAliasName() { | 5033 bool Parser::IsFunctionTypeAliasName() { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5179 signature_function = signature_class.signature_function(); | 5179 signature_function = signature_class.signature_function(); |
| 5180 function_type_alias.PatchSignatureFunction(signature_function); | 5180 function_type_alias.PatchSignatureFunction(signature_function); |
| 5181 } | 5181 } |
| 5182 ASSERT(signature_function.signature_class() == signature_class.raw()); | 5182 ASSERT(signature_function.signature_class() == signature_class.raw()); |
| 5183 | 5183 |
| 5184 // The alias should not be marked as finalized yet, since it needs to be | 5184 // The alias should not be marked as finalized yet, since it needs to be |
| 5185 // checked in the class finalizer for illegal self references. | 5185 // checked in the class finalizer for illegal self references. |
| 5186 ASSERT(!function_type_alias.IsCanonicalSignatureClass()); | 5186 ASSERT(!function_type_alias.IsCanonicalSignatureClass()); |
| 5187 ASSERT(!function_type_alias.is_finalized()); | 5187 ASSERT(!function_type_alias.is_finalized()); |
| 5188 pending_classes.Add(function_type_alias, Heap::kOld); | 5188 pending_classes.Add(function_type_alias, Heap::kOld); |
| 5189 if (metadata_pos >= 0) { | 5189 if (FLAG_enable_mirrors && (metadata_pos >= 0)) { |
| 5190 library_.AddClassMetadata(function_type_alias, | 5190 library_.AddClassMetadata(function_type_alias, |
| 5191 tl_owner, | 5191 tl_owner, |
| 5192 metadata_pos); | 5192 metadata_pos); |
| 5193 } | 5193 } |
| 5194 } | 5194 } |
| 5195 | 5195 |
| 5196 | 5196 |
| 5197 // Consumes exactly one right angle bracket. If the current token is a single | 5197 // Consumes exactly one right angle bracket. If the current token is a single |
| 5198 // bracket token, it is consumed normally. However, if it is a double or triple | 5198 // bracket token, it is consumed normally. However, if it is a double or triple |
| 5199 // bracket, it is replaced by a single or double bracket token without | 5199 // bracket, it is replaced by a single or double bracket token without |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5302 } else { | 5302 } else { |
| 5303 type_parameter_bound = I->object_store()->object_type(); | 5303 type_parameter_bound = I->object_store()->object_type(); |
| 5304 } | 5304 } |
| 5305 type_parameter = TypeParameter::New(cls, | 5305 type_parameter = TypeParameter::New(cls, |
| 5306 index, | 5306 index, |
| 5307 type_parameter_name, | 5307 type_parameter_name, |
| 5308 type_parameter_bound, | 5308 type_parameter_bound, |
| 5309 declaration_pos); | 5309 declaration_pos); |
| 5310 type_parameters_array.Add( | 5310 type_parameters_array.Add( |
| 5311 &AbstractType::ZoneHandle(Z, type_parameter.raw())); | 5311 &AbstractType::ZoneHandle(Z, type_parameter.raw())); |
| 5312 if (metadata_pos >= 0) { | 5312 if (FLAG_enable_mirrors && (metadata_pos >= 0)) { |
| 5313 library_.AddTypeParameterMetadata(type_parameter, metadata_pos); | 5313 library_.AddTypeParameterMetadata(type_parameter, metadata_pos); |
| 5314 } | 5314 } |
| 5315 index++; | 5315 index++; |
| 5316 } while (CurrentToken() == Token::kCOMMA); | 5316 } while (CurrentToken() == Token::kCOMMA); |
| 5317 Token::Kind token = CurrentToken(); | 5317 Token::Kind token = CurrentToken(); |
| 5318 if ((token == Token::kGT) || (token == Token::kSHR)) { | 5318 if ((token == Token::kGT) || (token == Token::kSHR)) { |
| 5319 ConsumeRightAngleBracket(); | 5319 ConsumeRightAngleBracket(); |
| 5320 } else { | 5320 } else { |
| 5321 ReportError("right angle bracket expected"); | 5321 ReportError("right angle bracket expected"); |
| 5322 } | 5322 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5461 | 5461 |
| 5462 const bool is_reflectable = | 5462 const bool is_reflectable = |
| 5463 !(library_.is_dart_scheme() && library_.IsPrivate(var_name)); | 5463 !(library_.is_dart_scheme() && library_.IsPrivate(var_name)); |
| 5464 | 5464 |
| 5465 field = Field::NewTopLevel(var_name, is_final, is_const, owner, name_pos); | 5465 field = Field::NewTopLevel(var_name, is_final, is_const, owner, name_pos); |
| 5466 field.SetFieldType(type); | 5466 field.SetFieldType(type); |
| 5467 field.set_is_reflectable(is_reflectable); | 5467 field.set_is_reflectable(is_reflectable); |
| 5468 field.SetStaticValue(Object::null_instance(), true); | 5468 field.SetStaticValue(Object::null_instance(), true); |
| 5469 top_level->AddField(field); | 5469 top_level->AddField(field); |
| 5470 library_.AddObject(field, var_name); | 5470 library_.AddObject(field, var_name); |
| 5471 if (metadata_pos >= 0) { | 5471 if (FLAG_enable_mirrors && (metadata_pos >= 0)) { |
| 5472 library_.AddFieldMetadata(field, metadata_pos); | 5472 library_.AddFieldMetadata(field, metadata_pos); |
| 5473 } | 5473 } |
| 5474 if (CurrentToken() == Token::kASSIGN) { | 5474 if (CurrentToken() == Token::kASSIGN) { |
| 5475 ConsumeToken(); | 5475 ConsumeToken(); |
| 5476 Instance& field_value = Instance::Handle(Z, Object::sentinel().raw()); | 5476 Instance& field_value = Instance::Handle(Z, Object::sentinel().raw()); |
| 5477 bool has_simple_literal = false; | 5477 bool has_simple_literal = false; |
| 5478 if (LookaheadToken(1) == Token::kSEMICOLON) { | 5478 if (LookaheadToken(1) == Token::kSEMICOLON) { |
| 5479 has_simple_literal = IsSimpleLiteral(type, &field_value); | 5479 has_simple_literal = IsSimpleLiteral(type, &field_value); |
| 5480 } | 5480 } |
| 5481 SkipExpr(); | 5481 SkipExpr(); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5652 library_.AddObject(func, func_name); | 5652 library_.AddObject(func, func_name); |
| 5653 } else { | 5653 } else { |
| 5654 // Need to remove the previously added function that is being patched. | 5654 // Need to remove the previously added function that is being patched. |
| 5655 const Class& toplevel_cls = Class::Handle(Z, library_.toplevel_class()); | 5655 const Class& toplevel_cls = Class::Handle(Z, library_.toplevel_class()); |
| 5656 const Function& replaced_func = | 5656 const Function& replaced_func = |
| 5657 Function::Handle(Z, toplevel_cls.LookupStaticFunction(func_name)); | 5657 Function::Handle(Z, toplevel_cls.LookupStaticFunction(func_name)); |
| 5658 ASSERT(!replaced_func.IsNull()); | 5658 ASSERT(!replaced_func.IsNull()); |
| 5659 toplevel_cls.RemoveFunction(replaced_func); | 5659 toplevel_cls.RemoveFunction(replaced_func); |
| 5660 library_.ReplaceObject(func, func_name); | 5660 library_.ReplaceObject(func, func_name); |
| 5661 } | 5661 } |
| 5662 if (metadata_pos >= 0) { | 5662 if (FLAG_enable_mirrors && (metadata_pos >= 0)) { |
| 5663 library_.AddFunctionMetadata(func, metadata_pos); | 5663 library_.AddFunctionMetadata(func, metadata_pos); |
| 5664 } | 5664 } |
| 5665 } | 5665 } |
| 5666 | 5666 |
| 5667 | 5667 |
| 5668 void Parser::ParseTopLevelAccessor(TopLevel* top_level, | 5668 void Parser::ParseTopLevelAccessor(TopLevel* top_level, |
| 5669 const Object& owner, | 5669 const Object& owner, |
| 5670 intptr_t metadata_pos) { | 5670 intptr_t metadata_pos) { |
| 5671 TRACE_PARSER("ParseTopLevelAccessor"); | 5671 TRACE_PARSER("ParseTopLevelAccessor"); |
| 5672 const intptr_t decl_begin_pos = TokenPos(); | 5672 const intptr_t decl_begin_pos = TokenPos(); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5817 // Need to remove the previously added accessor that is being patched. | 5817 // Need to remove the previously added accessor that is being patched. |
| 5818 const Class& toplevel_cls = Class::Handle(Z, | 5818 const Class& toplevel_cls = Class::Handle(Z, |
| 5819 owner.IsClass() ? Class::Cast(owner).raw() | 5819 owner.IsClass() ? Class::Cast(owner).raw() |
| 5820 : PatchClass::Cast(owner).patched_class()); | 5820 : PatchClass::Cast(owner).patched_class()); |
| 5821 const Function& replaced_func = | 5821 const Function& replaced_func = |
| 5822 Function::Handle(Z, toplevel_cls.LookupFunction(accessor_name)); | 5822 Function::Handle(Z, toplevel_cls.LookupFunction(accessor_name)); |
| 5823 ASSERT(!replaced_func.IsNull()); | 5823 ASSERT(!replaced_func.IsNull()); |
| 5824 toplevel_cls.RemoveFunction(replaced_func); | 5824 toplevel_cls.RemoveFunction(replaced_func); |
| 5825 library_.ReplaceObject(func, accessor_name); | 5825 library_.ReplaceObject(func, accessor_name); |
| 5826 } | 5826 } |
| 5827 if (metadata_pos >= 0) { | 5827 if (FLAG_enable_mirrors && (metadata_pos >= 0)) { |
| 5828 library_.AddFunctionMetadata(func, metadata_pos); | 5828 library_.AddFunctionMetadata(func, metadata_pos); |
| 5829 } | 5829 } |
| 5830 } | 5830 } |
| 5831 | 5831 |
| 5832 | 5832 |
| 5833 RawObject* Parser::CallLibraryTagHandler(Dart_LibraryTag tag, | 5833 RawObject* Parser::CallLibraryTagHandler(Dart_LibraryTag tag, |
| 5834 intptr_t token_pos, | 5834 intptr_t token_pos, |
| 5835 const String& url) { | 5835 const String& url) { |
| 5836 Dart_LibraryTagHandler handler = I->library_tag_handler(); | 5836 Dart_LibraryTagHandler handler = I->library_tag_handler(); |
| 5837 if (handler == NULL) { | 5837 if (handler == NULL) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5979 // library import, call the library tag handler to request loading | 5979 // library import, call the library tag handler to request loading |
| 5980 // the library. | 5980 // the library. |
| 5981 if (library.LoadNotStarted() && | 5981 if (library.LoadNotStarted() && |
| 5982 (!is_deferred_import || FLAG_load_deferred_eagerly)) { | 5982 (!is_deferred_import || FLAG_load_deferred_eagerly)) { |
| 5983 library.SetLoadRequested(); | 5983 library.SetLoadRequested(); |
| 5984 CallLibraryTagHandler(Dart_kImportTag, import_pos, canon_url); | 5984 CallLibraryTagHandler(Dart_kImportTag, import_pos, canon_url); |
| 5985 } | 5985 } |
| 5986 | 5986 |
| 5987 Namespace& ns = Namespace::Handle(Z, | 5987 Namespace& ns = Namespace::Handle(Z, |
| 5988 Namespace::New(library, show_names, hide_names)); | 5988 Namespace::New(library, show_names, hide_names)); |
| 5989 if (metadata_pos >= 0) { | 5989 if (FLAG_enable_mirrors && (metadata_pos >= 0)) { |
| 5990 ns.AddMetadata(tl_owner, metadata_pos); | 5990 ns.AddMetadata(tl_owner, metadata_pos); |
| 5991 } | 5991 } |
| 5992 | 5992 |
| 5993 // Ensure that private dart:_ libraries are only imported into dart: | 5993 // Ensure that private dart:_ libraries are only imported into dart: |
| 5994 // libraries, including indirectly through exports. | 5994 // libraries, including indirectly through exports. |
| 5995 const String& lib_url = String::Handle(Z, library_.url()); | 5995 const String& lib_url = String::Handle(Z, library_.url()); |
| 5996 if (canon_url.StartsWith(Symbols::DartSchemePrivate()) && | 5996 if (canon_url.StartsWith(Symbols::DartSchemePrivate()) && |
| 5997 !lib_url.StartsWith(Symbols::DartScheme())) { | 5997 !lib_url.StartsWith(Symbols::DartScheme())) { |
| 5998 ReportError(import_pos, "private library is not accessible"); | 5998 ReportError(import_pos, "private library is not accessible"); |
| 5999 } | 5999 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6065 // declaration that follows the library definitions. Therefore, we | 6065 // declaration that follows the library definitions. Therefore, we |
| 6066 // need to remember the position of the last token that was | 6066 // need to remember the position of the last token that was |
| 6067 // successfully consumed. | 6067 // successfully consumed. |
| 6068 intptr_t rewind_pos = TokenPos(); | 6068 intptr_t rewind_pos = TokenPos(); |
| 6069 intptr_t metadata_pos = SkipMetadata(); | 6069 intptr_t metadata_pos = SkipMetadata(); |
| 6070 if (CurrentToken() == Token::kLIBRARY) { | 6070 if (CurrentToken() == Token::kLIBRARY) { |
| 6071 if (is_patch_source()) { | 6071 if (is_patch_source()) { |
| 6072 ReportError("patch cannot override library name"); | 6072 ReportError("patch cannot override library name"); |
| 6073 } | 6073 } |
| 6074 ParseLibraryName(); | 6074 ParseLibraryName(); |
| 6075 if (metadata_pos >= 0) { | 6075 if (FLAG_enable_mirrors && (metadata_pos >= 0)) { |
| 6076 library_.AddLibraryMetadata(tl_owner, metadata_pos); | 6076 library_.AddLibraryMetadata(tl_owner, metadata_pos); |
| 6077 } | 6077 } |
| 6078 rewind_pos = TokenPos(); | 6078 rewind_pos = TokenPos(); |
| 6079 metadata_pos = SkipMetadata(); | 6079 metadata_pos = SkipMetadata(); |
| 6080 } | 6080 } |
| 6081 while ((CurrentToken() == Token::kIMPORT) || | 6081 while ((CurrentToken() == Token::kIMPORT) || |
| 6082 (CurrentToken() == Token::kEXPORT)) { | 6082 (CurrentToken() == Token::kEXPORT)) { |
| 6083 ParseLibraryImportExport(tl_owner, metadata_pos); | 6083 ParseLibraryImportExport(tl_owner, metadata_pos); |
| 6084 rewind_pos = TokenPos(); | 6084 rewind_pos = TokenPos(); |
| 6085 metadata_pos = SkipMetadata(); | 6085 metadata_pos = SkipMetadata(); |
| (...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7654 function = I->LookupClosureFunction(innermost_function(), function_pos); | 7654 function = I->LookupClosureFunction(innermost_function(), function_pos); |
| 7655 if (function.IsNull()) { | 7655 if (function.IsNull()) { |
| 7656 // The function will be registered in the lookup table by the | 7656 // The function will be registered in the lookup table by the |
| 7657 // EffectGraphVisitor::VisitClosureNode when the newly allocated closure | 7657 // EffectGraphVisitor::VisitClosureNode when the newly allocated closure |
| 7658 // function has been properly setup. | 7658 // function has been properly setup. |
| 7659 is_new_closure = true; | 7659 is_new_closure = true; |
| 7660 function = Function::NewClosureFunction(*function_name, | 7660 function = Function::NewClosureFunction(*function_name, |
| 7661 innermost_function(), | 7661 innermost_function(), |
| 7662 function_pos); | 7662 function_pos); |
| 7663 function.set_result_type(result_type); | 7663 function.set_result_type(result_type); |
| 7664 if (metadata_pos >= 0) { | 7664 if (FLAG_enable_mirrors && (metadata_pos >= 0)) { |
| 7665 library_.AddFunctionMetadata(function, metadata_pos); | 7665 library_.AddFunctionMetadata(function, metadata_pos); |
| 7666 } | 7666 } |
| 7667 } | 7667 } |
| 7668 | 7668 |
| 7669 // The function type needs to be finalized at compile time, since the closure | 7669 // The function type needs to be finalized at compile time, since the closure |
| 7670 // may be type checked at run time when assigned to a function variable, | 7670 // may be type checked at run time when assigned to a function variable, |
| 7671 // passed as a function argument, or returned as a function result. | 7671 // passed as a function argument, or returned as a function result. |
| 7672 | 7672 |
| 7673 LocalVariable* function_variable = NULL; | 7673 LocalVariable* function_variable = NULL; |
| 7674 Type& function_type = Type::ZoneHandle(Z); | 7674 Type& function_type = Type::ZoneHandle(Z); |
| (...skipping 6775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14450 const ArgumentListNode& function_args, | 14450 const ArgumentListNode& function_args, |
| 14451 const LocalVariable* temp_for_last_arg, | 14451 const LocalVariable* temp_for_last_arg, |
| 14452 bool is_super_invocation) { | 14452 bool is_super_invocation) { |
| 14453 UNREACHABLE(); | 14453 UNREACHABLE(); |
| 14454 return NULL; | 14454 return NULL; |
| 14455 } | 14455 } |
| 14456 | 14456 |
| 14457 } // namespace dart | 14457 } // namespace dart |
| 14458 | 14458 |
| 14459 #endif // DART_PRECOMPILED | 14459 #endif // DART_PRECOMPILED |
| OLD | NEW |