OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.test.src.summary.summary_common; | 5 library analyzer.test.src.summary.summary_common; |
6 | 6 |
7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/src/dart/scanner/reader.dart'; | 10 import 'package:analyzer/src/dart/scanner/reader.dart'; |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 UnlinkedClass cls = serializeClassText('class C {}'); | 1302 UnlinkedClass cls = serializeClassText('class C {}'); |
1303 expect(cls.isAbstract, false); | 1303 expect(cls.isAbstract, false); |
1304 expect(cls.isMixinApplication, false); | 1304 expect(cls.isMixinApplication, false); |
1305 } | 1305 } |
1306 | 1306 |
1307 test_class_no_interface() { | 1307 test_class_no_interface() { |
1308 UnlinkedClass cls = serializeClassText('class C {}'); | 1308 UnlinkedClass cls = serializeClassText('class C {}'); |
1309 expect(cls.interfaces, isEmpty); | 1309 expect(cls.interfaces, isEmpty); |
1310 } | 1310 } |
1311 | 1311 |
| 1312 test_unresolved_import() { |
| 1313 allowMissingFiles = true; |
| 1314 serializeLibraryText("import 'foo.dart';", allowErrors: true); |
| 1315 expect(unlinkedUnits[0].imports, hasLength(2)); |
| 1316 expect(unlinkedUnits[0].imports[0].uri, 'foo.dart'); |
| 1317 // Note: imports[1] is the implicit import of dart:core. |
| 1318 expect(unlinkedUnits[0].imports[1].isImplicit, true); |
| 1319 expect(linked.importDependencies, hasLength(2)); |
| 1320 checkDependency( |
| 1321 linked.importDependencies[0], absUri('/foo.dart'), 'foo.dart'); |
| 1322 } |
| 1323 |
| 1324 test_unresolved_export() { |
| 1325 allowMissingFiles = true; |
| 1326 serializeLibraryText("export 'foo.dart';", allowErrors: true); |
| 1327 expect(unlinkedUnits[0].publicNamespace.exports, hasLength(1)); |
| 1328 expect(unlinkedUnits[0].publicNamespace.exports[0].uri, 'foo.dart'); |
| 1329 expect(linked.exportDependencies, hasLength(1)); |
| 1330 checkDependency( |
| 1331 linked.exportDependencies[0], absUri('/foo.dart'), 'foo.dart'); |
| 1332 } |
| 1333 |
| 1334 test_unresolved_part() { |
| 1335 allowMissingFiles = true; |
| 1336 serializeLibraryText("part 'foo.dart';", allowErrors: true); |
| 1337 expect(unlinkedUnits[0].publicNamespace.parts, hasLength(1)); |
| 1338 expect(unlinkedUnits[0].publicNamespace.parts[0], 'foo.dart'); |
| 1339 } |
| 1340 |
1312 test_class_no_mixins() { | 1341 test_class_no_mixins() { |
1313 UnlinkedClass cls = serializeClassText('class C {}'); | 1342 UnlinkedClass cls = serializeClassText('class C {}'); |
1314 expect(cls.mixins, isEmpty); | 1343 expect(cls.mixins, isEmpty); |
1315 } | 1344 } |
1316 | 1345 |
1317 test_class_no_type_param() { | 1346 test_class_no_type_param() { |
1318 UnlinkedClass cls = serializeClassText('class C {}'); | 1347 UnlinkedClass cls = serializeClassText('class C {}'); |
1319 expect(cls.typeParameters, isEmpty); | 1348 expect(cls.typeParameters, isEmpty); |
1320 } | 1349 } |
1321 | 1350 |
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2695 } | 2724 } |
2696 | 2725 |
2697 test_constExpr_pushInt() { | 2726 test_constExpr_pushInt() { |
2698 UnlinkedVariable variable = serializeVariableText('const v = 1;'); | 2727 UnlinkedVariable variable = serializeVariableText('const v = 1;'); |
2699 _assertUnlinkedConst(variable.initializer.bodyExpr, | 2728 _assertUnlinkedConst(variable.initializer.bodyExpr, |
2700 operators: [UnlinkedConstOperation.pushInt], ints: [1]); | 2729 operators: [UnlinkedConstOperation.pushInt], ints: [1]); |
2701 } | 2730 } |
2702 | 2731 |
2703 test_constExpr_pushInt_max() { | 2732 test_constExpr_pushInt_max() { |
2704 UnlinkedVariable variable = serializeVariableText('const v = 0xFFFFFFFF;'); | 2733 UnlinkedVariable variable = serializeVariableText('const v = 0xFFFFFFFF;'); |
2705 _assertUnlinkedConst(variable.initializer.bodyExpr, | 2734 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [ |
2706 operators: [UnlinkedConstOperation.pushInt,], ints: [0xFFFFFFFF]); | 2735 UnlinkedConstOperation.pushInt, |
| 2736 ], ints: [ |
| 2737 0xFFFFFFFF |
| 2738 ]); |
2707 } | 2739 } |
2708 | 2740 |
2709 test_constExpr_pushInt_negative() { | 2741 test_constExpr_pushInt_negative() { |
2710 UnlinkedVariable variable = serializeVariableText('const v = -5;'); | 2742 UnlinkedVariable variable = serializeVariableText('const v = -5;'); |
2711 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [ | 2743 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [ |
2712 UnlinkedConstOperation.pushInt, | 2744 UnlinkedConstOperation.pushInt, |
2713 UnlinkedConstOperation.negate | 2745 UnlinkedConstOperation.negate |
2714 ], ints: [ | 2746 ], ints: [ |
2715 5 | 2747 5 |
2716 ]); | 2748 ]); |
2717 } | 2749 } |
2718 | 2750 |
2719 test_constExpr_pushLongInt() { | 2751 test_constExpr_pushLongInt() { |
2720 UnlinkedVariable variable = | 2752 UnlinkedVariable variable = |
2721 serializeVariableText('const v = 0xA123456789ABCDEF012345678;'); | 2753 serializeVariableText('const v = 0xA123456789ABCDEF012345678;'); |
2722 _assertUnlinkedConst(variable.initializer.bodyExpr, | 2754 _assertUnlinkedConst(variable.initializer.bodyExpr, |
2723 operators: [UnlinkedConstOperation.pushLongInt], | 2755 operators: [UnlinkedConstOperation.pushLongInt], |
2724 ints: [4, 0xA, 0x12345678, 0x9ABCDEF0, 0x12345678]); | 2756 ints: [4, 0xA, 0x12345678, 0x9ABCDEF0, 0x12345678]); |
2725 } | 2757 } |
2726 | 2758 |
2727 test_constExpr_pushLongInt_min2() { | 2759 test_constExpr_pushLongInt_min2() { |
2728 UnlinkedVariable variable = serializeVariableText('const v = 0x100000000;'); | 2760 UnlinkedVariable variable = serializeVariableText('const v = 0x100000000;'); |
2729 _assertUnlinkedConst(variable.initializer.bodyExpr, | 2761 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [ |
2730 operators: [UnlinkedConstOperation.pushLongInt], ints: [2, 1, 0,]); | 2762 UnlinkedConstOperation.pushLongInt |
| 2763 ], ints: [ |
| 2764 2, |
| 2765 1, |
| 2766 0, |
| 2767 ]); |
2731 } | 2768 } |
2732 | 2769 |
2733 test_constExpr_pushLongInt_min3() { | 2770 test_constExpr_pushLongInt_min3() { |
2734 UnlinkedVariable variable = | 2771 UnlinkedVariable variable = |
2735 serializeVariableText('const v = 0x10000000000000000;'); | 2772 serializeVariableText('const v = 0x10000000000000000;'); |
2736 _assertUnlinkedConst(variable.initializer.bodyExpr, | 2773 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [ |
2737 operators: [UnlinkedConstOperation.pushLongInt], ints: [3, 1, 0, 0,]); | 2774 UnlinkedConstOperation.pushLongInt |
| 2775 ], ints: [ |
| 2776 3, |
| 2777 1, |
| 2778 0, |
| 2779 0, |
| 2780 ]); |
2738 } | 2781 } |
2739 | 2782 |
2740 test_constExpr_pushNull() { | 2783 test_constExpr_pushNull() { |
2741 UnlinkedVariable variable = serializeVariableText('const v = null;'); | 2784 UnlinkedVariable variable = serializeVariableText('const v = null;'); |
2742 _assertUnlinkedConst(variable.initializer.bodyExpr, | 2785 _assertUnlinkedConst(variable.initializer.bodyExpr, |
2743 operators: [UnlinkedConstOperation.pushNull]); | 2786 operators: [UnlinkedConstOperation.pushNull]); |
2744 } | 2787 } |
2745 | 2788 |
2746 test_constExpr_pushReference_class() { | 2789 test_constExpr_pushReference_class() { |
2747 UnlinkedVariable variable = serializeVariableText(''' | 2790 UnlinkedVariable variable = serializeVariableText(''' |
(...skipping 7789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10537 class _PrefixExpectation { | 10580 class _PrefixExpectation { |
10538 final ReferenceKind kind; | 10581 final ReferenceKind kind; |
10539 final String name; | 10582 final String name; |
10540 final String absoluteUri; | 10583 final String absoluteUri; |
10541 final String relativeUri; | 10584 final String relativeUri; |
10542 final int numTypeParameters; | 10585 final int numTypeParameters; |
10543 | 10586 |
10544 _PrefixExpectation(this.kind, this.name, | 10587 _PrefixExpectation(this.kind, this.name, |
10545 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); | 10588 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); |
10546 } | 10589 } |
OLD | NEW |