| 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 } | 458 } |
| 459 main() { | 459 main() { |
| 460 var x = new B().bar(); | 460 var x = new B().bar(); |
| 461 x; | 461 x; |
| 462 } | 462 } |
| 463 """; | 463 """; |
| 464 AnalysisResult result = analyze(source); | 464 AnalysisResult result = analyze(source); |
| 465 result.checkNodeHasType('x', [result.base('B')]); | 465 result.checkNodeHasType('x', [result.base('B')]); |
| 466 } | 466 } |
| 467 | 467 |
| 468 testSendToThis3() { |
| 469 final String source = r""" |
| 470 class A { |
| 471 bar() => 42; |
| 472 foo() => bar(); |
| 473 } |
| 474 class B extends A { |
| 475 bar() => "abc"; |
| 476 } |
| 477 main() { |
| 478 var x = new B().foo(); |
| 479 x; |
| 480 } |
| 481 """; |
| 482 AnalysisResult result = analyze(source); |
| 483 result.checkNodeHasType('x', [result.string]); |
| 484 } |
| 485 |
| 468 testConstructor() { | 486 testConstructor() { |
| 469 final String source = r""" | 487 final String source = r""" |
| 470 class A { | 488 class A { |
| 471 var x, y, z; | 489 var x, y, z; |
| 472 A(this.x, a) : y = a { z = 'abc'; } | 490 A(this.x, a) : y = a { z = 'abc'; } |
| 473 } | 491 } |
| 474 main() { | 492 main() { |
| 475 new A(42, 'abc'); | 493 new A(42, 'abc'); |
| 476 new A(true, null); | 494 new A(true, null); |
| 477 } | 495 } |
| (...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 testFor2(); | 1473 testFor2(); |
| 1456 testFor3(); | 1474 testFor3(); |
| 1457 testToplevelVariable(); | 1475 testToplevelVariable(); |
| 1458 testNonRecusiveFunction(); | 1476 testNonRecusiveFunction(); |
| 1459 testRecusiveFunction(); | 1477 testRecusiveFunction(); |
| 1460 testMutuallyRecusiveFunction(); | 1478 testMutuallyRecusiveFunction(); |
| 1461 testSimpleSend(); | 1479 testSimpleSend(); |
| 1462 // testSendToClosureField(); // closures are not yet supported | 1480 // testSendToClosureField(); // closures are not yet supported |
| 1463 testSendToThis1(); | 1481 testSendToThis1(); |
| 1464 testSendToThis2(); | 1482 testSendToThis2(); |
| 1483 testSendToThis3(); |
| 1465 testConstructor(); | 1484 testConstructor(); |
| 1466 testGetters(); | 1485 testGetters(); |
| 1467 testSetters(); | 1486 testSetters(); |
| 1468 testOptionalNamedParameters(); | 1487 testOptionalNamedParameters(); |
| 1469 testOptionalPositionalParameters(); | 1488 testOptionalPositionalParameters(); |
| 1470 testListLiterals(); | 1489 testListLiterals(); |
| 1471 testMapLiterals(); | 1490 testMapLiterals(); |
| 1472 testReturn(); | 1491 testReturn(); |
| 1473 // testNoReturn(); // right now we infer the empty type instead of null | 1492 // testNoReturn(); // right now we infer the empty type instead of null |
| 1474 testArithmeticOperators(); | 1493 testArithmeticOperators(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1491 testListHierarchy(); | 1510 testListHierarchy(); |
| 1492 testJsCall(); | 1511 testJsCall(); |
| 1493 testJsCallAugmentsSeenClasses(); | 1512 testJsCallAugmentsSeenClasses(); |
| 1494 testIsCheck(); | 1513 testIsCheck(); |
| 1495 testSeenClasses(); | 1514 testSeenClasses(); |
| 1496 testIntDoubleNum(); | 1515 testIntDoubleNum(); |
| 1497 testConcreteTypeToTypeMask(); | 1516 testConcreteTypeToTypeMask(); |
| 1498 testSelectors(); | 1517 testSelectors(); |
| 1499 testMixins(); | 1518 testMixins(); |
| 1500 } | 1519 } |
| OLD | NEW |