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 12117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12128 if (IsArgumentPart()) { | 12128 if (IsArgumentPart()) { |
12129 // Identifier followed by optional type arguments and opening paren: | 12129 // Identifier followed by optional type arguments and opening paren: |
12130 // method call. | 12130 // method call. |
12131 TypeArguments& func_type_args = TypeArguments::ZoneHandle(Z); | 12131 TypeArguments& func_type_args = TypeArguments::ZoneHandle(Z); |
12132 if (CurrentToken() == Token::kLT) { | 12132 if (CurrentToken() == Token::kLT) { |
12133 // Type arguments. | 12133 // Type arguments. |
12134 if (!FLAG_generic_method_syntax) { | 12134 if (!FLAG_generic_method_syntax) { |
12135 ReportError("generic type arguments not supported."); | 12135 ReportError("generic type arguments not supported."); |
12136 } | 12136 } |
12137 func_type_args = ParseTypeArguments(ClassFinalizer::kCanonicalize); | 12137 func_type_args = ParseTypeArguments(ClassFinalizer::kCanonicalize); |
12138 if (!FLAG_reify_generic_functions) { | 12138 if (FLAG_reify_generic_functions) { |
| 12139 if (!func_type_args.IsNull() && !func_type_args.IsInstantiated() && |
| 12140 (FunctionLevel() > 0)) { |
| 12141 // Make sure that the instantiators are captured. |
| 12142 CaptureAllInstantiators(); |
| 12143 } |
| 12144 } else { |
12139 func_type_args = TypeArguments::null(); | 12145 func_type_args = TypeArguments::null(); |
12140 } | 12146 } |
12141 } | 12147 } |
12142 PrimaryNode* primary_node = left->AsPrimaryNode(); | 12148 PrimaryNode* primary_node = left->AsPrimaryNode(); |
12143 if ((primary_node != NULL) && primary_node->primary().IsClass()) { | 12149 if ((primary_node != NULL) && primary_node->primary().IsClass()) { |
12144 // Static method call prefixed with class name. | 12150 // Static method call prefixed with class name. |
12145 const Class& cls = Class::Cast(primary_node->primary()); | 12151 const Class& cls = Class::Cast(primary_node->primary()); |
12146 selector = ParseStaticCall(cls, *ident, ident_pos, func_type_args, | 12152 selector = ParseStaticCall(cls, *ident, ident_pos, func_type_args, |
12147 primary_node->prefix()); | 12153 primary_node->prefix()); |
12148 } else { | 12154 } else { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12221 selector = new (Z) | 12227 selector = new (Z) |
12222 LoadIndexedNode(bracket_pos, array, index, Class::ZoneHandle(Z)); | 12228 LoadIndexedNode(bracket_pos, array, index, Class::ZoneHandle(Z)); |
12223 } else if (IsArgumentPart()) { | 12229 } else if (IsArgumentPart()) { |
12224 TypeArguments& func_type_args = TypeArguments::ZoneHandle(Z); | 12230 TypeArguments& func_type_args = TypeArguments::ZoneHandle(Z); |
12225 if (CurrentToken() == Token::kLT) { | 12231 if (CurrentToken() == Token::kLT) { |
12226 // Type arguments. | 12232 // Type arguments. |
12227 if (!FLAG_generic_method_syntax) { | 12233 if (!FLAG_generic_method_syntax) { |
12228 ReportError("generic type arguments not supported."); | 12234 ReportError("generic type arguments not supported."); |
12229 } | 12235 } |
12230 func_type_args = ParseTypeArguments(ClassFinalizer::kCanonicalize); | 12236 func_type_args = ParseTypeArguments(ClassFinalizer::kCanonicalize); |
12231 if (!FLAG_reify_generic_functions) { | 12237 if (FLAG_reify_generic_functions) { |
| 12238 if (!func_type_args.IsNull() && !func_type_args.IsInstantiated() && |
| 12239 (FunctionLevel() > 0)) { |
| 12240 // Make sure that the instantiators are captured. |
| 12241 CaptureAllInstantiators(); |
| 12242 } |
| 12243 } else { |
12232 func_type_args = TypeArguments::null(); | 12244 func_type_args = TypeArguments::null(); |
12233 } | 12245 } |
12234 } | 12246 } |
12235 if (left->IsPrimaryNode()) { | 12247 if (left->IsPrimaryNode()) { |
12236 PrimaryNode* primary_node = left->AsPrimaryNode(); | 12248 PrimaryNode* primary_node = left->AsPrimaryNode(); |
12237 const TokenPosition primary_pos = primary_node->token_pos(); | 12249 const TokenPosition primary_pos = primary_node->token_pos(); |
12238 if (primary_node->primary().IsFunction()) { | 12250 if (primary_node->primary().IsFunction()) { |
12239 const Function& func = Function::Cast(primary_node->primary()); | 12251 const Function& func = Function::Cast(primary_node->primary()); |
12240 const String& func_name = String::ZoneHandle(Z, func.name()); | 12252 const String& func_name = String::ZoneHandle(Z, func.name()); |
12241 if (func.is_static()) { | 12253 if (func.is_static()) { |
(...skipping 2590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14832 const TokenPosition ident_pos = TokenPos(); | 14844 const TokenPosition ident_pos = TokenPos(); |
14833 const String& ident = *ExpectIdentifier("identifier expected"); | 14845 const String& ident = *ExpectIdentifier("identifier expected"); |
14834 if (IsArgumentPart()) { | 14846 if (IsArgumentPart()) { |
14835 TypeArguments& func_type_args = TypeArguments::ZoneHandle(Z); | 14847 TypeArguments& func_type_args = TypeArguments::ZoneHandle(Z); |
14836 if (CurrentToken() == Token::kLT) { | 14848 if (CurrentToken() == Token::kLT) { |
14837 // Type arguments. | 14849 // Type arguments. |
14838 if (!FLAG_generic_method_syntax) { | 14850 if (!FLAG_generic_method_syntax) { |
14839 ReportError("generic type arguments not supported."); | 14851 ReportError("generic type arguments not supported."); |
14840 } | 14852 } |
14841 func_type_args = ParseTypeArguments(ClassFinalizer::kCanonicalize); | 14853 func_type_args = ParseTypeArguments(ClassFinalizer::kCanonicalize); |
14842 if (!FLAG_reify_generic_functions) { | 14854 if (FLAG_reify_generic_functions) { |
| 14855 if (!func_type_args.IsNull() && !func_type_args.IsInstantiated() && |
| 14856 (FunctionLevel() > 0)) { |
| 14857 // Make sure that the instantiators are captured. |
| 14858 CaptureAllInstantiators(); |
| 14859 } |
| 14860 } else { |
14843 func_type_args = TypeArguments::null(); | 14861 func_type_args = TypeArguments::null(); |
14844 } | 14862 } |
14845 } | 14863 } |
14846 primary = ParseSuperCall(ident, func_type_args); | 14864 primary = ParseSuperCall(ident, func_type_args); |
14847 } else { | 14865 } else { |
14848 primary = ParseSuperFieldAccess(ident, ident_pos); | 14866 primary = ParseSuperFieldAccess(ident, ident_pos); |
14849 } | 14867 } |
14850 } else if ((CurrentToken() == Token::kLBRACK) || | 14868 } else if ((CurrentToken() == Token::kLBRACK) || |
14851 Token::CanBeOverloaded(CurrentToken()) || | 14869 Token::CanBeOverloaded(CurrentToken()) || |
14852 (CurrentToken() == Token::kNE)) { | 14870 (CurrentToken() == Token::kNE)) { |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15396 TokenPosition* start, | 15414 TokenPosition* start, |
15397 TokenPosition* end) { | 15415 TokenPosition* end) { |
15398 UNREACHABLE(); | 15416 UNREACHABLE(); |
15399 return false; | 15417 return false; |
15400 } | 15418 } |
15401 | 15419 |
15402 | 15420 |
15403 } // namespace dart | 15421 } // namespace dart |
15404 | 15422 |
15405 #endif // DART_PRECOMPILED_RUNTIME | 15423 #endif // DART_PRECOMPILED_RUNTIME |
OLD | NEW |