| OLD | NEW |
| 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 '../../tree_ir/tree_ir_nodes.dart' as tree_ir; | 9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; |
| 10 import '../../tree_ir/tree_ir_nodes.dart' show BuiltinOperator; | 10 import '../../tree_ir/tree_ir_nodes.dart' show BuiltinOperator; |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 case BuiltinOperator.NumXor: | 793 case BuiltinOperator.NumXor: |
| 794 return js.js('(# ^ #) >>> 0', args); | 794 return js.js('(# ^ #) >>> 0', args); |
| 795 case BuiltinOperator.NumLt: | 795 case BuiltinOperator.NumLt: |
| 796 return new js.Binary('<', args[0], args[1]); | 796 return new js.Binary('<', args[0], args[1]); |
| 797 case BuiltinOperator.NumLe: | 797 case BuiltinOperator.NumLe: |
| 798 return new js.Binary('<=', args[0], args[1]); | 798 return new js.Binary('<=', args[0], args[1]); |
| 799 case BuiltinOperator.NumGt: | 799 case BuiltinOperator.NumGt: |
| 800 return new js.Binary('>', args[0], args[1]); | 800 return new js.Binary('>', args[0], args[1]); |
| 801 case BuiltinOperator.NumGe: | 801 case BuiltinOperator.NumGe: |
| 802 return new js.Binary('>=', args[0], args[1]); | 802 return new js.Binary('>=', args[0], args[1]); |
| 803 case BuiltinOperator.NumShl: |
| 804 return js.js('(# << #) >>> 0', args); |
| 803 case BuiltinOperator.StringConcatenate: | 805 case BuiltinOperator.StringConcatenate: |
| 804 if (args.isEmpty) return js.string(''); | 806 if (args.isEmpty) return js.string(''); |
| 805 return args.reduce((e1,e2) => new js.Binary('+', e1, e2)); | 807 return args.reduce((e1,e2) => new js.Binary('+', e1, e2)); |
| 806 case BuiltinOperator.Identical: | 808 case BuiltinOperator.Identical: |
| 807 registry.registerStaticInvocation(glue.identicalFunction); | 809 registry.registerStaticInvocation(glue.identicalFunction); |
| 808 return buildStaticHelperInvocation(glue.identicalFunction, args); | 810 return buildStaticHelperInvocation(glue.identicalFunction, args); |
| 809 case BuiltinOperator.StrictEq: | 811 case BuiltinOperator.StrictEq: |
| 810 return new js.Binary('===', args[0], args[1]); | 812 return new js.Binary('===', args[0], args[1]); |
| 811 case BuiltinOperator.StrictNeq: | 813 case BuiltinOperator.StrictNeq: |
| 812 return new js.Binary('!==', args[0], args[1]); | 814 return new js.Binary('!==', args[0], args[1]); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 831 js.Expression visitAwait(tree_ir.Await node) { | 833 js.Expression visitAwait(tree_ir.Await node) { |
| 832 return new js.Await(visitExpression(node.input)); | 834 return new js.Await(visitExpression(node.input)); |
| 833 } | 835 } |
| 834 | 836 |
| 835 visitFunctionExpression(tree_ir.FunctionExpression node) { | 837 visitFunctionExpression(tree_ir.FunctionExpression node) { |
| 836 // FunctionExpressions are currently unused. | 838 // FunctionExpressions are currently unused. |
| 837 // We might need them if we want to emit raw JS nested functions. | 839 // We might need them if we want to emit raw JS nested functions. |
| 838 throw 'FunctionExpressions should not be used'; | 840 throw 'FunctionExpressions should not be used'; |
| 839 } | 841 } |
| 840 } | 842 } |
| OLD | NEW |