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 "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 StaticCallNode* Parser::BuildInvocationMirrorAllocation( | 1331 StaticCallNode* Parser::BuildInvocationMirrorAllocation( |
1332 intptr_t call_pos, | 1332 intptr_t call_pos, |
1333 const String& function_name, | 1333 const String& function_name, |
1334 const ArgumentListNode& function_args) { | 1334 const ArgumentListNode& function_args) { |
1335 const intptr_t args_pos = function_args.token_pos(); | 1335 const intptr_t args_pos = function_args.token_pos(); |
1336 // Build arguments to the call to the static | 1336 // Build arguments to the call to the static |
1337 // InvocationMirror._allocateInvocationMirror method. | 1337 // InvocationMirror._allocateInvocationMirror method. |
1338 ArgumentListNode* arguments = new ArgumentListNode(args_pos); | 1338 ArgumentListNode* arguments = new ArgumentListNode(args_pos); |
1339 // The first argument is the original function name. | 1339 // The first argument is the original function name. |
1340 arguments->Add(new LiteralNode(args_pos, function_name)); | 1340 arguments->Add(new LiteralNode(args_pos, function_name)); |
1341 // The second argument is an array containing the original function arguments. | 1341 // The second argument is the arguments descriptor of the original function. |
| 1342 const Array& args_descriptor = |
| 1343 Array::ZoneHandle(ArgumentsDescriptor::New(function_args.length(), |
| 1344 function_args.names())); |
| 1345 arguments->Add(new LiteralNode(args_pos, args_descriptor)); |
| 1346 // The third argument is an array containing the original function arguments, |
| 1347 // including the receiver. |
1342 ArrayNode* args_array = new ArrayNode( | 1348 ArrayNode* args_array = new ArrayNode( |
1343 args_pos, Type::ZoneHandle(Type::ArrayType())); | 1349 args_pos, Type::ZoneHandle(Type::ArrayType())); |
1344 for (intptr_t i = 1; i < function_args.length(); i++) { | 1350 for (intptr_t i = 0; i < function_args.length(); i++) { |
1345 args_array->AddElement(function_args.NodeAt(i)); | 1351 args_array->AddElement(function_args.NodeAt(i)); |
1346 } | 1352 } |
1347 arguments->Add(args_array); | 1353 arguments->Add(args_array); |
1348 // Lookup the static InvocationMirror._allocateInvocationMirror method. | 1354 // Lookup the static InvocationMirror._allocateInvocationMirror method. |
1349 const Class& mirror_class = Class::Handle( | 1355 const Class& mirror_class = Class::Handle( |
1350 LookupCoreClass(String::Handle(Symbols::InvocationMirror()))); | 1356 LookupCoreClass(String::Handle(Symbols::InvocationMirror()))); |
1351 ASSERT(!mirror_class.IsNull()); | 1357 ASSERT(!mirror_class.IsNull()); |
1352 const String& allocation_function_name = | 1358 const String& allocation_function_name = |
1353 String::Handle(Symbols::AllocateInvocationMirror()); | 1359 String::Handle(Symbols::AllocateInvocationMirror()); |
1354 const Function& allocation_function = Function::ZoneHandle( | 1360 const Function& allocation_function = Function::ZoneHandle( |
(...skipping 8344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9699 void Parser::SkipQualIdent() { | 9705 void Parser::SkipQualIdent() { |
9700 ASSERT(IsIdentifier()); | 9706 ASSERT(IsIdentifier()); |
9701 ConsumeToken(); | 9707 ConsumeToken(); |
9702 if (CurrentToken() == Token::kPERIOD) { | 9708 if (CurrentToken() == Token::kPERIOD) { |
9703 ConsumeToken(); // Consume the kPERIOD token. | 9709 ConsumeToken(); // Consume the kPERIOD token. |
9704 ExpectIdentifier("identifier expected after '.'"); | 9710 ExpectIdentifier("identifier expected after '.'"); |
9705 } | 9711 } |
9706 } | 9712 } |
9707 | 9713 |
9708 } // namespace dart | 9714 } // namespace dart |
OLD | NEW |