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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1353843002: dart2js cps: Support sync* and yield. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.ir_builder_task; 5 library dart2js.ir_builder_task;
6 6
7 import '../closure.dart' as closurelib; 7 import '../closure.dart' as closurelib;
8 import '../closure.dart' hide ClosureScope; 8 import '../closure.dart' hide ClosureScope;
9 import '../common/names.dart' show 9 import '../common/names.dart' show
10 Names, 10 Names,
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 visitAsyncForIn(ast.AsyncForIn node) { 372 visitAsyncForIn(ast.AsyncForIn node) {
373 // await for is not yet implemented. 373 // await for is not yet implemented.
374 return giveup(node, 'await for'); 374 return giveup(node, 'await for');
375 } 375 }
376 376
377 visitAwait(ast.Await node) { 377 visitAwait(ast.Await node) {
378 ir.Primitive value = visit(node.expression); 378 ir.Primitive value = visit(node.expression);
379 return irBuilder.buildAwait(value); 379 return irBuilder.buildAwait(value);
380 } 380 }
381 381
382 visitYield(ast.Yield node) {
383 ir.Primitive value = visit(node.expression);
384 return irBuilder.buildYield(value, node.hasStar);
385 }
386
382 visitSyncForIn(ast.SyncForIn node) { 387 visitSyncForIn(ast.SyncForIn node) {
383 // [node.declaredIdentifier] can be either an [ast.VariableDefinitions] 388 // [node.declaredIdentifier] can be either an [ast.VariableDefinitions]
384 // (defining a new local variable) or a send designating some existing 389 // (defining a new local variable) or a send designating some existing
385 // variable. 390 // variable.
386 ast.Node identifier = node.declaredIdentifier; 391 ast.Node identifier = node.declaredIdentifier;
387 ast.VariableDefinitions variableDeclaration = 392 ast.VariableDefinitions variableDeclaration =
388 identifier.asVariableDefinitions(); 393 identifier.asVariableDefinitions();
389 Element variableElement = elements.getForInVariable(node); 394 Element variableElement = elements.getForInVariable(node);
390 Selector selector = elements.getSelector(identifier); 395 Selector selector = elements.getSelector(identifier);
391 396
(...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 } 2397 }
2393 } 2398 }
2394 node.visitChildren(this); 2399 node.visitChildren(this);
2395 } 2400 }
2396 2401
2397 visitFunctionExpression(ast.FunctionExpression node) { 2402 visitFunctionExpression(ast.FunctionExpression node) {
2398 FunctionElement savedFunction = currentFunction; 2403 FunctionElement savedFunction = currentFunction;
2399 currentFunction = elements[node]; 2404 currentFunction = elements[node];
2400 2405
2401 if (currentFunction.asyncMarker != AsyncMarker.SYNC && 2406 if (currentFunction.asyncMarker != AsyncMarker.SYNC &&
2407 currentFunction.asyncMarker != AsyncMarker.SYNC_STAR &&
2402 currentFunction.asyncMarker != AsyncMarker.ASYNC) { 2408 currentFunction.asyncMarker != AsyncMarker.ASYNC) {
2403 giveup(node, "cannot handle sync*/async* functions"); 2409 giveup(node, "cannot handle sync*/async* functions");
2404 } 2410 }
2405 2411
2406 bool savedInsideInitializer = insideInitializer; 2412 bool savedInsideInitializer = insideInitializer;
2407 if (node.initializers != null) { 2413 if (node.initializers != null) {
2408 insideInitializer = true; 2414 insideInitializer = true;
2409 visit(node.initializers); 2415 visit(node.initializers);
2410 } 2416 }
2411 insideInitializer = false; 2417 insideInitializer = false;
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
3570 if (compiler.backend.isForeign(function)) { 3576 if (compiler.backend.isForeign(function)) {
3571 return handleForeignCode(node, function, argumentList, callStructure); 3577 return handleForeignCode(node, function, argumentList, callStructure);
3572 } else { 3578 } else {
3573 return irBuilder.buildStaticFunctionInvocation(function, callStructure, 3579 return irBuilder.buildStaticFunctionInvocation(function, callStructure,
3574 translateStaticArguments(argumentList, function, callStructure), 3580 translateStaticArguments(argumentList, function, callStructure),
3575 sourceInformation: 3581 sourceInformation:
3576 sourceInformationBuilder.buildCall(node, node.selector)); 3582 sourceInformationBuilder.buildCall(node, node.selector));
3577 } 3583 }
3578 } 3584 }
3579 } 3585 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698