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 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2411 arguments->Add(new LiteralNode(args_pos, function_name)); | 2411 arguments->Add(new LiteralNode(args_pos, function_name)); |
2412 // The second argument is the arguments descriptor of the original function. | 2412 // The second argument is the arguments descriptor of the original function. |
2413 const Array& args_descriptor = Array::ZoneHandle( | 2413 const Array& args_descriptor = Array::ZoneHandle( |
2414 ArgumentsDescriptor::New(function_args.type_args_len(), | 2414 ArgumentsDescriptor::New(function_args.type_args_len(), |
2415 function_args.length(), function_args.names())); | 2415 function_args.length(), function_args.names())); |
2416 arguments->Add(new LiteralNode(args_pos, args_descriptor)); | 2416 arguments->Add(new LiteralNode(args_pos, args_descriptor)); |
2417 // The third argument is an array containing the original function arguments, | 2417 // The third argument is an array containing the original function arguments, |
2418 // including the function type arguments and the receiver. | 2418 // including the function type arguments and the receiver. |
2419 ArrayNode* args_array = | 2419 ArrayNode* args_array = |
2420 new ArrayNode(args_pos, Type::ZoneHandle(Type::ArrayType())); | 2420 new ArrayNode(args_pos, Type::ZoneHandle(Type::ArrayType())); |
2421 // The type_args_var is only used in the generated body of an implicit closure | 2421 // A type_args_var is allocated in the generated body of an implicit |
2422 // where noSuchMethod should never be called. | 2422 // closure and in the generated body of a noSuchMethodDispatcher. |
2423 ASSERT(function_args.type_args_var() == NULL); | 2423 // Pass the type arguments to the invocation mirror as the first argument. |
2424 if (!function_args.type_arguments().IsNull()) { | 2424 if (function_args.type_args_var() != NULL) { |
2425 // TODO(regis): Pass the original type arguments to the invocation mirror. | 2425 ASSERT(function_args.type_arguments().IsNull()); |
| 2426 args_array->AddElement( |
| 2427 new LoadLocalNode(args_pos, function_args.type_args_var())); |
| 2428 } else if (!function_args.type_arguments().IsNull()) { |
| 2429 args_array->AddElement( |
| 2430 new LiteralNode(args_pos, function_args.type_arguments())); |
2426 } | 2431 } |
2427 for (intptr_t i = 0; i < function_args.length(); i++) { | 2432 for (intptr_t i = 0; i < function_args.length(); i++) { |
2428 AstNode* arg = function_args.NodeAt(i); | 2433 AstNode* arg = function_args.NodeAt(i); |
2429 if ((temp_for_last_arg != NULL) && (i == function_args.length() - 1)) { | 2434 if ((temp_for_last_arg != NULL) && (i == function_args.length() - 1)) { |
2430 LetNode* store_arg = new LetNode(arg->token_pos()); | 2435 LetNode* store_arg = new LetNode(arg->token_pos()); |
2431 store_arg->AddNode( | 2436 store_arg->AddNode( |
2432 new StoreLocalNode(arg->token_pos(), temp_for_last_arg, arg)); | 2437 new StoreLocalNode(arg->token_pos(), temp_for_last_arg, arg)); |
2433 store_arg->AddNode( | 2438 store_arg->AddNode( |
2434 new LoadLocalNode(arg->token_pos(), temp_for_last_arg)); | 2439 new LoadLocalNode(arg->token_pos(), temp_for_last_arg)); |
2435 args_array->AddElement(store_arg); | 2440 args_array->AddElement(store_arg); |
(...skipping 12677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15113 bool Parser::FieldHasFunctionLiteralInitializer(const Field& field, | 15118 bool Parser::FieldHasFunctionLiteralInitializer(const Field& field, |
15114 TokenPosition* start, | 15119 TokenPosition* start, |
15115 TokenPosition* end) { | 15120 TokenPosition* end) { |
15116 UNREACHABLE(); | 15121 UNREACHABLE(); |
15117 return false; | 15122 return false; |
15118 } | 15123 } |
15119 | 15124 |
15120 } // namespace dart | 15125 } // namespace dart |
15121 | 15126 |
15122 #endif // DART_PRECOMPILED_RUNTIME | 15127 #endif // DART_PRECOMPILED_RUNTIME |
OLD | NEW |