| 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 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'package:expect/expect.dart'; | 6 import 'package:expect/expect.dart'; |
| 7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
| 8 import 'mock_compiler.dart'; | 8 import 'mock_compiler.dart'; |
| 9 import 'package:compiler/src/js/js.dart' as jsAst; | 9 import 'package:compiler/src/js/js.dart' as jsAst; |
| 10 import 'package:compiler/src/js/js.dart' show js; | 10 import 'package:compiler/src/js/js.dart' show js; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 testError("x++ ++ 42"), | 167 testError("x++ ++ 42"), |
| 168 // Shift operators. | 168 // Shift operators. |
| 169 testExpression("x << 5"), | 169 testExpression("x << 5"), |
| 170 testExpression("x << y + 1"), | 170 testExpression("x << y + 1"), |
| 171 testExpression("x <<= y + 1"), | 171 testExpression("x <<= y + 1"), |
| 172 // Array initializers. | 172 // Array initializers. |
| 173 testExpression("x = ['foo', 'bar', x[4]]"), | 173 testExpression("x = ['foo', 'bar', x[4]]"), |
| 174 testExpression("[]"), | 174 testExpression("[]"), |
| 175 testError("[42 42]"), | 175 testError("[42 42]"), |
| 176 testExpression('beebop([1, 2, 3])'), | 176 testExpression('beebop([1, 2, 3])'), |
| 177 // *We can't parse array literals with holes in them. | 177 // Array literals with holes in them. |
| 178 testError("[1,, 2]"), | 178 testExpression("[1,, 2]"), |
| 179 testError("[1,]"), | 179 testExpression("[1,]", "[1]"), |
| 180 testError("[,]"), | 180 testExpression("[1,,]", "[1,,]"), |
| 181 testError("[, 42]"), | 181 testExpression("[,]"), |
| 182 testExpression("[,,]"), |
| 183 testExpression("[, 42]"), |
| 182 // Ternary operator. | 184 // Ternary operator. |
| 183 testExpression("x = a ? b : c"), | 185 testExpression("x = a ? b : c"), |
| 184 testExpression("y = a == null ? b : a"), | 186 testExpression("y = a == null ? b : a"), |
| 185 testExpression("y = a == null ? b + c : a + c"), | 187 testExpression("y = a == null ? b + c : a + c"), |
| 186 testExpression("foo = a ? b : c ? d : e"), | 188 testExpression("foo = a ? b : c ? d : e"), |
| 187 testExpression("foo = a ? b ? c : d : e"), | 189 testExpression("foo = a ? b ? c : d : e"), |
| 188 testExpression("foo = (a = v) ? b = w : c = x ? d = y : e = z"), | 190 testExpression("foo = (a = v) ? b = w : c = x ? d = y : e = z"), |
| 189 testExpression("foo = (a = v) ? b = w ? c = x : d = y : e = z"), | 191 testExpression("foo = (a = v) ? b = w ? c = x : d = y : e = z"), |
| 190 // Stacked assignment. | 192 // Stacked assignment. |
| 191 testExpression("a = b = c"), | 193 testExpression("a = b = c"), |
| 192 testExpression("var a = b = c"), | 194 testExpression("var a = b = c"), |
| 193 ])); | 195 ])); |
| 194 } | 196 } |
| OLD | NEW |