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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 code_generator; 5 library code_generator;
6 6
7 import 'glue.dart'; 7 import 'glue.dart';
8 8
9 import '../../closure.dart' show ClosureClassElement; 9 import '../../closure.dart' show ClosureClassElement;
10 import '../../common/codegen.dart' show CodegenRegistry; 10 import '../../common/codegen.dart' show CodegenRegistry;
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 js.Expression visitForeignExpression(tree_ir.ForeignExpression node) { 831 js.Expression visitForeignExpression(tree_ir.ForeignExpression node) {
832 return handleForeignCode(node); 832 return handleForeignCode(node);
833 } 833 }
834 834
835 @override 835 @override
836 void visitForeignStatement(tree_ir.ForeignStatement node) { 836 void visitForeignStatement(tree_ir.ForeignStatement node) {
837 accumulator.add(handleForeignCode(node)); 837 accumulator.add(handleForeignCode(node));
838 } 838 }
839 839
840 @override 840 @override
841 void visitYield(tree_ir.Yield node) {
842 js.Expression value = visitExpression(node.input);
843 accumulator.add(new js.DartYield(value, node.hasStar));
844 }
845
846 @override
841 js.Expression visitApplyBuiltinOperator(tree_ir.ApplyBuiltinOperator node) { 847 js.Expression visitApplyBuiltinOperator(tree_ir.ApplyBuiltinOperator node) {
842 List<js.Expression> args = visitExpressionList(node.arguments); 848 List<js.Expression> args = visitExpressionList(node.arguments);
843 switch (node.operator) { 849 switch (node.operator) {
844 case BuiltinOperator.NumAdd: 850 case BuiltinOperator.NumAdd:
845 return new js.Binary('+', args[0], args[1]); 851 return new js.Binary('+', args[0], args[1]);
846 case BuiltinOperator.NumSubtract: 852 case BuiltinOperator.NumSubtract:
847 return new js.Binary('-', args[0], args[1]); 853 return new js.Binary('-', args[0], args[1]);
848 case BuiltinOperator.NumMultiply: 854 case BuiltinOperator.NumMultiply:
849 return new js.Binary('*', args[0], args[1]); 855 return new js.Binary('*', args[0], args[1]);
850 case BuiltinOperator.NumAnd: 856 case BuiltinOperator.NumAnd:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 js.Expression visitAwait(tree_ir.Await node) { 915 js.Expression visitAwait(tree_ir.Await node) {
910 return new js.Await(visitExpression(node.input)); 916 return new js.Await(visitExpression(node.input));
911 } 917 }
912 918
913 visitFunctionExpression(tree_ir.FunctionExpression node) { 919 visitFunctionExpression(tree_ir.FunctionExpression node) {
914 // FunctionExpressions are currently unused. 920 // FunctionExpressions are currently unused.
915 // We might need them if we want to emit raw JS nested functions. 921 // We might need them if we want to emit raw JS nested functions.
916 throw 'FunctionExpressions should not be used'; 922 throw 'FunctionExpressions should not be used';
917 } 923 }
918 } 924 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698