| 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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 } | 880 } |
| 881 for (String op in ['&&', '||']) { | 881 for (String op in ['&&', '||']) { |
| 882 AnalysisResult result = analyze(source(op)); | 882 AnalysisResult result = analyze(source(op)); |
| 883 result.checkNodeHasType('a', [result.bool]); | 883 result.checkNodeHasType('a', [result.bool]); |
| 884 result.checkNodeHasType('b', [result.bool]); | 884 result.checkNodeHasType('b', [result.bool]); |
| 885 result.checkNodeHasType('c', [result.bool]); | 885 result.checkNodeHasType('c', [result.bool]); |
| 886 result.checkNodeHasType('d', [result.bool]); | 886 result.checkNodeHasType('d', [result.bool]); |
| 887 } | 887 } |
| 888 } | 888 } |
| 889 | 889 |
| 890 testBooleanOperatorsShortCirtcuit() { |
| 891 String source(op) { |
| 892 return """ |
| 893 main() { |
| 894 var x = null; |
| 895 "foo" $op (x = 42); |
| 896 x; |
| 897 }"""; |
| 898 } |
| 899 for (String op in ['&&', '||']) { |
| 900 AnalysisResult result = analyze(source(op)); |
| 901 result.checkNodeHasType('x', [result.nullType, result.int]); |
| 902 } |
| 903 } |
| 904 |
| 890 testOperators() { | 905 testOperators() { |
| 891 final String source = r""" | 906 final String source = r""" |
| 892 class A { | 907 class A { |
| 893 operator <(x) => 42; | 908 operator <(x) => 42; |
| 894 operator <<(x) => "a"; | 909 operator <<(x) => "a"; |
| 895 } | 910 } |
| 896 main() { | 911 main() { |
| 897 var x = new A() < "foo"; | 912 var x = new A() < "foo"; |
| 898 var y = new A() << "foo"; | 913 var y = new A() << "foo"; |
| 899 x; y; | 914 x; y; |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 testGetters(); | 1561 testGetters(); |
| 1547 testSetters(); | 1562 testSetters(); |
| 1548 testOptionalNamedParameters(); | 1563 testOptionalNamedParameters(); |
| 1549 testOptionalPositionalParameters(); | 1564 testOptionalPositionalParameters(); |
| 1550 testListLiterals(); | 1565 testListLiterals(); |
| 1551 testMapLiterals(); | 1566 testMapLiterals(); |
| 1552 testReturn(); | 1567 testReturn(); |
| 1553 // testNoReturn(); // right now we infer the empty type instead of null | 1568 // testNoReturn(); // right now we infer the empty type instead of null |
| 1554 testArithmeticOperators(); | 1569 testArithmeticOperators(); |
| 1555 testBooleanOperators(); | 1570 testBooleanOperators(); |
| 1571 testBooleanOperatorsShortCirtcuit(); |
| 1556 testOperators(); | 1572 testOperators(); |
| 1557 testCompoundOperators1(); | 1573 testCompoundOperators1(); |
| 1558 testCompoundOperators2(); | 1574 testCompoundOperators2(); |
| 1559 testSetIndexOperator(); | 1575 testSetIndexOperator(); |
| 1560 testInequality(); | 1576 testInequality(); |
| 1561 testFieldInitialization1(); | 1577 testFieldInitialization1(); |
| 1562 testFieldInitialization2(); | 1578 testFieldInitialization2(); |
| 1563 testFieldInitialization3(); | 1579 testFieldInitialization3(); |
| 1564 testSendWithWrongArity(); | 1580 testSendWithWrongArity(); |
| 1565 testBigTypesWidening1(); | 1581 testBigTypesWidening1(); |
| 1566 testBigTypesWidening2(); | 1582 testBigTypesWidening2(); |
| 1567 testDynamicIsAbsorbing(); | 1583 testDynamicIsAbsorbing(); |
| 1568 testLists(); | 1584 testLists(); |
| 1569 testListWithCapacity(); | 1585 testListWithCapacity(); |
| 1570 testEmptyList(); | 1586 testEmptyList(); |
| 1571 testJsCall(); | 1587 testJsCall(); |
| 1572 testJsCallAugmentsSeenClasses(); | 1588 testJsCallAugmentsSeenClasses(); |
| 1573 testIsCheck(); | 1589 testIsCheck(); |
| 1574 testSeenClasses(); | 1590 testSeenClasses(); |
| 1575 testIntDoubleNum(); | 1591 testIntDoubleNum(); |
| 1576 testConcreteTypeToTypeMask(); | 1592 testConcreteTypeToTypeMask(); |
| 1577 testSelectors(); | 1593 testSelectors(); |
| 1578 testMixins(); | 1594 testMixins(); |
| 1579 testClosures(); | 1595 testClosures(); |
| 1580 testNestedFunctions(); | 1596 testNestedFunctions(); |
| 1581 } | 1597 } |
| OLD | NEW |