| OLD | NEW |
| 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 import 'package:expect/expect.dart'; |
| 5 import 'mock_compiler.dart'; | 6 import 'mock_compiler.dart'; |
| 6 import '../../../sdk/lib/_internal/compiler/implementation/js/js.dart' as jsAst; | 7 import '../../../sdk/lib/_internal/compiler/implementation/js/js.dart' as jsAst; |
| 7 import '../../../sdk/lib/_internal/compiler/implementation/js/js.dart' show js; | 8 import '../../../sdk/lib/_internal/compiler/implementation/js/js.dart' show js; |
| 8 | 9 |
| 9 void testExpression(String expression, [String expect = ""]) { | 10 void testExpression(String expression, [String expect = ""]) { |
| 10 jsAst.Node node = js(expression); | 11 jsAst.Node node = js(expression); |
| 11 MockCompiler compiler = new MockCompiler(); | 12 MockCompiler compiler = new MockCompiler(); |
| 12 String jsText = | 13 String jsText = |
| 13 jsAst.prettyPrint(node, | 14 jsAst.prettyPrint(node, |
| 14 compiler, | 15 compiler, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 testExpression("y = a == null ? b : a"); | 148 testExpression("y = a == null ? b : a"); |
| 148 testExpression("y = a == null ? b + c : a + c"); | 149 testExpression("y = a == null ? b + c : a + c"); |
| 149 testExpression("foo = a ? b : c ? d : e"); | 150 testExpression("foo = a ? b : c ? d : e"); |
| 150 testExpression("foo = a ? b ? c : d : e"); | 151 testExpression("foo = a ? b ? c : d : e"); |
| 151 testExpression("foo = (a = v) ? b = w : c = x ? d = y : e = z"); | 152 testExpression("foo = (a = v) ? b = w : c = x ? d = y : e = z"); |
| 152 testExpression("foo = (a = v) ? b = w ? c = x : d = y : e = z"); | 153 testExpression("foo = (a = v) ? b = w ? c = x : d = y : e = z"); |
| 153 // Stacked assignment. | 154 // Stacked assignment. |
| 154 testExpression("a = b = c"); | 155 testExpression("a = b = c"); |
| 155 testExpression("var a = b = c"); | 156 testExpression("var a = b = c"); |
| 156 } | 157 } |
| OLD | NEW |