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 "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/ast_transformer.h" | 9 #include "vm/ast_transformer.h" |
10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1422 ArgumentListNode* func_args = new ArgumentListNode(token_pos); | 1422 ArgumentListNode* func_args = new ArgumentListNode(token_pos); |
1423 if (!func.is_static()) { | 1423 if (!func.is_static()) { |
1424 func_args->Add(LoadReceiver(token_pos)); | 1424 func_args->Add(LoadReceiver(token_pos)); |
1425 } | 1425 } |
1426 // Skip implicit parameter at 0. | 1426 // Skip implicit parameter at 0. |
1427 for (intptr_t i = 1; i < func.NumParameters(); ++i) { | 1427 for (intptr_t i = 1; i < func.NumParameters(); ++i) { |
1428 func_args->Add(new LoadLocalNode(token_pos, scope->VariableAt(i))); | 1428 func_args->Add(new LoadLocalNode(token_pos, scope->VariableAt(i))); |
1429 } | 1429 } |
1430 | 1430 |
1431 if (func.HasOptionalNamedParameters()) { | 1431 if (func.HasOptionalNamedParameters()) { |
| 1432 // TODO(srdjan): Must allocate array in old space, since it |
| 1433 // runs in background compiler. Find a better way. |
1432 const Array& arg_names = | 1434 const Array& arg_names = |
1433 Array::ZoneHandle(Array::New(func.NumOptionalParameters())); | 1435 Array::ZoneHandle(Array::New(func.NumOptionalParameters(), Heap::kOld)); |
1434 for (intptr_t i = 0; i < arg_names.Length(); ++i) { | 1436 for (intptr_t i = 0; i < arg_names.Length(); ++i) { |
1435 intptr_t index = func.num_fixed_parameters() + i; | 1437 intptr_t index = func.num_fixed_parameters() + i; |
1436 arg_names.SetAt(i, String::Handle(func.ParameterNameAt(index))); | 1438 arg_names.SetAt(i, String::Handle(func.ParameterNameAt(index))); |
1437 } | 1439 } |
1438 func_args->set_names(arg_names); | 1440 func_args->set_names(arg_names); |
1439 } | 1441 } |
1440 StaticCallNode* call = new StaticCallNode(token_pos, parent, func_args); | 1442 StaticCallNode* call = new StaticCallNode(token_pos, parent, func_args); |
1441 ReturnNode* return_node = new ReturnNode(token_pos, call); | 1443 ReturnNode* return_node = new ReturnNode(token_pos, call); |
1442 current_block_->statements->Add(return_node); | 1444 current_block_->statements->Add(return_node); |
1443 return CloseBlock(); | 1445 return CloseBlock(); |
(...skipping 12887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14331 void Parser::SkipQualIdent() { | 14333 void Parser::SkipQualIdent() { |
14332 ASSERT(IsIdentifier()); | 14334 ASSERT(IsIdentifier()); |
14333 ConsumeToken(); | 14335 ConsumeToken(); |
14334 if (CurrentToken() == Token::kPERIOD) { | 14336 if (CurrentToken() == Token::kPERIOD) { |
14335 ConsumeToken(); // Consume the kPERIOD token. | 14337 ConsumeToken(); // Consume the kPERIOD token. |
14336 ExpectIdentifier("identifier expected after '.'"); | 14338 ExpectIdentifier("identifier expected after '.'"); |
14337 } | 14339 } |
14338 } | 14340 } |
14339 | 14341 |
14340 } // namespace dart | 14342 } // namespace dart |
OLD | NEW |