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

Unified Diff: runtime/vm/parser.cc

Issue 11745028: Fix incorrect desugaring of cascades. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 12 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 | « no previous file | tests/language/cascade_2_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 179d96d8fc0743e37cf0aedf8081b1bfcfea0b93..d83d7746e84bfa174597e4c47dcea5eddf872f42 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -6912,9 +6912,10 @@ AstNode* Parser::ParseCascades(AstNode* expr) {
intptr_t cascade_pos = TokenPos();
LocalVariable* cascade_receiver_var =
CreateTempConstVariable(cascade_pos, "casc");
+ SequenceNode* cascade = new SequenceNode(cascade_pos, NULL);
Ivan Posva 2013/01/04 17:31:56 Can you please explain why this is not a hack? You
Kevin Millikin (Google) 2013/01/07 09:14:14 I think it is a hack. I'll add a comment here, at
StoreLocalNode* save_cascade =
new StoreLocalNode(cascade_pos, cascade_receiver_var, expr);
- current_block_->statements->Add(save_cascade);
+ cascade->Add(save_cascade);
while (CurrentToken() == Token::kCASCADE) {
cascade_pos = TokenPos();
LoadLocalNode* load_cascade_receiver =
@@ -6952,10 +6953,10 @@ AstNode* Parser::ParseCascades(AstNode* expr) {
}
expr = assign_expr;
}
- current_block_->statements->Add(expr);
+ cascade->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, cascade);
}
« no previous file with comments | « no previous file | tests/language/cascade_2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698