| 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 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/ast_transformer.h" | 9 #include "vm/ast_transformer.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 3894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3905 // and rules out many fields from being unnecessary unboxing candidates. | 3905 // and rules out many fields from being unnecessary unboxing candidates. |
| 3906 if (!field->has_static && has_initializer && has_simple_literal) { | 3906 if (!field->has_static && has_initializer && has_simple_literal) { |
| 3907 class_field.RecordStore(init_value); | 3907 class_field.RecordStore(init_value); |
| 3908 } | 3908 } |
| 3909 | 3909 |
| 3910 // For static final fields (this includes static const fields), set value to | 3910 // For static final fields (this includes static const fields), set value to |
| 3911 // "uninitialized" and create a kImplicitStaticFinalGetter getter method. | 3911 // "uninitialized" and create a kImplicitStaticFinalGetter getter method. |
| 3912 if (field->has_static && has_initializer) { | 3912 if (field->has_static && has_initializer) { |
| 3913 class_field.set_value(init_value); | 3913 class_field.set_value(init_value); |
| 3914 if (!has_simple_literal) { | 3914 if (!has_simple_literal) { |
| 3915 String& getter_name = String::Handle(Z, | 3915 String& getter_name = |
| 3916 Field::GetterSymbol(*field->name)); | 3916 String::Handle(Z, Field::GetterSymbol(*field->name)); |
| 3917 getter = Function::New(getter_name, | 3917 getter = Function::New(getter_name, |
| 3918 RawFunction::kImplicitStaticFinalGetter, | 3918 RawFunction::kImplicitStaticFinalGetter, |
| 3919 field->has_static, | 3919 field->has_static, |
| 3920 field->has_const, | 3920 field->has_const, |
| 3921 /* is_abstract = */ false, | 3921 /* is_abstract = */ false, |
| 3922 /* is_external = */ false, | 3922 /* is_external = */ false, |
| 3923 /* is_native = */ false, | 3923 /* is_native = */ false, |
| 3924 current_class(), | 3924 current_class(), |
| 3925 field->name_pos); | 3925 field->name_pos); |
| 3926 getter.set_result_type(*field->type); | 3926 getter.set_result_type(*field->type); |
| 3927 getter.set_is_debuggable(false); | 3927 getter.set_is_debuggable(false); |
| 3928 if (library_.is_dart_scheme() && library_.IsPrivate(*field->name)) { | 3928 if (library_.is_dart_scheme() && library_.IsPrivate(*field->name)) { |
| 3929 getter.set_is_reflectable(false); | 3929 getter.set_is_reflectable(false); |
| 3930 } | 3930 } |
| 3931 members->AddFunction(getter); | 3931 members->AddFunction(getter); |
| 3932 } | 3932 } |
| 3933 } | 3933 } |
| 3934 | 3934 |
| 3935 // For instance fields, we create implicit getter and setter methods. | 3935 // For instance fields, we create implicit getter and setter methods. |
| 3936 if (!field->has_static) { | 3936 if (!field->has_static) { |
| 3937 String& getter_name = String::Handle(Z, | 3937 String& getter_name = |
| 3938 Field::GetterSymbol(*field->name)); | 3938 String::Handle(Z, Field::GetterSymbol(*field->name)); |
| 3939 getter = Function::New(getter_name, RawFunction::kImplicitGetter, | 3939 getter = Function::New(getter_name, RawFunction::kImplicitGetter, |
| 3940 field->has_static, | 3940 field->has_static, |
| 3941 field->has_final, | 3941 field->has_final, |
| 3942 /* is_abstract = */ false, | 3942 /* is_abstract = */ false, |
| 3943 /* is_external = */ false, | 3943 /* is_external = */ false, |
| 3944 /* is_native = */ false, | 3944 /* is_native = */ false, |
| 3945 current_class(), | 3945 current_class(), |
| 3946 field->name_pos); | 3946 field->name_pos); |
| 3947 ParamList params; | 3947 ParamList params; |
| 3948 ASSERT(current_class().raw() == getter.Owner()); | 3948 ASSERT(current_class().raw() == getter.Owner()); |
| 3949 params.AddReceiver(ReceiverType(current_class()), field->name_pos); | 3949 params.AddReceiver(ReceiverType(current_class()), field->name_pos); |
| 3950 getter.set_result_type(*field->type); | 3950 getter.set_result_type(*field->type); |
| 3951 getter.set_is_debuggable(false); | 3951 getter.set_is_debuggable(false); |
| 3952 AddFormalParamsToFunction(¶ms, getter); | 3952 AddFormalParamsToFunction(¶ms, getter); |
| 3953 members->AddFunction(getter); | 3953 members->AddFunction(getter); |
| 3954 if (!field->has_final) { | 3954 if (!field->has_final) { |
| 3955 // Build a setter accessor for non-const fields. | 3955 // Build a setter accessor for non-const fields. |
| 3956 String& setter_name = String::Handle(Z, | 3956 String& setter_name = |
| 3957 Field::SetterSymbol(*field->name)); | 3957 String::Handle(Z, Field::SetterSymbol(*field->name)); |
| 3958 setter = Function::New(setter_name, RawFunction::kImplicitSetter, | 3958 setter = Function::New(setter_name, RawFunction::kImplicitSetter, |
| 3959 field->has_static, | 3959 field->has_static, |
| 3960 field->has_final, | 3960 field->has_final, |
| 3961 /* is_abstract = */ false, | 3961 /* is_abstract = */ false, |
| 3962 /* is_external = */ false, | 3962 /* is_external = */ false, |
| 3963 /* is_native = */ false, | 3963 /* is_native = */ false, |
| 3964 current_class(), | 3964 current_class(), |
| 3965 field->name_pos); | 3965 field->name_pos); |
| 3966 ParamList params; | 3966 ParamList params; |
| 3967 ASSERT(current_class().raw() == setter.Owner()); | 3967 ASSERT(current_class().raw() == setter.Owner()); |
| (...skipping 6554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10522 // sequence followed by the (value of the) receiver temp variable load. | 10522 // sequence followed by the (value of the) receiver temp variable load. |
| 10523 cascade->AddNode(new(Z) LoadLocalNode(cascade_pos, cascade_receiver_var)); | 10523 cascade->AddNode(new(Z) LoadLocalNode(cascade_pos, cascade_receiver_var)); |
| 10524 return cascade; | 10524 return cascade; |
| 10525 } | 10525 } |
| 10526 | 10526 |
| 10527 | 10527 |
| 10528 // Convert loading of a static const field into a literal node. | 10528 // Convert loading of a static const field into a literal node. |
| 10529 static AstNode* LiteralIfStaticConst(Zone* zone, AstNode* expr) { | 10529 static AstNode* LiteralIfStaticConst(Zone* zone, AstNode* expr) { |
| 10530 if (expr->IsLoadStaticFieldNode()) { | 10530 if (expr->IsLoadStaticFieldNode()) { |
| 10531 const Field& field = expr->AsLoadStaticFieldNode()->field(); | 10531 const Field& field = expr->AsLoadStaticFieldNode()->field(); |
| 10532 if (field.is_const()) { | 10532 if (field.is_const() && |
| 10533 !expr->AsLoadStaticFieldNode()->is_deferred_reference()) { |
| 10533 ASSERT(field.value() != Object::sentinel().raw()); | 10534 ASSERT(field.value() != Object::sentinel().raw()); |
| 10534 ASSERT(field.value() != Object::transition_sentinel().raw()); | 10535 ASSERT(field.value() != Object::transition_sentinel().raw()); |
| 10535 return new(zone) LiteralNode(expr->token_pos(), | 10536 return new(zone) LiteralNode(expr->token_pos(), |
| 10536 Instance::ZoneHandle(zone, field.value())); | 10537 Instance::ZoneHandle(zone, field.value())); |
| 10537 } | 10538 } |
| 10538 } | 10539 } |
| 10539 return expr; | 10540 return expr; |
| 10540 } | 10541 } |
| 10541 | 10542 |
| 10542 | 10543 |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10891 } else { | 10892 } else { |
| 10892 ASSERT(getter.kind() == RawFunction::kImplicitStaticFinalGetter); | 10893 ASSERT(getter.kind() == RawFunction::kImplicitStaticFinalGetter); |
| 10893 return new(Z) StaticGetterNode(ident_pos, | 10894 return new(Z) StaticGetterNode(ident_pos, |
| 10894 NULL, // Receiver. | 10895 NULL, // Receiver. |
| 10895 field_owner, | 10896 field_owner, |
| 10896 field_name); | 10897 field_name); |
| 10897 } | 10898 } |
| 10898 } | 10899 } |
| 10899 | 10900 |
| 10900 | 10901 |
| 10901 AstNode* Parser::ParseStaticFieldAccess(const Class& cls, | 10902 // Reference to 'field_name' with explicit class as primary. |
| 10902 const String& field_name, | 10903 AstNode* Parser::GenerateStaticFieldAccess(const Class& cls, |
| 10903 intptr_t ident_pos, | 10904 const String& field_name, |
| 10904 bool consume_cascades) { | 10905 intptr_t ident_pos) { |
| 10905 TRACE_PARSER("ParseStaticFieldAccess"); | |
| 10906 AstNode* access = NULL; | 10906 AstNode* access = NULL; |
| 10907 const Field& field = Field::ZoneHandle(Z, cls.LookupStaticField(field_name)); | 10907 const Field& field = Field::ZoneHandle(Z, cls.LookupStaticField(field_name)); |
| 10908 Function& func = Function::ZoneHandle(Z); | 10908 Function& func = Function::ZoneHandle(Z); |
| 10909 if (field.IsNull()) { | 10909 if (field.IsNull()) { |
| 10910 // No field, check if we have an explicit getter function. | 10910 // No field, check if we have an explicit getter function. |
| 10911 const String& getter_name = | 10911 func = cls.LookupGetterFunction(field_name); |
| 10912 String::ZoneHandle(Z, Field::GetterName(field_name)); | 10912 if (func.IsNull() || func.IsDynamicFunction()) { |
| 10913 const int kNumArguments = 0; // no arguments. | |
| 10914 func = Resolver::ResolveStatic(cls, | |
| 10915 getter_name, | |
| 10916 kNumArguments, | |
| 10917 Object::empty_array()); | |
| 10918 if (func.IsNull()) { | |
| 10919 // We might be referring to an implicit closure, check to see if | 10913 // We might be referring to an implicit closure, check to see if |
| 10920 // there is a function of the same name. | 10914 // there is a function of the same name. |
| 10921 func = cls.LookupStaticFunction(field_name); | 10915 func = cls.LookupStaticFunction(field_name); |
| 10922 if (!func.IsNull()) { | 10916 if (!func.IsNull()) { |
| 10923 access = CreateImplicitClosureNode(func, ident_pos, NULL); | 10917 access = CreateImplicitClosureNode(func, ident_pos, NULL); |
| 10924 } else { | 10918 } else { |
| 10925 // No function to closurize found found. | 10919 // No function to closurize found found. |
| 10926 // This field access may turn out to be a call to the setter. | 10920 // This field access may turn out to be a call to the setter. |
| 10927 // Create a getter call, which may later be turned into | 10921 // Create a getter call, which may later be turned into |
| 10928 // a setter call, or else the backend will generate | 10922 // a setter call, or else the backend will generate |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11049 left->AsPrimaryNode()->primary().IsClass()) { | 11043 left->AsPrimaryNode()->primary().IsClass()) { |
| 11050 // Static method call prefixed with class name. | 11044 // Static method call prefixed with class name. |
| 11051 const Class& cls = Class::Cast(left->AsPrimaryNode()->primary()); | 11045 const Class& cls = Class::Cast(left->AsPrimaryNode()->primary()); |
| 11052 selector = ParseStaticCall(cls, *ident, ident_pos); | 11046 selector = ParseStaticCall(cls, *ident, ident_pos); |
| 11053 } else { | 11047 } else { |
| 11054 selector = ParseInstanceCall(left, *ident, ident_pos); | 11048 selector = ParseInstanceCall(left, *ident, ident_pos); |
| 11055 } | 11049 } |
| 11056 } else { | 11050 } else { |
| 11057 // Field access. | 11051 // Field access. |
| 11058 Class& cls = Class::Handle(Z); | 11052 Class& cls = Class::Handle(Z); |
| 11053 bool is_deferred = false; |
| 11059 if (left->IsPrimaryNode()) { | 11054 if (left->IsPrimaryNode()) { |
| 11060 PrimaryNode* primary_node = left->AsPrimaryNode(); | 11055 PrimaryNode* primary_node = left->AsPrimaryNode(); |
| 11061 if (primary_node->primary().IsClass()) { | 11056 if (primary_node->primary().IsClass()) { |
| 11062 // If the primary node referred to a class we are loading a | 11057 // If the primary node referred to a class we are loading a |
| 11063 // qualified static field. | 11058 // qualified static field. |
| 11064 cls ^= primary_node->primary().raw(); | 11059 cls ^= primary_node->primary().raw(); |
| 11060 is_deferred = primary_node->is_deferred_reference(); |
| 11065 } | 11061 } |
| 11066 } | 11062 } |
| 11067 if (cls.IsNull()) { | 11063 if (cls.IsNull()) { |
| 11068 // Instance field access. | 11064 // Instance field access. |
| 11069 selector = CallGetter(ident_pos, left, *ident); | 11065 selector = CallGetter(ident_pos, left, *ident); |
| 11070 } else { | 11066 } else { |
| 11071 // Static field access. | 11067 // Static field access. |
| 11072 selector = | 11068 selector = GenerateStaticFieldAccess(cls, *ident, ident_pos); |
| 11073 ParseStaticFieldAccess(cls, *ident, ident_pos, !is_cascade); | 11069 ASSERT(selector != NULL); |
| 11070 if (selector->IsLoadStaticFieldNode()) { |
| 11071 selector->AsLoadStaticFieldNode()->set_is_deferred(is_deferred); |
| 11072 } else if (selector->IsStaticGetterNode()) { |
| 11073 selector->AsStaticGetterNode()->set_is_deferred(is_deferred); |
| 11074 } |
| 11074 } | 11075 } |
| 11075 } | 11076 } |
| 11076 } else if (CurrentToken() == Token::kLBRACK) { | 11077 } else if (CurrentToken() == Token::kLBRACK) { |
| 11077 // Super index operator handled in ParseSuperOperator(). | 11078 // Super index operator handled in ParseSuperOperator(). |
| 11078 ASSERT(!left->IsPrimaryNode() || !left->AsPrimaryNode()->IsSuper()); | 11079 ASSERT(!left->IsPrimaryNode() || !left->AsPrimaryNode()->IsSuper()); |
| 11079 | 11080 |
| 11080 const intptr_t bracket_pos = TokenPos(); | 11081 const intptr_t bracket_pos = TokenPos(); |
| 11081 ConsumeToken(); | 11082 ConsumeToken(); |
| 11082 left = LoadFieldIfUnresolved(left); | 11083 left = LoadFieldIfUnresolved(left); |
| 11083 const bool saved_mode = SetAllowFunctionLiterals(true); | 11084 const bool saved_mode = SetAllowFunctionLiterals(true); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11459 if (result.IsNull()) { | 11460 if (result.IsNull()) { |
| 11460 ReportError(token_pos, "Invalid const object %s", error_str); | 11461 ReportError(token_pos, "Invalid const object %s", error_str); |
| 11461 } | 11462 } |
| 11462 return result.raw(); | 11463 return result.raw(); |
| 11463 } | 11464 } |
| 11464 | 11465 |
| 11465 | 11466 |
| 11466 // If the field is already initialized, return no ast (NULL). | 11467 // If the field is already initialized, return no ast (NULL). |
| 11467 // Otherwise, if the field is constant, initialize the field and return no ast. | 11468 // Otherwise, if the field is constant, initialize the field and return no ast. |
| 11468 // If the field is not initialized and not const, return the ast for the getter. | 11469 // If the field is not initialized and not const, return the ast for the getter. |
| 11469 AstNode* Parser::RunStaticFieldInitializer(const Field& field, | 11470 StaticGetterNode* Parser::RunStaticFieldInitializer(const Field& field, |
| 11470 intptr_t field_ref_pos) { | 11471 intptr_t field_ref_pos) { |
| 11471 ASSERT(field.is_static()); | 11472 ASSERT(field.is_static()); |
| 11472 const Class& field_owner = Class::ZoneHandle(Z, field.owner()); | 11473 const Class& field_owner = Class::ZoneHandle(Z, field.owner()); |
| 11473 const String& field_name = String::ZoneHandle(Z, field.name()); | 11474 const String& field_name = String::ZoneHandle(Z, field.name()); |
| 11474 const String& getter_name = String::Handle(Z, Field::GetterName(field_name)); | 11475 const String& getter_name = String::Handle(Z, Field::GetterName(field_name)); |
| 11475 const Function& getter = Function::Handle(Z, | 11476 const Function& getter = Function::Handle(Z, |
| 11476 field_owner.LookupStaticFunction(getter_name)); | 11477 field_owner.LookupStaticFunction(getter_name)); |
| 11477 const Instance& value = Instance::Handle(Z, field.value()); | 11478 const Instance& value = Instance::Handle(Z, field.value()); |
| 11478 if (value.raw() == Object::transition_sentinel().raw()) { | 11479 if (value.raw() == Object::transition_sentinel().raw()) { |
| 11479 if (field.is_const()) { | 11480 if (field.is_const()) { |
| 11480 ReportError("circular dependency while initializing static field '%s'", | 11481 ReportError("circular dependency while initializing static field '%s'", |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11745 const String& ident) { | 11746 const String& ident) { |
| 11746 TRACE_PARSER("ResolveIdentInCurrentLibraryScope"); | 11747 TRACE_PARSER("ResolveIdentInCurrentLibraryScope"); |
| 11747 HANDLESCOPE(I); | 11748 HANDLESCOPE(I); |
| 11748 const Object& obj = Object::Handle(Z, library_.ResolveName(ident)); | 11749 const Object& obj = Object::Handle(Z, library_.ResolveName(ident)); |
| 11749 if (obj.IsClass()) { | 11750 if (obj.IsClass()) { |
| 11750 const Class& cls = Class::Cast(obj); | 11751 const Class& cls = Class::Cast(obj); |
| 11751 return new(Z) PrimaryNode(ident_pos, Class::ZoneHandle(Z, cls.raw())); | 11752 return new(Z) PrimaryNode(ident_pos, Class::ZoneHandle(Z, cls.raw())); |
| 11752 } else if (obj.IsField()) { | 11753 } else if (obj.IsField()) { |
| 11753 const Field& field = Field::Cast(obj); | 11754 const Field& field = Field::Cast(obj); |
| 11754 ASSERT(field.is_static()); | 11755 ASSERT(field.is_static()); |
| 11755 return GenerateStaticFieldLookup(field, ident_pos); | 11756 AstNode* get_field = GenerateStaticFieldLookup(field, ident_pos); |
| 11757 if (get_field->IsStaticGetterNode()) { |
| 11758 get_field->AsStaticGetterNode()->set_owner(library_); |
| 11759 } |
| 11760 return get_field; |
| 11756 } else if (obj.IsFunction()) { | 11761 } else if (obj.IsFunction()) { |
| 11757 const Function& func = Function::Cast(obj); | 11762 const Function& func = Function::Cast(obj); |
| 11758 ASSERT(func.is_static()); | 11763 ASSERT(func.is_static()); |
| 11759 if (func.IsGetterFunction() || func.IsSetterFunction()) { | 11764 if (func.IsGetterFunction() || func.IsSetterFunction()) { |
| 11760 return new(Z) StaticGetterNode(ident_pos, | 11765 StaticGetterNode* getter = |
| 11761 /* receiver */ NULL, | 11766 new(Z) StaticGetterNode(ident_pos, |
| 11762 Class::ZoneHandle(Z, func.Owner()), | 11767 /* receiver */ NULL, |
| 11763 ident); | 11768 Class::ZoneHandle(Z, func.Owner()), |
| 11764 | 11769 ident); |
| 11770 getter->set_owner(library_); |
| 11771 return getter; |
| 11765 } else { | 11772 } else { |
| 11766 return new(Z) PrimaryNode(ident_pos, Function::ZoneHandle(Z, func.raw())); | 11773 return new(Z) PrimaryNode(ident_pos, Function::ZoneHandle(Z, func.raw())); |
| 11767 } | 11774 } |
| 11768 } else { | 11775 } else { |
| 11769 ASSERT(obj.IsNull() || obj.IsLibraryPrefix()); | 11776 ASSERT(obj.IsNull() || obj.IsLibraryPrefix()); |
| 11770 } | 11777 } |
| 11771 // Lexically unresolved primary identifiers are referenced by their name. | 11778 // Lexically unresolved primary identifiers are referenced by their name. |
| 11772 return new(Z) PrimaryNode(ident_pos, ident); | 11779 return new(Z) PrimaryNode(ident_pos, ident); |
| 11773 } | 11780 } |
| 11774 | 11781 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 11789 // libraries present in the library prefix. | 11796 // libraries present in the library prefix. |
| 11790 AstNode* Parser::ResolveIdentInPrefixScope(intptr_t ident_pos, | 11797 AstNode* Parser::ResolveIdentInPrefixScope(intptr_t ident_pos, |
| 11791 const LibraryPrefix& prefix, | 11798 const LibraryPrefix& prefix, |
| 11792 const String& ident) { | 11799 const String& ident) { |
| 11793 TRACE_PARSER("ResolveIdentInPrefixScope"); | 11800 TRACE_PARSER("ResolveIdentInPrefixScope"); |
| 11794 HANDLESCOPE(I); | 11801 HANDLESCOPE(I); |
| 11795 if (ident.CharAt(0) == Library::kPrivateIdentifierStart) { | 11802 if (ident.CharAt(0) == Library::kPrivateIdentifierStart) { |
| 11796 // Private names are not exported by libraries. The name mangling | 11803 // Private names are not exported by libraries. The name mangling |
| 11797 // of private names with a library-specific suffix usually ensures | 11804 // of private names with a library-specific suffix usually ensures |
| 11798 // that _x in library A is not found when looked up from library B. | 11805 // that _x in library A is not found when looked up from library B. |
| 11799 // In the pathological case where a library includes itself with | 11806 // In the pathological case where a library imports itself with |
| 11800 // a prefix, the name mangling would not help in hiding the private | 11807 // a prefix, the name mangling would not help in hiding the private |
| 11801 // name, so we need to explicitly reject private names here. | 11808 // name, so we need to explicitly reject private names here. |
| 11802 return NULL; | 11809 return NULL; |
| 11803 } | 11810 } |
| 11804 Object& obj = Object::Handle(Z); | 11811 Object& obj = Object::Handle(Z); |
| 11805 if (prefix.is_loaded()) { | 11812 if (prefix.is_loaded()) { |
| 11806 obj = prefix.LookupObject(ident); | 11813 obj = prefix.LookupObject(ident); |
| 11807 } else { | 11814 } else { |
| 11808 // Remember that this function depends on an import prefix of an | 11815 // Remember that this function depends on an import prefix of an |
| 11809 // unloaded deferred library. Note that parsed_function() can be | 11816 // unloaded deferred library. Note that parsed_function() can be |
| (...skipping 16 matching lines...) Expand all Loading... |
| 11826 const Field& field = Field::Cast(obj); | 11833 const Field& field = Field::Cast(obj); |
| 11827 ASSERT(field.is_static()); | 11834 ASSERT(field.is_static()); |
| 11828 AstNode* get_field = GenerateStaticFieldLookup(field, ident_pos); | 11835 AstNode* get_field = GenerateStaticFieldLookup(field, ident_pos); |
| 11829 ASSERT(get_field != NULL); | 11836 ASSERT(get_field != NULL); |
| 11830 ASSERT(get_field->IsLoadStaticFieldNode() || | 11837 ASSERT(get_field->IsLoadStaticFieldNode() || |
| 11831 get_field->IsStaticGetterNode()); | 11838 get_field->IsStaticGetterNode()); |
| 11832 if (get_field->IsLoadStaticFieldNode()) { | 11839 if (get_field->IsLoadStaticFieldNode()) { |
| 11833 get_field->AsLoadStaticFieldNode()->set_is_deferred(is_deferred); | 11840 get_field->AsLoadStaticFieldNode()->set_is_deferred(is_deferred); |
| 11834 } else if (get_field->IsStaticGetterNode()) { | 11841 } else if (get_field->IsStaticGetterNode()) { |
| 11835 get_field->AsStaticGetterNode()->set_is_deferred(is_deferred); | 11842 get_field->AsStaticGetterNode()->set_is_deferred(is_deferred); |
| 11843 get_field->AsStaticGetterNode()->set_owner(prefix); |
| 11836 } | 11844 } |
| 11837 return get_field; | 11845 return get_field; |
| 11838 } else if (obj.IsFunction()) { | 11846 } else if (obj.IsFunction()) { |
| 11839 const Function& func = Function::Cast(obj); | 11847 const Function& func = Function::Cast(obj); |
| 11840 ASSERT(func.is_static()); | 11848 ASSERT(func.is_static()); |
| 11841 if (func.IsGetterFunction() || func.IsSetterFunction()) { | 11849 if (func.IsGetterFunction() || func.IsSetterFunction()) { |
| 11842 StaticGetterNode* getter = new(Z) StaticGetterNode( | 11850 StaticGetterNode* getter = new(Z) StaticGetterNode( |
| 11843 ident_pos, | 11851 ident_pos, |
| 11844 /* receiver */ NULL, | 11852 /* receiver */ NULL, |
| 11845 Class::ZoneHandle(Z, func.Owner()), | 11853 Class::ZoneHandle(Z, func.Owner()), |
| 11846 ident); | 11854 ident); |
| 11847 getter->set_is_deferred(is_deferred); | 11855 getter->set_is_deferred(is_deferred); |
| 11856 getter->set_owner(prefix); |
| 11848 return getter; | 11857 return getter; |
| 11849 } else { | 11858 } else { |
| 11850 PrimaryNode* primary = new(Z) PrimaryNode( | 11859 PrimaryNode* primary = new(Z) PrimaryNode( |
| 11851 ident_pos, Function::ZoneHandle(Z, func.raw())); | 11860 ident_pos, Function::ZoneHandle(Z, func.raw())); |
| 11852 primary->set_is_deferred(is_deferred); | 11861 primary->set_is_deferred(is_deferred); |
| 11853 return primary; | 11862 return primary; |
| 11854 } | 11863 } |
| 11855 } | 11864 } |
| 11856 // All possible object types are handled above. | 11865 // All possible object types are handled above. |
| 11857 UNREACHABLE(); | 11866 UNREACHABLE(); |
| (...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13512 void Parser::SkipQualIdent() { | 13521 void Parser::SkipQualIdent() { |
| 13513 ASSERT(IsIdentifier()); | 13522 ASSERT(IsIdentifier()); |
| 13514 ConsumeToken(); | 13523 ConsumeToken(); |
| 13515 if (CurrentToken() == Token::kPERIOD) { | 13524 if (CurrentToken() == Token::kPERIOD) { |
| 13516 ConsumeToken(); // Consume the kPERIOD token. | 13525 ConsumeToken(); // Consume the kPERIOD token. |
| 13517 ExpectIdentifier("identifier expected after '.'"); | 13526 ExpectIdentifier("identifier expected after '.'"); |
| 13518 } | 13527 } |
| 13519 } | 13528 } |
| 13520 | 13529 |
| 13521 } // namespace dart | 13530 } // namespace dart |
| OLD | NEW |