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 12868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12879 if (!innermost_function().IsNull()) { | 12879 if (!innermost_function().IsNull()) { |
12880 // TODO(regis): Shortcut this lookup if no generic functions in scope. | 12880 // TODO(regis): Shortcut this lookup if no generic functions in scope. |
12881 intptr_t type_param_func_level = FunctionLevel(); | 12881 intptr_t type_param_func_level = FunctionLevel(); |
12882 const TypeParameter& type_parameter = | 12882 const TypeParameter& type_parameter = |
12883 TypeParameter::ZoneHandle(Z, innermost_function().LookupTypeParameter( | 12883 TypeParameter::ZoneHandle(Z, innermost_function().LookupTypeParameter( |
12884 ident, &type_param_func_level)); | 12884 ident, &type_param_func_level)); |
12885 if (!type_parameter.IsNull()) { | 12885 if (!type_parameter.IsNull()) { |
12886 if ((resolved == NULL) || (resolved_func_level < type_param_func_level)) { | 12886 if ((resolved == NULL) || (resolved_func_level < type_param_func_level)) { |
12887 // The identifier is a function type parameter, possibly shadowing | 12887 // The identifier is a function type parameter, possibly shadowing |
12888 // 'resolved'. | 12888 // 'resolved'. |
12889 if (type_param_func_level < FunctionLevel()) { | 12889 if ((FunctionLevel() > 0) && |
| 12890 (type_param_func_level < FunctionLevel())) { |
12890 // Make sure that the function instantiator is captured. | 12891 // Make sure that the function instantiator is captured. |
12891 CaptureFunctionInstantiator(); | 12892 CaptureFunctionInstantiator(); |
12892 } | 12893 } |
12893 // TODO(regis): Finalize type parameter and return as type node. | 12894 // TODO(regis): Finalize type parameter and return as type node. |
12894 // For now, map to dynamic type. | 12895 // For now, map to dynamic type. |
12895 Type& type = Type::ZoneHandle(Z, Type::DynamicType()); | 12896 Type& type = Type::ZoneHandle(Z, Type::DynamicType()); |
12896 return new (Z) TypeNode(ident_pos, type); | 12897 return new (Z) TypeNode(ident_pos, type); |
12897 } | 12898 } |
12898 } | 12899 } |
12899 } | 12900 } |
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14353 // TODO(regis): Shortcut this lookup if no generic functions in scope. | 14354 // TODO(regis): Shortcut this lookup if no generic functions in scope. |
14354 intptr_t type_param_func_level = FunctionLevel(); | 14355 intptr_t type_param_func_level = FunctionLevel(); |
14355 TypeParameter& type_param = TypeParameter::ZoneHandle( | 14356 TypeParameter& type_param = TypeParameter::ZoneHandle( |
14356 Z, innermost_function().LookupTypeParameter( | 14357 Z, innermost_function().LookupTypeParameter( |
14357 ident, &type_param_func_level)); | 14358 ident, &type_param_func_level)); |
14358 if (!type_param.IsNull()) { | 14359 if (!type_param.IsNull()) { |
14359 if ((primary == NULL) || | 14360 if ((primary == NULL) || |
14360 (primary_func_level < type_param_func_level)) { | 14361 (primary_func_level < type_param_func_level)) { |
14361 // The identifier is a function type parameter, possibly shadowing | 14362 // The identifier is a function type parameter, possibly shadowing |
14362 // already resolved 'primary'. | 14363 // already resolved 'primary'. |
14363 if (type_param_func_level < FunctionLevel()) { | 14364 if ((FunctionLevel() > 0) && |
| 14365 (type_param_func_level < FunctionLevel())) { |
14364 // Make sure that the function instantiator is captured. | 14366 // Make sure that the function instantiator is captured. |
14365 CaptureFunctionInstantiator(); | 14367 CaptureFunctionInstantiator(); |
14366 } | 14368 } |
14367 return new (Z) PrimaryNode(qual_ident_pos, type_param); | 14369 return new (Z) PrimaryNode(qual_ident_pos, type_param); |
14368 } | 14370 } |
14369 } | 14371 } |
14370 } | 14372 } |
14371 if (primary == NULL) { | 14373 if (primary == NULL) { |
14372 // Check whether the identifier is a type parameter. | 14374 // Check whether the identifier is a type parameter. |
14373 if (!current_class().IsNull()) { | 14375 if (!current_class().IsNull()) { |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15041 const ArgumentListNode& function_args, | 15043 const ArgumentListNode& function_args, |
15042 const LocalVariable* temp_for_last_arg, | 15044 const LocalVariable* temp_for_last_arg, |
15043 bool is_super_invocation) { | 15045 bool is_super_invocation) { |
15044 UNREACHABLE(); | 15046 UNREACHABLE(); |
15045 return NULL; | 15047 return NULL; |
15046 } | 15048 } |
15047 | 15049 |
15048 } // namespace dart | 15050 } // namespace dart |
15049 | 15051 |
15050 #endif // DART_PRECOMPILED_RUNTIME | 15052 #endif // DART_PRECOMPILED_RUNTIME |
OLD | NEW |