OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/parser.h" | 5 #include "vm/parser.h" |
6 #include "vm/flags.h" | 6 #include "vm/flags.h" |
7 | 7 |
8 #ifndef DART_PRECOMPILED_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME |
9 | 9 |
10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
(...skipping 12080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12091 } else if (current_function().is_static()) { | 12091 } else if (current_function().is_static()) { |
12092 // The static call will be converted to throwing a NSM error. | 12092 // The static call will be converted to throwing a NSM error. |
12093 selector = ParseStaticCall(current_class(), name, primary_pos); | 12093 selector = ParseStaticCall(current_class(), name, primary_pos); |
12094 } else { | 12094 } else { |
12095 // Treat as call to unresolved (instance) method. | 12095 // Treat as call to unresolved (instance) method. |
12096 selector = | 12096 selector = |
12097 ParseInstanceCall(LoadReceiver(primary_pos), name, primary_pos, | 12097 ParseInstanceCall(LoadReceiver(primary_pos), name, primary_pos, |
12098 false /* is_conditional */); | 12098 false /* is_conditional */); |
12099 } | 12099 } |
12100 } else if (primary_node->primary().IsTypeParameter()) { | 12100 } else if (primary_node->primary().IsTypeParameter()) { |
12101 TypeParameter& type_parameter = TypeParameter::ZoneHandle(Z); | 12101 selector = LoadTypeParameter(primary_node); |
12102 type_parameter = TypeParameter::Cast(primary_node->primary()).raw(); | |
12103 const String& name = String::ZoneHandle(Z, type_parameter.name()); | |
12104 if (type_parameter.IsClassTypeParameter()) { | |
12105 if (ParsingStaticMember()) { | |
12106 // Treat as this.T(), because T is in scope. | |
12107 ReportError(primary_pos, | |
12108 "cannot access type parameter '%s' " | |
12109 "from static function", | |
12110 name.ToCString()); | |
12111 } else { | |
12112 // Treat as call to unresolved (instance) method. | |
12113 selector = | |
12114 ParseInstanceCall(LoadReceiver(primary_pos), name, | |
12115 primary_pos, false /* is_conditional */); | |
12116 } | |
12117 } else { | |
12118 ASSERT(type_parameter.IsFunctionTypeParameter()); | |
12119 // TODO(regis): Should we throw a type error instead? | |
12120 ReportError(primary_pos, | |
12121 "illegal use of function type parameter '%s'", | |
12122 name.ToCString()); | |
12123 } | |
12124 } else if (primary_node->primary().IsClass()) { | 12102 } else if (primary_node->primary().IsClass()) { |
12125 const Class& type_class = Class::Cast(primary_node->primary()); | 12103 const Class& type_class = Class::Cast(primary_node->primary()); |
12126 AbstractType& type = Type::ZoneHandle( | 12104 AbstractType& type = Type::ZoneHandle( |
12127 Z, Type::New(type_class, TypeArguments::Handle(Z), primary_pos, | 12105 Z, Type::New(type_class, Object::null_type_arguments(), |
12128 Heap::kOld)); | 12106 primary_pos, Heap::kOld)); |
12129 type ^= CanonicalizeType(type); | 12107 type ^= CanonicalizeType(type); |
12130 // Type may be malbounded, but not malformed. | 12108 // Type may be malbounded, but not malformed. |
12131 ASSERT(!type.IsMalformed()); | 12109 ASSERT(!type.IsMalformed()); |
12132 selector = new (Z) TypeNode(primary_pos, type, | 12110 selector = new (Z) TypeNode(primary_pos, type, |
12133 primary_node->is_deferred_reference()); | 12111 primary_node->is_deferred_reference()); |
12134 } else { | 12112 } else { |
12135 UNREACHABLE(); // Internal parser error. | 12113 UNREACHABLE(); // Internal parser error. |
12136 } | 12114 } |
12137 } else { | 12115 } else { |
12138 // Left is not a primary node; this must be a closure call. | 12116 // Left is not a primary node; this must be a closure call. |
(...skipping 3075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15214 const ArgumentListNode& function_args, | 15192 const ArgumentListNode& function_args, |
15215 const LocalVariable* temp_for_last_arg, | 15193 const LocalVariable* temp_for_last_arg, |
15216 bool is_super_invocation) { | 15194 bool is_super_invocation) { |
15217 UNREACHABLE(); | 15195 UNREACHABLE(); |
15218 return NULL; | 15196 return NULL; |
15219 } | 15197 } |
15220 | 15198 |
15221 } // namespace dart | 15199 } // namespace dart |
15222 | 15200 |
15223 #endif // DART_PRECOMPILED_RUNTIME | 15201 #endif // DART_PRECOMPILED_RUNTIME |
OLD | NEW |