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 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 {'a': 'name1_2', | 318 {'a': 'name1_2', |
319 'b': ['r', 'y'], | 319 'b': ['r', 'y'], |
320 'c': 'name4_5'}, | 320 'c': 'name4_5'}, |
321 'name1_2.prototype.name1_2 = function(r, y) {\n' | 321 'name1_2.prototype.name1_2 = function(r, y) {\n' |
322 ' return name4_5.name4_5;\n' | 322 ' return name4_5.name4_5;\n' |
323 '};'), | 323 '};'), |
324 | 324 |
325 testStatement('label: while (a) { label2: break label;}', [], | 325 testStatement('label: while (a) { label2: break label;}', [], |
326 'label:\n while (a) {\n label2:\n break label;\n }'), | 326 'label:\n while (a) {\n label2:\n break label;\n }'), |
327 | 327 |
| 328 |
| 329 testStatement('var # = 3', ['x'], 'var x = 3;'), |
| 330 testStatement('var # = 3', |
| 331 [new jsAst.VariableDeclaration('x')], |
| 332 'var x = 3;'), |
| 333 testStatement('var # = 3, # = #', |
| 334 ['x', 'y', js.number(2)], |
| 335 'var x = 3, y = 2;'), |
| 336 testStatement('var #a = 3, #b = #c', |
| 337 {"a": 'x', "b": 'y', "c": js.number(2)}, |
| 338 'var x = 3, y = 2;'), |
| 339 testStatement('function #() {}', ['x'], 'function x() {\n}'), |
| 340 testStatement('function #() {}', |
| 341 [new jsAst.VariableDeclaration('x')], |
| 342 'function x() {\n}'), |
| 343 testStatement('try {} catch (#) {}', ['x'], 'try {\n} catch (x) {\n}'), |
| 344 testStatement('try {} catch (#a) {}', {"a": 'x'}, 'try {\n} catch (x) {\n}')
, |
| 345 testStatement('try {} catch (#a) {}', |
| 346 {"a": new jsAst.VariableDeclaration('x')}, |
| 347 'try {\n} catch (x) {\n}'), |
328 ])); | 348 ])); |
329 } | 349 } |
OLD | NEW |