Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: runtime/vm/parser.cc

Issue 10283003: - Fix another side effect issue: never add AstNode to sequence unless they are a statement. Added t… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/opt_code_generator_ia32.cc ('k') | tests/language/compound_assignment_operator_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 7205)
+++ runtime/vm/parser.cc (working copy)
@@ -4429,7 +4429,11 @@
const intptr_t statement_pos = token_index_;
AstNode* statement = ParseStatement();
// Do not add statements with no effect (e.g., LoadLocalNode).
- if (statement != NULL && !statement->IsLoadLocalNode()) {
+ if ((statement != NULL) && statement->IsLoadLocalNode()) {
+ // Skip load local.
+ statement = statement->AsLoadLocalNode()->pseudo();
+ }
+ if (statement != NULL) {
if (!dead_code_allowed && abrupt_completing_seen) {
ErrorMsg(statement_pos, "dead code after abrupt completing statement");
}
@@ -6627,18 +6631,16 @@
postfix_expr_pos, postfix_expr->id(), "incoplix");
AstNode* save =
new StoreLocalNode(postfix_expr_pos, *temp, postfix_expr);
- current_block_->statements->Add(save);
- LoadLocalNode* load = new LoadLocalNode(postfix_expr_pos, *temp);
Token::Kind binary_op =
(incr_op == Token::kINCR) ? Token::kADD : Token::kSUB;
BinaryOpNode* add = new BinaryOpNode(
postfix_expr_pos,
binary_op,
- load,
+ save,
new LiteralNode(postfix_expr_pos, Smi::ZoneHandle(Smi::New(1))));
AstNode* store = postfix_expr->MakeAssignmentNode(add);
- current_block_->statements->Add(store);
- LoadLocalNode* load_res = new LoadLocalNode(postfix_expr_pos, *temp);
+ LoadLocalNode* load_res =
+ new LoadLocalNode(postfix_expr_pos, *temp, store);
return load_res;
} else {
AstNode* incr_op_node =
« no previous file with comments | « runtime/vm/opt_code_generator_ia32.cc ('k') | tests/language/compound_assignment_operator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698