| 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 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2040 function_name, | 2040 function_name, |
| 2041 arguments, | 2041 arguments, |
| 2042 kResolveGetter, | 2042 kResolveGetter, |
| 2043 &is_no_such_method)); | 2043 &is_no_such_method)); |
| 2044 if (super_function.IsGetterFunction() || | 2044 if (super_function.IsGetterFunction() || |
| 2045 super_function.IsImplicitGetterFunction()) { | 2045 super_function.IsImplicitGetterFunction()) { |
| 2046 const Class& super_class = | 2046 const Class& super_class = |
| 2047 Class::ZoneHandle(Z, current_class().SuperClass()); | 2047 Class::ZoneHandle(Z, current_class().SuperClass()); |
| 2048 AstNode* closure = new StaticGetterNode(supercall_pos, | 2048 AstNode* closure = new StaticGetterNode(supercall_pos, |
| 2049 LoadReceiver(supercall_pos), | 2049 LoadReceiver(supercall_pos), |
| 2050 /* is_super_getter */ true, | |
| 2051 super_class, | 2050 super_class, |
| 2052 function_name); | 2051 function_name); |
| 2053 // 'this' is not passed as parameter to the closure. | 2052 // 'this' is not passed as parameter to the closure. |
| 2054 ArgumentListNode* closure_arguments = new ArgumentListNode(supercall_pos); | 2053 ArgumentListNode* closure_arguments = new ArgumentListNode(supercall_pos); |
| 2055 for (int i = 1; i < arguments->length(); i++) { | 2054 for (int i = 1; i < arguments->length(); i++) { |
| 2056 closure_arguments->Add(arguments->NodeAt(i)); | 2055 closure_arguments->Add(arguments->NodeAt(i)); |
| 2057 } | 2056 } |
| 2058 return BuildClosureCall(supercall_pos, closure, closure_arguments); | 2057 return BuildClosureCall(supercall_pos, closure, closure_arguments); |
| 2059 } | 2058 } |
| 2060 if (is_no_such_method) { | 2059 if (is_no_such_method) { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2213 // In case CreateAssignmentNode is called later on this | 2212 // In case CreateAssignmentNode is called later on this |
| 2214 // CreateImplicitClosureNode, it will be replaced by a StaticSetterNode. | 2213 // CreateImplicitClosureNode, it will be replaced by a StaticSetterNode. |
| 2215 return CreateImplicitClosureNode(super_function, | 2214 return CreateImplicitClosureNode(super_function, |
| 2216 field_pos, | 2215 field_pos, |
| 2217 implicit_argument); | 2216 implicit_argument); |
| 2218 } | 2217 } |
| 2219 // No function or field exists of the specified field_name. | 2218 // No function or field exists of the specified field_name. |
| 2220 // Emit a StaticGetterNode anyway, so that noSuchMethod gets called. | 2219 // Emit a StaticGetterNode anyway, so that noSuchMethod gets called. |
| 2221 } | 2220 } |
| 2222 } | 2221 } |
| 2223 return new StaticGetterNode( | 2222 return new(Z) StaticGetterNode( |
| 2224 field_pos, implicit_argument, true, super_class, field_name); | 2223 field_pos, implicit_argument, super_class, field_name); |
| 2225 } | 2224 } |
| 2226 | 2225 |
| 2227 | 2226 |
| 2228 void Parser::GenerateSuperConstructorCall(const Class& cls, | 2227 void Parser::GenerateSuperConstructorCall(const Class& cls, |
| 2229 intptr_t supercall_pos, | 2228 intptr_t supercall_pos, |
| 2230 LocalVariable* receiver, | 2229 LocalVariable* receiver, |
| 2231 AstNode* phase_parameter, | 2230 AstNode* phase_parameter, |
| 2232 ArgumentListNode* forwarding_args) { | 2231 ArgumentListNode* forwarding_args) { |
| 2233 const Class& super_class = Class::Handle(Z, cls.SuperClass()); | 2232 const Class& super_class = Class::Handle(Z, cls.SuperClass()); |
| 2234 // Omit the implicit super() if there is no super class (i.e. | 2233 // Omit the implicit super() if there is no super class (i.e. |
| (...skipping 8565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10800 const int kNumArguments = 0; // no arguments. | 10799 const int kNumArguments = 0; // no arguments. |
| 10801 func = Resolver::ResolveStatic(cls, | 10800 func = Resolver::ResolveStatic(cls, |
| 10802 getter_name, | 10801 getter_name, |
| 10803 kNumArguments, | 10802 kNumArguments, |
| 10804 Object::empty_array()); | 10803 Object::empty_array()); |
| 10805 if (!func.IsNull()) { | 10804 if (!func.IsNull()) { |
| 10806 ASSERT(func.kind() != RawFunction::kImplicitStaticFinalGetter); | 10805 ASSERT(func.kind() != RawFunction::kImplicitStaticFinalGetter); |
| 10807 closure = new(Z) StaticGetterNode( | 10806 closure = new(Z) StaticGetterNode( |
| 10808 call_pos, | 10807 call_pos, |
| 10809 NULL, | 10808 NULL, |
| 10810 false, | |
| 10811 Class::ZoneHandle(Z, cls.raw()), | 10809 Class::ZoneHandle(Z, cls.raw()), |
| 10812 func_name); | 10810 func_name); |
| 10813 return BuildClosureCall(call_pos, closure, arguments); | 10811 return BuildClosureCall(call_pos, closure, arguments); |
| 10814 } | 10812 } |
| 10815 } else { | 10813 } else { |
| 10816 closure = GenerateStaticFieldLookup(field, call_pos); | 10814 closure = GenerateStaticFieldLookup(field, call_pos); |
| 10817 return BuildClosureCall(call_pos, closure, arguments); | 10815 return BuildClosureCall(call_pos, closure, arguments); |
| 10818 } | 10816 } |
| 10819 // Could not resolve static method: throw a NoSuchMethodError. | 10817 // Could not resolve static method: throw a NoSuchMethodError. |
| 10820 return ThrowNoSuchMethodError(ident_pos, | 10818 return ThrowNoSuchMethodError(ident_pos, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10880 const Function& getter = Function::Handle(Z, | 10878 const Function& getter = Function::Handle(Z, |
| 10881 field_owner.LookupStaticFunction(getter_name)); | 10879 field_owner.LookupStaticFunction(getter_name)); |
| 10882 // Never load field directly if there is a getter (deterministic AST). | 10880 // Never load field directly if there is a getter (deterministic AST). |
| 10883 if (getter.IsNull() || field.is_const()) { | 10881 if (getter.IsNull() || field.is_const()) { |
| 10884 return new(Z) LoadStaticFieldNode( | 10882 return new(Z) LoadStaticFieldNode( |
| 10885 ident_pos, Field::ZoneHandle(Z, field.raw())); | 10883 ident_pos, Field::ZoneHandle(Z, field.raw())); |
| 10886 } else { | 10884 } else { |
| 10887 ASSERT(getter.kind() == RawFunction::kImplicitStaticFinalGetter); | 10885 ASSERT(getter.kind() == RawFunction::kImplicitStaticFinalGetter); |
| 10888 return new(Z) StaticGetterNode(ident_pos, | 10886 return new(Z) StaticGetterNode(ident_pos, |
| 10889 NULL, // Receiver. | 10887 NULL, // Receiver. |
| 10890 false, // is_super_getter. | |
| 10891 field_owner, | 10888 field_owner, |
| 10892 field_name); | 10889 field_name); |
| 10893 } | 10890 } |
| 10894 } | 10891 } |
| 10895 | 10892 |
| 10896 | 10893 |
| 10897 AstNode* Parser::ParseStaticFieldAccess(const Class& cls, | 10894 AstNode* Parser::ParseStaticFieldAccess(const Class& cls, |
| 10898 const String& field_name, | 10895 const String& field_name, |
| 10899 intptr_t ident_pos, | 10896 intptr_t ident_pos, |
| 10900 bool consume_cascades) { | 10897 bool consume_cascades) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 10918 if (!func.IsNull()) { | 10915 if (!func.IsNull()) { |
| 10919 access = CreateImplicitClosureNode(func, ident_pos, NULL); | 10916 access = CreateImplicitClosureNode(func, ident_pos, NULL); |
| 10920 } else { | 10917 } else { |
| 10921 // No function to closurize found found. | 10918 // No function to closurize found found. |
| 10922 // This field access may turn out to be a call to the setter. | 10919 // This field access may turn out to be a call to the setter. |
| 10923 // Create a getter call, which may later be turned into | 10920 // Create a getter call, which may later be turned into |
| 10924 // a setter call, or else the backend will generate | 10921 // a setter call, or else the backend will generate |
| 10925 // a throw NoSuchMethodError(). | 10922 // a throw NoSuchMethodError(). |
| 10926 access = new(Z) StaticGetterNode(ident_pos, | 10923 access = new(Z) StaticGetterNode(ident_pos, |
| 10927 NULL, | 10924 NULL, |
| 10928 false, | |
| 10929 Class::ZoneHandle(Z, cls.raw()), | 10925 Class::ZoneHandle(Z, cls.raw()), |
| 10930 field_name); | 10926 field_name); |
| 10931 } | 10927 } |
| 10932 } else { | 10928 } else { |
| 10933 ASSERT(func.kind() != RawFunction::kImplicitStaticFinalGetter); | 10929 ASSERT(func.kind() != RawFunction::kImplicitStaticFinalGetter); |
| 10934 access = new(Z) StaticGetterNode( | 10930 access = new(Z) StaticGetterNode( |
| 10935 ident_pos, NULL, false, Class::ZoneHandle(Z, cls.raw()), field_name); | 10931 ident_pos, NULL, Class::ZoneHandle(Z, cls.raw()), field_name); |
| 10936 } | 10932 } |
| 10937 } else { | 10933 } else { |
| 10938 access = GenerateStaticFieldLookup(field, ident_pos); | 10934 access = GenerateStaticFieldLookup(field, ident_pos); |
| 10939 } | 10935 } |
| 10940 return access; | 10936 return access; |
| 10941 } | 10937 } |
| 10942 | 10938 |
| 10943 | 10939 |
| 10944 AstNode* Parser::LoadFieldIfUnresolved(AstNode* node) { | 10940 AstNode* Parser::LoadFieldIfUnresolved(AstNode* node) { |
| 10945 if (!node->IsPrimaryNode()) { | 10941 if (!node->IsPrimaryNode()) { |
| 10946 return node; | 10942 return node; |
| 10947 } | 10943 } |
| 10948 PrimaryNode* primary = node->AsPrimaryNode(); | 10944 PrimaryNode* primary = node->AsPrimaryNode(); |
| 10949 if (primary->primary().IsString()) { | 10945 if (primary->primary().IsString()) { |
| 10950 if (primary->IsSuper()) { | 10946 if (primary->IsSuper()) { |
| 10951 return primary; | 10947 return primary; |
| 10952 } | 10948 } |
| 10953 // In a static method, evaluation of an unresolved identifier causes a | 10949 // In a static method, evaluation of an unresolved identifier causes a |
| 10954 // NoSuchMethodError to be thrown. | 10950 // NoSuchMethodError to be thrown. |
| 10955 // In an instance method, we convert this into a getter call | 10951 // In an instance method, we convert this into a getter call |
| 10956 // for a field (which may be defined in a subclass.) | 10952 // for a field (which may be defined in a subclass.) |
| 10957 String& name = String::CheckedZoneHandle(primary->primary().raw()); | 10953 String& name = String::CheckedZoneHandle(primary->primary().raw()); |
| 10958 if (current_function().is_static() || | 10954 if (current_function().is_static() || |
| 10959 current_function().IsInFactoryScope()) { | 10955 current_function().IsInFactoryScope()) { |
| 10960 StaticGetterNode* getter = new(Z) StaticGetterNode( | 10956 StaticGetterNode* getter = new(Z) StaticGetterNode( |
| 10961 primary->token_pos(), | 10957 primary->token_pos(), |
| 10962 NULL, // No receiver. | 10958 NULL, // No receiver. |
| 10963 false, // Not a super getter. | |
| 10964 Class::ZoneHandle(Z, current_class().raw()), | 10959 Class::ZoneHandle(Z, current_class().raw()), |
| 10965 name); | 10960 name); |
| 10966 getter->set_is_deferred(primary->is_deferred_reference()); | 10961 getter->set_is_deferred(primary->is_deferred_reference()); |
| 10967 return getter; | 10962 return getter; |
| 10968 } else { | 10963 } else { |
| 10969 AstNode* receiver = LoadReceiver(primary->token_pos()); | 10964 AstNode* receiver = LoadReceiver(primary->token_pos()); |
| 10970 return CallGetter(node->token_pos(), receiver, name); | 10965 return CallGetter(node->token_pos(), receiver, name); |
| 10971 } | 10966 } |
| 10972 } | 10967 } |
| 10973 return primary; | 10968 return primary; |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11473 const Function& getter = Function::Handle(Z, | 11468 const Function& getter = Function::Handle(Z, |
| 11474 field_owner.LookupStaticFunction(getter_name)); | 11469 field_owner.LookupStaticFunction(getter_name)); |
| 11475 const Instance& value = Instance::Handle(Z, field.value()); | 11470 const Instance& value = Instance::Handle(Z, field.value()); |
| 11476 if (value.raw() == Object::transition_sentinel().raw()) { | 11471 if (value.raw() == Object::transition_sentinel().raw()) { |
| 11477 if (field.is_const()) { | 11472 if (field.is_const()) { |
| 11478 ReportError("circular dependency while initializing static field '%s'", | 11473 ReportError("circular dependency while initializing static field '%s'", |
| 11479 field_name.ToCString()); | 11474 field_name.ToCString()); |
| 11480 } else { | 11475 } else { |
| 11481 // The implicit static getter will throw the exception if necessary. | 11476 // The implicit static getter will throw the exception if necessary. |
| 11482 return new(Z) StaticGetterNode( | 11477 return new(Z) StaticGetterNode( |
| 11483 field_ref_pos, NULL, false, field_owner, field_name); | 11478 field_ref_pos, NULL, field_owner, field_name); |
| 11484 } | 11479 } |
| 11485 } else if (value.raw() == Object::sentinel().raw()) { | 11480 } else if (value.raw() == Object::sentinel().raw()) { |
| 11486 // This field has not been referenced yet and thus the value has | 11481 // This field has not been referenced yet and thus the value has |
| 11487 // not been evaluated. If the field is const, call the static getter method | 11482 // not been evaluated. If the field is const, call the static getter method |
| 11488 // to evaluate the expression and canonicalize the value. | 11483 // to evaluate the expression and canonicalize the value. |
| 11489 if (field.is_const()) { | 11484 if (field.is_const()) { |
| 11490 field.set_value(Object::transition_sentinel()); | 11485 field.set_value(Object::transition_sentinel()); |
| 11491 const int kNumArguments = 0; // no arguments. | 11486 const int kNumArguments = 0; // no arguments. |
| 11492 const Function& func = Function::Handle(Z, | 11487 const Function& func = Function::Handle(Z, |
| 11493 Resolver::ResolveStatic(field_owner, | 11488 Resolver::ResolveStatic(field_owner, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 11522 UNREACHABLE(); | 11517 UNREACHABLE(); |
| 11523 } | 11518 } |
| 11524 ASSERT(const_value.IsNull() || const_value.IsInstance()); | 11519 ASSERT(const_value.IsNull() || const_value.IsInstance()); |
| 11525 Instance& instance = Instance::Handle(Z); | 11520 Instance& instance = Instance::Handle(Z); |
| 11526 instance ^= const_value.raw(); | 11521 instance ^= const_value.raw(); |
| 11527 instance = TryCanonicalize(instance, field_ref_pos); | 11522 instance = TryCanonicalize(instance, field_ref_pos); |
| 11528 field.set_value(instance); | 11523 field.set_value(instance); |
| 11529 return NULL; // Constant | 11524 return NULL; // Constant |
| 11530 } else { | 11525 } else { |
| 11531 return new(Z) StaticGetterNode( | 11526 return new(Z) StaticGetterNode( |
| 11532 field_ref_pos, NULL, false, field_owner, field_name); | 11527 field_ref_pos, NULL, field_owner, field_name); |
| 11533 } | 11528 } |
| 11534 } | 11529 } |
| 11535 if (getter.IsNull() || | 11530 if (getter.IsNull() || |
| 11536 (getter.kind() == RawFunction::kImplicitStaticFinalGetter)) { | 11531 (getter.kind() == RawFunction::kImplicitStaticFinalGetter)) { |
| 11537 return NULL; | 11532 return NULL; |
| 11538 } | 11533 } |
| 11539 ASSERT(getter.kind() == RawFunction::kImplicitGetter); | 11534 ASSERT(getter.kind() == RawFunction::kImplicitGetter); |
| 11540 return new(Z) StaticGetterNode( | 11535 return new(Z) StaticGetterNode( |
| 11541 field_ref_pos, NULL, false, field_owner, field_name); | 11536 field_ref_pos, NULL, field_owner, field_name); |
| 11542 } | 11537 } |
| 11543 | 11538 |
| 11544 | 11539 |
| 11545 RawObject* Parser::EvaluateConstConstructorCall( | 11540 RawObject* Parser::EvaluateConstConstructorCall( |
| 11546 const Class& type_class, | 11541 const Class& type_class, |
| 11547 const TypeArguments& type_arguments, | 11542 const TypeArguments& type_arguments, |
| 11548 const Function& constructor, | 11543 const Function& constructor, |
| 11549 ArgumentListNode* arguments) { | 11544 ArgumentListNode* arguments) { |
| 11550 // Factories have one extra argument: the type arguments. | 11545 // Factories have one extra argument: the type arguments. |
| 11551 // Constructors have 2 extra arguments: rcvr and construction phase. | 11546 // Constructors have 2 extra arguments: rcvr and construction phase. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11669 if (!func.IsNull()) { | 11664 if (!func.IsNull()) { |
| 11670 if (func.IsDynamicFunction() || func.is_abstract()) { | 11665 if (func.IsDynamicFunction() || func.is_abstract()) { |
| 11671 if (node != NULL) { | 11666 if (node != NULL) { |
| 11672 CheckInstanceFieldAccess(ident_pos, ident); | 11667 CheckInstanceFieldAccess(ident_pos, ident); |
| 11673 ASSERT(AbstractType::Handle(Z, func.result_type()).IsResolved()); | 11668 ASSERT(AbstractType::Handle(Z, func.result_type()).IsResolved()); |
| 11674 *node = CallGetter(ident_pos, LoadReceiver(ident_pos), ident); | 11669 *node = CallGetter(ident_pos, LoadReceiver(ident_pos), ident); |
| 11675 } | 11670 } |
| 11676 return true; | 11671 return true; |
| 11677 } else if (func.IsStaticFunction()) { | 11672 } else if (func.IsStaticFunction()) { |
| 11678 if (node != NULL) { | 11673 if (node != NULL) { |
| 11679 ASSERT(AbstractType::Handle(Z, func.result_type()).IsResolved()); | |
| 11680 // The static getter may later be changed into a dynamically | |
| 11681 // resolved instance setter if no static setter can | |
| 11682 // be found. | |
| 11683 AstNode* receiver = NULL; | |
| 11684 const bool kTestOnly = true; | |
| 11685 if (!current_function().is_static() && | |
| 11686 (LookupReceiver(current_block_->scope, kTestOnly) != NULL)) { | |
| 11687 receiver = LoadReceiver(ident_pos); | |
| 11688 } | |
| 11689 *node = new(Z) StaticGetterNode(ident_pos, | 11674 *node = new(Z) StaticGetterNode(ident_pos, |
| 11690 receiver, | 11675 NULL, |
| 11691 false, | |
| 11692 Class::ZoneHandle(Z, cls.raw()), | 11676 Class::ZoneHandle(Z, cls.raw()), |
| 11693 ident); | 11677 ident); |
| 11694 } | 11678 } |
| 11695 return true; | 11679 return true; |
| 11696 } | 11680 } |
| 11697 } | 11681 } |
| 11698 func = cls.LookupSetterFunction(ident); | 11682 func = cls.LookupSetterFunction(ident); |
| 11699 if (!func.IsNull()) { | 11683 if (!func.IsNull()) { |
| 11684 // We create a getter node even though a getter doesn't exist as |
| 11685 // it could be followed by an assignment which will convert it to |
| 11686 // a setter node. If there is no assignment we will get an error |
| 11687 // when we try to invoke the getter. |
| 11700 if (func.IsDynamicFunction() || func.is_abstract()) { | 11688 if (func.IsDynamicFunction() || func.is_abstract()) { |
| 11701 if (node != NULL) { | 11689 if (node != NULL) { |
| 11702 // We create a getter node even though a getter doesn't exist as | |
| 11703 // it could be followed by an assignment which will convert it to | |
| 11704 // a setter node. If there is no assignment we will get an error | |
| 11705 // when we try to invoke the getter. | |
| 11706 CheckInstanceFieldAccess(ident_pos, ident); | 11690 CheckInstanceFieldAccess(ident_pos, ident); |
| 11707 ASSERT(AbstractType::Handle(Z, func.result_type()).IsResolved()); | 11691 ASSERT(AbstractType::Handle(Z, func.result_type()).IsResolved()); |
| 11708 *node = CallGetter(ident_pos, LoadReceiver(ident_pos), ident); | 11692 *node = CallGetter(ident_pos, LoadReceiver(ident_pos), ident); |
| 11709 } | 11693 } |
| 11710 return true; | 11694 return true; |
| 11711 } else if (func.IsStaticFunction()) { | 11695 } else if (func.IsStaticFunction()) { |
| 11712 if (node != NULL) { | 11696 if (node != NULL) { |
| 11713 // We create a getter node even though a getter doesn't exist as | 11697 *node = new(Z) StaticGetterNode(ident_pos, |
| 11714 // it could be followed by an assignment which will convert it to | 11698 NULL, |
| 11715 // a setter node. If there is no assignment we will get an error | 11699 Class::ZoneHandle(Z, cls.raw()), |
| 11716 // when we try to invoke the getter. | 11700 ident); |
| 11717 *node = new(Z) StaticGetterNode( | |
| 11718 ident_pos, | |
| 11719 NULL, | |
| 11720 false, | |
| 11721 Class::ZoneHandle(Z, cls.raw()), | |
| 11722 ident); | |
| 11723 } | 11701 } |
| 11724 return true; | 11702 return true; |
| 11725 } | 11703 } |
| 11726 } | 11704 } |
| 11727 | 11705 |
| 11728 // Nothing found in scope of current class. | 11706 // Nothing found in scope of current class. |
| 11729 if (node != NULL) { | 11707 if (node != NULL) { |
| 11730 *node = NULL; | 11708 *node = NULL; |
| 11731 } | 11709 } |
| 11732 return false; // Not an unqualified identifier. | 11710 return false; // Not an unqualified identifier. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 11757 } else if (obj.IsField()) { | 11735 } else if (obj.IsField()) { |
| 11758 const Field& field = Field::Cast(obj); | 11736 const Field& field = Field::Cast(obj); |
| 11759 ASSERT(field.is_static()); | 11737 ASSERT(field.is_static()); |
| 11760 return GenerateStaticFieldLookup(field, ident_pos); | 11738 return GenerateStaticFieldLookup(field, ident_pos); |
| 11761 } else if (obj.IsFunction()) { | 11739 } else if (obj.IsFunction()) { |
| 11762 const Function& func = Function::Cast(obj); | 11740 const Function& func = Function::Cast(obj); |
| 11763 ASSERT(func.is_static()); | 11741 ASSERT(func.is_static()); |
| 11764 if (func.IsGetterFunction() || func.IsSetterFunction()) { | 11742 if (func.IsGetterFunction() || func.IsSetterFunction()) { |
| 11765 return new(Z) StaticGetterNode(ident_pos, | 11743 return new(Z) StaticGetterNode(ident_pos, |
| 11766 /* receiver */ NULL, | 11744 /* receiver */ NULL, |
| 11767 /* is_super_getter */ false, | |
| 11768 Class::ZoneHandle(Z, func.Owner()), | 11745 Class::ZoneHandle(Z, func.Owner()), |
| 11769 ident); | 11746 ident); |
| 11770 | 11747 |
| 11771 } else { | 11748 } else { |
| 11772 return new(Z) PrimaryNode(ident_pos, Function::ZoneHandle(Z, func.raw())); | 11749 return new(Z) PrimaryNode(ident_pos, Function::ZoneHandle(Z, func.raw())); |
| 11773 } | 11750 } |
| 11774 } else { | 11751 } else { |
| 11775 ASSERT(obj.IsNull() || obj.IsLibraryPrefix()); | 11752 ASSERT(obj.IsNull() || obj.IsLibraryPrefix()); |
| 11776 } | 11753 } |
| 11777 // Lexically unresolved primary identifiers are referenced by their name. | 11754 // Lexically unresolved primary identifiers are referenced by their name. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11841 get_field->AsStaticGetterNode()->set_is_deferred(is_deferred); | 11818 get_field->AsStaticGetterNode()->set_is_deferred(is_deferred); |
| 11842 } | 11819 } |
| 11843 return get_field; | 11820 return get_field; |
| 11844 } else if (obj.IsFunction()) { | 11821 } else if (obj.IsFunction()) { |
| 11845 const Function& func = Function::Cast(obj); | 11822 const Function& func = Function::Cast(obj); |
| 11846 ASSERT(func.is_static()); | 11823 ASSERT(func.is_static()); |
| 11847 if (func.IsGetterFunction() || func.IsSetterFunction()) { | 11824 if (func.IsGetterFunction() || func.IsSetterFunction()) { |
| 11848 StaticGetterNode* getter = new(Z) StaticGetterNode( | 11825 StaticGetterNode* getter = new(Z) StaticGetterNode( |
| 11849 ident_pos, | 11826 ident_pos, |
| 11850 /* receiver */ NULL, | 11827 /* receiver */ NULL, |
| 11851 /* is_super_getter */ false, | |
| 11852 Class::ZoneHandle(Z, func.Owner()), | 11828 Class::ZoneHandle(Z, func.Owner()), |
| 11853 ident); | 11829 ident); |
| 11854 getter->set_is_deferred(is_deferred); | 11830 getter->set_is_deferred(is_deferred); |
| 11855 return getter; | 11831 return getter; |
| 11856 } else { | 11832 } else { |
| 11857 PrimaryNode* primary = new(Z) PrimaryNode( | 11833 PrimaryNode* primary = new(Z) PrimaryNode( |
| 11858 ident_pos, Function::ZoneHandle(Z, func.raw())); | 11834 ident_pos, Function::ZoneHandle(Z, func.raw())); |
| 11859 primary->set_is_deferred(is_deferred); | 11835 primary->set_is_deferred(is_deferred); |
| 11860 return primary; | 11836 return primary; |
| 11861 } | 11837 } |
| (...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13519 void Parser::SkipQualIdent() { | 13495 void Parser::SkipQualIdent() { |
| 13520 ASSERT(IsIdentifier()); | 13496 ASSERT(IsIdentifier()); |
| 13521 ConsumeToken(); | 13497 ConsumeToken(); |
| 13522 if (CurrentToken() == Token::kPERIOD) { | 13498 if (CurrentToken() == Token::kPERIOD) { |
| 13523 ConsumeToken(); // Consume the kPERIOD token. | 13499 ConsumeToken(); // Consume the kPERIOD token. |
| 13524 ExpectIdentifier("identifier expected after '.'"); | 13500 ExpectIdentifier("identifier expected after '.'"); |
| 13525 } | 13501 } |
| 13526 } | 13502 } |
| 13527 | 13503 |
| 13528 } // namespace dart | 13504 } // namespace dart |
| OLD | NEW |