| Index: runtime/vm/parser.cc
|
| ===================================================================
|
| --- runtime/vm/parser.cc (revision 10207)
|
| +++ runtime/vm/parser.cc (working copy)
|
| @@ -723,7 +723,7 @@
|
| if (!parser.current_function().IsLocalFunction() ||
|
| ((instantiator != NULL) && instantiator->is_captured())) {
|
| parsed_function->set_instantiator(
|
| - new LoadLocalNode(node_sequence->token_pos(), *instantiator));
|
| + new LoadLocalNode(node_sequence->token_pos(), instantiator));
|
| }
|
| }
|
|
|
| @@ -866,7 +866,7 @@
|
|
|
| // Receiver is local 0.
|
| LocalVariable* receiver = current_block_->scope->VariableAt(0);
|
| - LoadLocalNode* load_receiver = new LoadLocalNode(TokenPos(), *receiver);
|
| + LoadLocalNode* load_receiver = new LoadLocalNode(TokenPos(), receiver);
|
| // TokenPos() returns the function's token position which points to the
|
| // name of the field;
|
| ASSERT(IsIdentifier());
|
| @@ -914,9 +914,9 @@
|
| AddFormalParamsToScope(¶ms, current_block_->scope);
|
|
|
| LoadLocalNode* receiver =
|
| - new LoadLocalNode(TokenPos(), *current_block_->scope->VariableAt(0));
|
| + new LoadLocalNode(TokenPos(), current_block_->scope->VariableAt(0));
|
| LoadLocalNode* value =
|
| - new LoadLocalNode(TokenPos(), *current_block_->scope->VariableAt(1));
|
| + new LoadLocalNode(TokenPos(), current_block_->scope->VariableAt(1));
|
|
|
| StoreInstanceFieldNode* store_field =
|
| new StoreInstanceFieldNode(TokenPos(), receiver, field, value);
|
| @@ -1341,10 +1341,9 @@
|
| if (!IsSimpleLocalOrLiteralNode(index_expr)) {
|
| LocalVariable* temp =
|
| CreateTempConstVariable(operator_pos, index_expr->id(), "lix");
|
| - AstNode* save =
|
| - new StoreLocalNode(operator_pos, *temp, index_expr);
|
| + AstNode* save = new StoreLocalNode(operator_pos, temp, index_expr);
|
| current_block_->statements->Add(save);
|
| - index_expr = new LoadLocalNode(operator_pos, *temp);
|
| + index_expr = new LoadLocalNode(operator_pos, temp);
|
| }
|
| }
|
|
|
| @@ -1527,7 +1526,7 @@
|
| ctor_name = String::Concat(ctor_name, ctor_suffix);
|
| ArgumentListNode* arguments = new ArgumentListNode(supercall_pos);
|
| // Implicit 'this' parameter is the first argument.
|
| - AstNode* implicit_argument = new LoadLocalNode(supercall_pos, *receiver);
|
| + AstNode* implicit_argument = new LoadLocalNode(supercall_pos, receiver);
|
| arguments->Add(implicit_argument);
|
| // Implicit construction phase parameter is second argument.
|
| AstNode* phase_parameter =
|
| @@ -1578,7 +1577,7 @@
|
|
|
| ArgumentListNode* arguments = new ArgumentListNode(supercall_pos);
|
| // 'this' parameter is the first argument to super class constructor.
|
| - AstNode* implicit_argument = new LoadLocalNode(supercall_pos, *receiver);
|
| + AstNode* implicit_argument = new LoadLocalNode(supercall_pos, receiver);
|
| arguments->Add(implicit_argument);
|
| // Second implicit parameter is the construction phase. We optimistically
|
| // assume that we can execute both the super initializer and the super
|
| @@ -1639,7 +1638,7 @@
|
| field_name.ToCString());
|
| }
|
| CheckDuplicateFieldInit(field_pos, initialized_fields, &field);
|
| - AstNode* instance = new LoadLocalNode(field_pos, *receiver);
|
| + AstNode* instance = new LoadLocalNode(field_pos, receiver);
|
| return new StoreInstanceFieldNode(field_pos, instance, field, init_expr);
|
| }
|
|
|
| @@ -1794,12 +1793,12 @@
|
|
|
| ArgumentListNode* arguments = new ArgumentListNode(call_pos);
|
| // 'this' parameter is the first argument to constructor.
|
| - AstNode* implicit_argument = new LoadLocalNode(call_pos, *receiver);
|
| + AstNode* implicit_argument = new LoadLocalNode(call_pos, receiver);
|
| arguments->Add(implicit_argument);
|
| // Construction phase parameter is second argument.
|
| LocalVariable* phase_param = LookupPhaseParameter();
|
| ASSERT(phase_param != NULL);
|
| - AstNode* phase_argument = new LoadLocalNode(call_pos, *phase_param);
|
| + AstNode* phase_argument = new LoadLocalNode(call_pos, phase_param);
|
| arguments->Add(phase_argument);
|
| ParseActualParameters(arguments, kAllowConst);
|
|
|
| @@ -1854,7 +1853,7 @@
|
| // to strore the initializer expressions in the respective instance fields.
|
| for (int i = 0; i < initializers.length(); i++) {
|
| const Field* field = initializers[i].inst_field;
|
| - AstNode* instance = new LoadLocalNode(field->token_pos(), *receiver);
|
| + AstNode* instance = new LoadLocalNode(field->token_pos(), receiver);
|
| AstNode* field_init =
|
| new StoreInstanceFieldNode(field->token_pos(),
|
| instance,
|
| @@ -1942,7 +1941,7 @@
|
| OpenBlock();
|
| for (int i = 0; i < initializers.length(); i++) {
|
| const Field* field = initializers[i].inst_field;
|
| - AstNode* instance = new LoadLocalNode(field->token_pos(), *receiver);
|
| + AstNode* instance = new LoadLocalNode(field->token_pos(), receiver);
|
| AstNode* field_init =
|
| new StoreInstanceFieldNode(field->token_pos(),
|
| instance,
|
| @@ -1965,7 +1964,7 @@
|
| field_name.ToCString());
|
| }
|
| CheckDuplicateFieldInit(param.name_pos, &initialized_fields, &field);
|
| - AstNode* instance = new LoadLocalNode(param.name_pos, *receiver);
|
| + AstNode* instance = new LoadLocalNode(param.name_pos, receiver);
|
| LocalVariable* p =
|
| current_block_->scope->LookupVariable(*param.name, false);
|
| ASSERT(p != NULL);
|
| @@ -1973,7 +1972,7 @@
|
| // list, nor can they be used in the constructor body.
|
| // Thus, make the parameter invisible.
|
| p->set_invisible(true);
|
| - AstNode* value = new LoadLocalNode(param.name_pos, *p);
|
| + AstNode* value = new LoadLocalNode(param.name_pos, p);
|
| AstNode* initializer = new StoreInstanceFieldNode(
|
| param.name_pos, instance, field, value);
|
| current_block_->statements->Add(initializer);
|
| @@ -1988,7 +1987,7 @@
|
| if (init_statements->length() > 0) {
|
| // Generate guard around the initializer code.
|
| LocalVariable* phase_param = LookupPhaseParameter();
|
| - AstNode* phase_value = new LoadLocalNode(TokenPos(), *phase_param);
|
| + AstNode* phase_value = new LoadLocalNode(TokenPos(), phase_param);
|
| AstNode* phase_check = new BinaryOpNode(
|
| TokenPos(), Token::kBIT_AND, phase_value,
|
| new LiteralNode(TokenPos(),
|
| @@ -2038,8 +2037,7 @@
|
| if (!IsSimpleLocalOrLiteralNode(arg)) {
|
| LocalVariable* temp =
|
| CreateTempConstVariable(arg->token_pos(), arg->id(), "sca");
|
| - AstNode* save_temp =
|
| - new StoreLocalNode(arg->token_pos(), *temp, arg);
|
| + AstNode* save_temp = new StoreLocalNode(arg->token_pos(), temp, arg);
|
| ctor_args->SetNodeAt(i, save_temp);
|
| }
|
| }
|
| @@ -2057,7 +2055,7 @@
|
|
|
| ArgumentListNode* super_call_args = new ArgumentListNode(TokenPos());
|
| // First argument is the receiver.
|
| - super_call_args->Add(new LoadLocalNode(TokenPos(), *receiver));
|
| + super_call_args->Add(new LoadLocalNode(TokenPos(), receiver));
|
| // Second argument is the construction phase argument.
|
| AstNode* phase_parameter =
|
| new LiteralNode(TokenPos(),
|
| @@ -2072,10 +2070,10 @@
|
| } else {
|
| ASSERT(arg->IsLoadLocalNode() || arg->IsStoreLocalNode());
|
| if (arg->IsLoadLocalNode()) {
|
| - const LocalVariable& temp = arg->AsLoadLocalNode()->local();
|
| + const LocalVariable* temp = arg->AsLoadLocalNode()->local();
|
| super_call_args->Add(new LoadLocalNode(TokenPos(), temp));
|
| } else if (arg->IsStoreLocalNode()) {
|
| - const LocalVariable& temp = arg->AsStoreLocalNode()->local();
|
| + const LocalVariable* temp = arg->AsStoreLocalNode()->local();
|
| super_call_args->Add(new LoadLocalNode(TokenPos(), temp));
|
| }
|
| }
|
| @@ -2106,7 +2104,7 @@
|
| if (ctor_block->length() > 0) {
|
| // Generate guard around the constructor body code.
|
| LocalVariable* phase_param = LookupPhaseParameter();
|
| - AstNode* phase_value = new LoadLocalNode(TokenPos(), *phase_param);
|
| + AstNode* phase_value = new LoadLocalNode(TokenPos(), phase_param);
|
| AstNode* phase_check =
|
| new BinaryOpNode(TokenPos(), Token::kBIT_AND,
|
| phase_value,
|
| @@ -4226,7 +4224,7 @@
|
| if (receiver == NULL) {
|
| ErrorMsg(token_pos, "illegal implicit access to receiver 'this'");
|
| }
|
| - return new LoadLocalNode(TokenPos(), *receiver);
|
| + return new LoadLocalNode(TokenPos(), receiver);
|
| }
|
|
|
|
|
| @@ -4238,7 +4236,7 @@
|
| LocalVariable* param = LookupTypeArgumentsParameter(current_block_->scope,
|
| kTestOnly);
|
| ASSERT(param != NULL);
|
| - return new LoadLocalNode(TokenPos(), *param);
|
| + return new LoadLocalNode(TokenPos(), param);
|
| }
|
|
|
|
|
| @@ -4267,14 +4265,14 @@
|
| const intptr_t assign_pos = TokenPos();
|
| ConsumeToken();
|
| AstNode* expr = ParseExpr(is_const, kConsumeCascades);
|
| - initialization = new StoreLocalNode(assign_pos, *variable, expr);
|
| + initialization = new StoreLocalNode(assign_pos, variable, expr);
|
| } else if (is_final || is_const) {
|
| ErrorMsg(ident_pos,
|
| "missing initialization of 'final' or 'const' variable");
|
| } else {
|
| // Initialize variable with null.
|
| AstNode* null_expr = new LiteralNode(ident_pos, Instance::ZoneHandle());
|
| - initialization = new StoreLocalNode(ident_pos, *variable, null_expr);
|
| + initialization = new StoreLocalNode(ident_pos, variable, null_expr);
|
| }
|
| // Add variable to scope after parsing the initalizer expression.
|
| // The expression must not be able to refer to the variable.
|
| @@ -4550,7 +4548,7 @@
|
| return closure;
|
| } else {
|
| AstNode* initialization =
|
| - new StoreLocalNode(ident_pos, *function_variable, closure);
|
| + new StoreLocalNode(ident_pos, function_variable, closure);
|
| return initialization;
|
| }
|
| }
|
| @@ -4933,7 +4931,7 @@
|
| const intptr_t expr_pos = TokenPos();
|
| AstNode* expr = ParseExpr(kAllowConst, kConsumeCascades);
|
| AstNode* switch_expr_load = new LoadLocalNode(case_pos,
|
| - *switch_expr_value);
|
| + switch_expr_value);
|
| AstNode* case_comparison = new ComparisonNode(expr_pos,
|
| Token::kEQ,
|
| expr,
|
| @@ -5024,7 +5022,7 @@
|
| Type::ZoneHandle(Type::DynamicType()));
|
| current_block_->scope->AddVariable(temp_variable);
|
| AstNode* save_switch_expr =
|
| - new StoreLocalNode(expr_pos, *temp_variable, switch_expr);
|
| + new StoreLocalNode(expr_pos, temp_variable, switch_expr);
|
| current_block_->statements->Add(save_switch_expr);
|
|
|
| // Parse case clauses
|
| @@ -5169,13 +5167,13 @@
|
| AstNode* get_iterator = new InstanceCallNode(
|
| collection_pos, collection_expr, iterator_method_name, no_args);
|
| AstNode* iterator_init =
|
| - new StoreLocalNode(collection_pos, *iterator_var, get_iterator);
|
| + new StoreLocalNode(collection_pos, iterator_var, get_iterator);
|
| current_block_->statements->Add(iterator_init);
|
|
|
| // Generate while loop condition.
|
| AstNode* iterator_has_next = new InstanceCallNode(
|
| collection_pos,
|
| - new LoadLocalNode(collection_pos, *iterator_var),
|
| + new LoadLocalNode(collection_pos, iterator_var),
|
| String::ZoneHandle(Symbols::HasNext()),
|
| no_args);
|
|
|
| @@ -5188,7 +5186,7 @@
|
|
|
| AstNode* iterator_next = new InstanceCallNode(
|
| collection_pos,
|
| - new LoadLocalNode(collection_pos, *iterator_var),
|
| + new LoadLocalNode(collection_pos, iterator_var),
|
| String::ZoneHandle(Symbols::Next()),
|
| no_args);
|
|
|
| @@ -5198,7 +5196,7 @@
|
| // The for loop declares a new variable. Add it to the loop body scope.
|
| current_block_->scope->AddVariable(loop_var);
|
| loop_var_assignment =
|
| - new StoreLocalNode(loop_var_pos, *loop_var, iterator_next);
|
| + new StoreLocalNode(loop_var_pos, loop_var, iterator_next);
|
| } else {
|
| AstNode* loop_var_primary =
|
| ResolveIdent(loop_var_pos, *loop_var_name, false);
|
| @@ -5609,8 +5607,8 @@
|
| ASSERT(catch_excp_var != NULL);
|
| current_block_->statements->Add(
|
| new StoreLocalNode(catch_pos,
|
| - *var,
|
| - new LoadLocalNode(catch_pos, *catch_excp_var)));
|
| + var,
|
| + new LoadLocalNode(catch_pos, catch_excp_var)));
|
| if (stack_trace_param.var != NULL) {
|
| // A stack trace variable is specified in this block, so generate code
|
| // to load the stack trace object (:stacktrace_var) into the stack trace
|
| @@ -5619,8 +5617,8 @@
|
| ASSERT(catch_trace_var != NULL);
|
| current_block_->statements->Add(
|
| new StoreLocalNode(catch_pos,
|
| - *trace,
|
| - new LoadLocalNode(catch_pos, *catch_trace_var)));
|
| + trace,
|
| + new LoadLocalNode(catch_pos, catch_trace_var)));
|
| }
|
|
|
| ParseStatementSequence(); // Parse the catch handler code.
|
| @@ -5638,7 +5636,7 @@
|
| CaptureInstantiator();
|
| }
|
| TypeNode* exception_type = new TypeNode(catch_pos, *exception_param.type);
|
| - AstNode* exception_var = new LoadLocalNode(catch_pos, *catch_excp_var);
|
| + AstNode* exception_var = new LoadLocalNode(catch_pos, catch_excp_var);
|
| if (!exception_type->type().IsInstantiated()) {
|
| EnsureExpressionTemp();
|
| }
|
| @@ -5674,7 +5672,7 @@
|
| finally_block = ParseFinallyBlock();
|
| InlinedFinallyNode* node = new InlinedFinallyNode(finally_pos,
|
| finally_block,
|
| - *context_var);
|
| + context_var);
|
| AddFinallyBlockToNode(node_to_inline, node);
|
| node_index += 1;
|
| node_to_inline = inner_try_block->GetNodeToInlineFinally(node_index);
|
| @@ -5699,21 +5697,21 @@
|
| // the next catch handler can deal with it.
|
| catch_handler_list->Add(
|
| new ThrowNode(handler_pos,
|
| - new LoadLocalNode(handler_pos, *catch_excp_var),
|
| - new LoadLocalNode(handler_pos, *catch_trace_var)));
|
| + new LoadLocalNode(handler_pos, catch_excp_var),
|
| + new LoadLocalNode(handler_pos, catch_trace_var)));
|
| }
|
| CatchClauseNode* catch_block = new CatchClauseNode(handler_pos,
|
| catch_handler_list,
|
| - *context_var,
|
| - *catch_excp_var,
|
| - *catch_trace_var);
|
| + context_var,
|
| + catch_excp_var,
|
| + catch_trace_var);
|
|
|
| // Now create the try/catch ast node and return it. If there is a label
|
| // on the try/catch, close the block that's embedding the try statement
|
| // and attach the label to it.
|
| AstNode* try_catch_node =
|
| new TryCatchNode(try_pos, try_block, end_catch_label,
|
| - *context_var, catch_block, finally_block);
|
| + context_var, catch_block, finally_block);
|
|
|
| if (try_label != NULL) {
|
| current_block_->statements->Add(try_catch_node);
|
| @@ -5900,8 +5898,8 @@
|
| String::ZoneHandle(Symbols::StacktraceVar()));
|
| ASSERT(trace_var != NULL);
|
| statement = new ThrowNode(statement_pos,
|
| - new LoadLocalNode(statement_pos, *excp_var),
|
| - new LoadLocalNode(statement_pos, *trace_var));
|
| + new LoadLocalNode(statement_pos, excp_var),
|
| + new LoadLocalNode(statement_pos, trace_var));
|
| }
|
| } else {
|
| statement = ParseExpr(kAllowConst, kConsumeCascades);
|
| @@ -6293,12 +6291,12 @@
|
| }
|
|
|
|
|
| -const LocalVariable& Parser::GetIncrementTempLocal() {
|
| +const LocalVariable* Parser::GetIncrementTempLocal() {
|
| if (expression_temp_ == NULL) {
|
| expression_temp_ = ParsedFunction::CreateExpressionTempVar(
|
| current_function().token_pos());
|
| }
|
| - return *expression_temp_;
|
| + return expression_temp_;
|
| }
|
|
|
|
|
| @@ -6419,24 +6417,24 @@
|
| LocalVariable* temp =
|
| CreateTempConstVariable(token_pos, node_id, "lia");
|
| StoreLocalNode* save =
|
| - new StoreLocalNode(token_pos, *temp, left_node->array());
|
| + new StoreLocalNode(token_pos, temp, left_node->array());
|
| left_node =
|
| new LoadIndexedNode(token_pos, save, left_node->index_expr());
|
| right_node = new LoadIndexedNode(token_pos,
|
| - new LoadLocalNode(token_pos, *temp),
|
| + new LoadLocalNode(token_pos, temp),
|
| right_node->index_expr());
|
| }
|
| if (!IsSimpleLocalOrLiteralNode(left_node->index_expr())) {
|
| LocalVariable* temp =
|
| CreateTempConstVariable(token_pos, node_id, "lix");
|
| StoreLocalNode* save =
|
| - new StoreLocalNode(token_pos, *temp, left_node->index_expr());
|
| + new StoreLocalNode(token_pos, temp, left_node->index_expr());
|
| left_node = new LoadIndexedNode(token_pos,
|
| left_node->array(),
|
| save);
|
| right_node = new LoadIndexedNode(token_pos,
|
| right_node->array(),
|
| - new LoadLocalNode(token_pos, *temp));
|
| + new LoadLocalNode(token_pos, temp));
|
| }
|
| *expr = right_node;
|
| return left_node;
|
| @@ -6451,12 +6449,12 @@
|
| LocalVariable* temp =
|
| CreateTempConstVariable(token_pos, node_id, "igr");
|
| StoreLocalNode* save =
|
| - new StoreLocalNode(token_pos, *temp, left_node->receiver());
|
| + new StoreLocalNode(token_pos, temp, left_node->receiver());
|
| left_node = new InstanceGetterNode(token_pos,
|
| save,
|
| left_node->field_name());
|
| right_node = new InstanceGetterNode(token_pos,
|
| - new LoadLocalNode(token_pos, *temp),
|
| + new LoadLocalNode(token_pos, temp),
|
| right_node->field_name());
|
| }
|
| *expr = right_node;
|
| @@ -6482,12 +6480,12 @@
|
| LocalVariable* cascade_receiver_var =
|
| CreateTempConstVariable(cascade_pos, expr->id(), "casc");
|
| StoreLocalNode* save_cascade =
|
| - new StoreLocalNode(cascade_pos, *cascade_receiver_var, expr);
|
| + new StoreLocalNode(cascade_pos, cascade_receiver_var, expr);
|
| current_block_->statements->Add(save_cascade);
|
| while (CurrentToken() == Token::kCASCADE) {
|
| cascade_pos = TokenPos();
|
| LoadLocalNode* load_cascade_receiver =
|
| - new LoadLocalNode(cascade_pos, *cascade_receiver_var);
|
| + new LoadLocalNode(cascade_pos, cascade_receiver_var);
|
| if (Token::IsIdentifier(LookaheadToken(1))) {
|
| // Replace .. with . for ParseSelectors().
|
| token_kind_ = Token::kPERIOD;
|
| @@ -6524,7 +6522,7 @@
|
| current_block_->statements->Add(expr);
|
| }
|
| // Result of the cascade is the receiver.
|
| - return new LoadLocalNode(cascade_pos, *cascade_receiver_var);
|
| + return new LoadLocalNode(cascade_pos, cascade_receiver_var);
|
| }
|
|
|
|
|
| @@ -7082,7 +7080,7 @@
|
| ConsumeToken();
|
| // Not prefix.
|
| AstNode* left_expr = PrepareCompoundAssignmentNodes(&postfix_expr);
|
| - const LocalVariable& temp = GetIncrementTempLocal();
|
| + const LocalVariable* temp = GetIncrementTempLocal();
|
| AstNode* save =
|
| new StoreLocalNode(postfix_expr_pos, temp, postfix_expr);
|
| Token::Kind binary_op =
|
| @@ -7396,7 +7394,7 @@
|
| LocalVariable* local = LookupLocalScope(ident);
|
| if (local != NULL) {
|
| if (node != NULL) {
|
| - *node = new LoadLocalNode(ident_pos, *local);
|
| + *node = new LoadLocalNode(ident_pos, local);
|
| }
|
| return true;
|
| }
|
| @@ -7900,7 +7898,7 @@
|
| type_arguments,
|
| constructor,
|
| arguments,
|
| - *allocated);
|
| + allocated);
|
| }
|
|
|
|
|
| @@ -8600,7 +8598,7 @@
|
| if (local == NULL) {
|
| ErrorMsg("receiver 'this' is not in scope");
|
| }
|
| - primary = new LoadLocalNode(TokenPos(), *local);
|
| + primary = new LoadLocalNode(TokenPos(), local);
|
| ConsumeToken();
|
| } else if (CurrentToken() == Token::kINTEGER) {
|
| const Integer& literal = Integer::ZoneHandle(CurrentIntegerLiteral());
|
|
|