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

Unified Diff: frog/leg/ssa/builder.dart

Issue 9139014: Allow for-in to use a previously declared identifier as variable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add more tests Created 8 years, 11 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 | « frog/leg/resolver.dart ('k') | frog/leg/warnings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/ssa/builder.dart
diff --git a/frog/leg/ssa/builder.dart b/frog/leg/ssa/builder.dart
index c82c85bddd83db8a425e7286aefd8902c31e2416..aa4cf6463e1cf77452bbe410a4bf81e3963e632e 100644
--- a/frog/leg/ssa/builder.dart
+++ b/frog/leg/ssa/builder.dart
@@ -1325,12 +1325,17 @@ class SsaBuilder implements Visitor {
conditionExitBlock.addSuccessor(bodyBlock);
open(bodyBlock);
- VariableDefinitions definition = node.declaredIdentifier;
- Identifier identifier = definition.definitions.nodes.head;
- Element variable = elements[identifier];
String jsNextName =
compiler.namer.instanceName(new SourceString("next"));
push(new HInvokeDynamicMethod(jsNextName, [iterator]));
+
+ Element variable;
+ if (node.declaredIdentifier is Send) {
ngeoffray 2012/01/11 15:20:09 is Send -> asSend() != null
+ variable = elements[node.declaredIdentifier];
+ } else {
+ assert(node.declaredIdentifier is VariableDefinitions);
+ variable = elements[node.declaredIdentifier.definitions.nodes.head];
ngeoffray 2012/01/11 15:20:09 This will give you a type warning. I have heard we
Lasse Reichstein 2012/01/12 07:49:31 Ah ok. Where do I disable warnings :P.
+ }
definitions[variable] = pop();
visit(node.body);
« no previous file with comments | « frog/leg/resolver.dart ('k') | frog/leg/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698