| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "package:expect/expect.dart"; |
| 6 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da
rt'; | 6 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da
rt'; |
| 7 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; | 7 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; |
| 8 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'; | 8 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'; |
| 9 | 9 |
| 10 import "parser_helper.dart"; | 10 import "parser_helper.dart"; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } | 285 } |
| 286 """; | 286 """; |
| 287 AnalysisResult result = analyze(source); | 287 AnalysisResult result = analyze(source); |
| 288 result.checkNodeHasType( | 288 result.checkNodeHasType( |
| 289 'foo', | 289 'foo', |
| 290 [result.base('A'), result.base('B'), result.base('C')]); | 290 [result.base('A'), result.base('B'), result.base('C')]); |
| 291 // Check that the condition is evaluated. | 291 // Check that the condition is evaluated. |
| 292 result.checkNodeHasType('bar', [result.int]); | 292 result.checkNodeHasType('bar', [result.int]); |
| 293 } | 293 } |
| 294 | 294 |
| 295 testDoWhile() { |
| 296 final String source = r""" |
| 297 class A { f() => new B(); } |
| 298 class B { f() => new C(); } |
| 299 class C { f() => new A(); } |
| 300 main() { |
| 301 var bar = null; |
| 302 var foo = new A(); |
| 303 do { |
| 304 foo = foo.f(); |
| 305 } while (bar = 42); |
| 306 foo; bar; |
| 307 } |
| 308 """; |
| 309 AnalysisResult result = analyze(source); |
| 310 result.checkNodeHasType( |
| 311 'foo', |
| 312 [result.base('A'), result.base('B'), result.base('C')]); |
| 313 // Check that the condition is evaluated. |
| 314 result.checkNodeHasType('bar', [result.int]); |
| 315 } |
| 316 |
| 295 testFor1() { | 317 testFor1() { |
| 296 final String source = r""" | 318 final String source = r""" |
| 297 class A { f() => new B(); } | 319 class A { f() => new B(); } |
| 298 class B { f() => new C(); } | 320 class B { f() => new C(); } |
| 299 class C { f() => new A(); } | 321 class C { f() => new A(); } |
| 300 main() { | 322 main() { |
| 301 var foo = new A(); | 323 var foo = new A(); |
| 302 for(;;) { | 324 for(;;) { |
| 303 foo = foo.f(); | 325 foo = foo.f(); |
| 304 } | 326 } |
| (...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 } | 1559 } |
| 1538 | 1560 |
| 1539 void main() { | 1561 void main() { |
| 1540 testDynamicBackDoor(); | 1562 testDynamicBackDoor(); |
| 1541 testVariableDeclaration(); | 1563 testVariableDeclaration(); |
| 1542 testLiterals(); | 1564 testLiterals(); |
| 1543 testRedefinition(); | 1565 testRedefinition(); |
| 1544 testIfThenElse(); | 1566 testIfThenElse(); |
| 1545 testTernaryIf(); | 1567 testTernaryIf(); |
| 1546 testWhile(); | 1568 testWhile(); |
| 1569 testDoWhile(); |
| 1547 testFor1(); | 1570 testFor1(); |
| 1548 testFor2(); | 1571 testFor2(); |
| 1549 testFor3(); | 1572 testFor3(); |
| 1550 testForIn(); | 1573 testForIn(); |
| 1551 testToplevelVariable(); | 1574 testToplevelVariable(); |
| 1552 testNonRecusiveFunction(); | 1575 testNonRecusiveFunction(); |
| 1553 testRecusiveFunction(); | 1576 testRecusiveFunction(); |
| 1554 testMutuallyRecusiveFunction(); | 1577 testMutuallyRecusiveFunction(); |
| 1555 testSimpleSend(); | 1578 testSimpleSend(); |
| 1556 // testSendToClosureField(); // closures are not yet supported | 1579 // testSendToClosureField(); // closures are not yet supported |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 testJsCallAugmentsSeenClasses(); | 1611 testJsCallAugmentsSeenClasses(); |
| 1589 testIsCheck(); | 1612 testIsCheck(); |
| 1590 testSeenClasses(); | 1613 testSeenClasses(); |
| 1591 testIntDoubleNum(); | 1614 testIntDoubleNum(); |
| 1592 testConcreteTypeToTypeMask(); | 1615 testConcreteTypeToTypeMask(); |
| 1593 testSelectors(); | 1616 testSelectors(); |
| 1594 testMixins(); | 1617 testMixins(); |
| 1595 testClosures(); | 1618 testClosures(); |
| 1596 testNestedFunctions(); | 1619 testNestedFunctions(); |
| 1597 } | 1620 } |
| OLD | NEW |