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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 testExpression('x = a + b + c'), | 51 testExpression('x = a + b + c'), |
52 // We can cope with relational operators and non-relational. | 52 // We can cope with relational operators and non-relational. |
53 testExpression('a + b == c + d'), | 53 testExpression('a + b == c + d'), |
54 // The prettyprinter will insert braces where needed. | 54 // The prettyprinter will insert braces where needed. |
55 testExpression('a + (b == c) + d'), | 55 testExpression('a + (b == c) + d'), |
56 // We can handle () for calls. | 56 // We can handle () for calls. |
57 testExpression('foo(bar)'), | 57 testExpression('foo(bar)'), |
58 testExpression('foo(bar, baz)'), | 58 testExpression('foo(bar, baz)'), |
59 // Chained calls without parentheses. | 59 // Chained calls without parentheses. |
60 testExpression('foo(bar)(baz)'), | 60 testExpression('foo(bar)(baz)'), |
61 // Chaned calls with and without new. | 61 // Chained calls with and without new. |
62 testExpression('new foo(bar)(baz)'), | 62 testExpression('new foo(bar)(baz)'), |
63 testExpression('new foo.bar(bar)(baz)'), | 63 testExpression('new foo.bar(bar)(baz)'), |
64 testExpression('foo.bar(bar)(baz)'), | 64 testExpression('foo.bar(bar)(baz)'), |
65 testExpression('constructor = new Function(str)()'), | 65 testExpression('constructor = new Function(str)()'), |
66 // The prettyprinter understands chained calls without extra parentheses
. | 66 // The prettyprinter understands chained calls without extra parentheses
. |
67 testExpression('(foo(bar))(baz)', 'foo(bar)(baz)'), | 67 testExpression('(foo(bar))(baz)', 'foo(bar)(baz)'), |
68 // Chains of dotting and calls. | 68 // Chains of dotting and calls. |
69 testExpression('foo.bar(baz)'), | 69 testExpression('foo.bar(baz)'), |
70 // String literal. | 70 // String literal. |
71 testExpression('var x = "fisk"'), | 71 testExpression('var x = "fisk"'), |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 testExpression("y = a == null ? b + c : a + c"), | 192 testExpression("y = a == null ? b + c : a + c"), |
193 testExpression("foo = a ? b : c ? d : e"), | 193 testExpression("foo = a ? b : c ? d : e"), |
194 testExpression("foo = a ? b ? c : d : e"), | 194 testExpression("foo = a ? b ? c : d : e"), |
195 testExpression("foo = (a = v) ? b = w : c = x ? d = y : e = z"), | 195 testExpression("foo = (a = v) ? b = w : c = x ? d = y : e = z"), |
196 testExpression("foo = (a = v) ? b = w ? c = x : d = y : e = z"), | 196 testExpression("foo = (a = v) ? b = w ? c = x : d = y : e = z"), |
197 // Stacked assignment. | 197 // Stacked assignment. |
198 testExpression("a = b = c"), | 198 testExpression("a = b = c"), |
199 testExpression("var a = b = c"), | 199 testExpression("var a = b = c"), |
200 ])); | 200 ])); |
201 } | 201 } |
OLD | NEW |