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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/leg/resolver.dart ('k') | frog/leg/warnings.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class Interceptors { 5 class Interceptors {
6 Compiler compiler; 6 Compiler compiler;
7 Interceptors(Compiler this.compiler); 7 Interceptors(Compiler this.compiler);
8 8
9 SourceString mapOperatorToMethodName(Operator op) { 9 SourceString mapOperatorToMethodName(Operator op) {
10 String name = op.source.stringValue; 10 String name = op.source.stringValue;
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 HBasicBlock conditionExitBlock = close(new HLoopBranch(popBoolified())); 1318 HBasicBlock conditionExitBlock = close(new HLoopBranch(popBoolified()));
1319 1319
1320 Map conditionDefinitions = 1320 Map conditionDefinitions =
1321 new Map<Element, HInstruction>.from(definitions); 1321 new Map<Element, HInstruction>.from(definitions);
1322 1322
1323 // The body. 1323 // The body.
1324 HBasicBlock bodyBlock = addNewBlock(); 1324 HBasicBlock bodyBlock = addNewBlock();
1325 conditionExitBlock.addSuccessor(bodyBlock); 1325 conditionExitBlock.addSuccessor(bodyBlock);
1326 open(bodyBlock); 1326 open(bodyBlock);
1327 1327
1328 VariableDefinitions definition = node.declaredIdentifier;
1329 Identifier identifier = definition.definitions.nodes.head;
1330 Element variable = elements[identifier];
1331 String jsNextName = 1328 String jsNextName =
1332 compiler.namer.instanceName(new SourceString("next")); 1329 compiler.namer.instanceName(new SourceString("next"));
1333 push(new HInvokeDynamicMethod(jsNextName, [iterator])); 1330 push(new HInvokeDynamicMethod(jsNextName, [iterator]));
1331
1332 Element variable;
1333 if (node.declaredIdentifier is Send) {
ngeoffray 2012/01/11 15:20:09 is Send -> asSend() != null
1334 variable = elements[node.declaredIdentifier];
1335 } else {
1336 assert(node.declaredIdentifier is VariableDefinitions);
1337 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.
1338 }
1334 definitions[variable] = pop(); 1339 definitions[variable] = pop();
1335 1340
1336 visit(node.body); 1341 visit(node.body);
1337 if (isAborted()) { 1342 if (isAborted()) {
1338 compiler.unimplemented("SsaBuilder for loop with aborting body", 1343 compiler.unimplemented("SsaBuilder for loop with aborting body",
1339 node: node); 1344 node: node);
1340 } 1345 }
1341 bodyBlock = close(new HGoto()); 1346 bodyBlock = close(new HGoto());
1342 1347
1343 // Update. 1348 // Update.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 } 1389 }
1385 1390
1386 visitCatchBlock(CatchBlock node) { 1391 visitCatchBlock(CatchBlock node) {
1387 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); 1392 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node);
1388 } 1393 }
1389 1394
1390 visitTypedef(Typedef node) { 1395 visitTypedef(Typedef node) {
1391 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); 1396 compiler.unimplemented('SsaBuilder.visitTypedef', node: node);
1392 } 1397 }
1393 } 1398 }
OLDNEW
« 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