Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: pkg/analyzer/test/src/summary/summary_common.dart

Issue 1713643002: Remove _PrefixExpectation.inLibraryDefiningUnit. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 !checkAstDerivedData && 578 !checkAstDerivedData &&
579 !checkAstDerivedDataOverride) { 579 !checkAstDerivedDataOverride) {
580 // summarize_elements.dart isn't yet able to record the prefix of 580 // summarize_elements.dart isn't yet able to record the prefix of
581 // unresolved references. TODO(paulberry): fix this. 581 // unresolved references. TODO(paulberry): fix this.
582 expect(reference.prefixReference, 0); 582 expect(reference.prefixReference, 0);
583 } else if (expectedPrefix != null) { 583 } else if (expectedPrefix != null) {
584 checkPrefix(reference.prefixReference, expectedPrefix); 584 checkPrefix(reference.prefixReference, expectedPrefix);
585 } else if (prefixExpectations != null) { 585 } else if (prefixExpectations != null) {
586 for (_PrefixExpectation expectation in prefixExpectations) { 586 for (_PrefixExpectation expectation in prefixExpectations) {
587 expect(reference.prefixReference, isNot(0)); 587 expect(reference.prefixReference, isNot(0));
588 reference = checkReferenceIndex( 588 reference = checkReferenceIndex(reference.prefixReference,
589 reference.prefixReference, 589 expectation.absoluteUri, expectation.relativeUri, expectation.name,
590 expectation.inLibraryDefiningUnit
591 ? null
592 : expectation.absoluteUri ?? absoluteUri,
593 expectation.inLibraryDefiningUnit
594 ? null
595 : expectation.relativeUri ?? relativeUri,
596 expectation.name,
597 expectedKind: expectation.kind, 590 expectedKind: expectation.kind,
598 checkAstDerivedDataOverride: checkAstDerivedDataOverride, 591 checkAstDerivedDataOverride: checkAstDerivedDataOverride,
599 expectedTargetUnit: expectedTargetUnit, 592 expectedTargetUnit: expectedTargetUnit,
600 linkedSourceUnit: linkedSourceUnit, 593 linkedSourceUnit: linkedSourceUnit,
601 unlinkedSourceUnit: unlinkedSourceUnit, 594 unlinkedSourceUnit: unlinkedSourceUnit,
602 numTypeParameters: expectation.numTypeParameters); 595 numTypeParameters: expectation.numTypeParameters);
603 } 596 }
604 expect(reference.prefixReference, 0); 597 expect(reference.prefixReference, 0);
605 } else { 598 } else {
606 expect(reference.prefixReference, 0); 599 expect(reference.prefixReference, 0);
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 0 1758 0
1766 ], referenceValidators: [ 1759 ], referenceValidators: [
1767 (EntityRef r) { 1760 (EntityRef r) {
1768 checkTypeRef(r, null, null, 'named', 1761 checkTypeRef(r, null, null, 'named',
1769 expectedKind: ReferenceKind.constructor, 1762 expectedKind: ReferenceKind.constructor,
1770 prefixExpectations: [ 1763 prefixExpectations: [
1771 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 1764 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
1772 absoluteUri: absUri('/a.dart'), 1765 absoluteUri: absUri('/a.dart'),
1773 relativeUri: 'a.dart', 1766 relativeUri: 'a.dart',
1774 numTypeParameters: 2), 1767 numTypeParameters: 2),
1775 new _PrefixExpectation(ReferenceKind.prefix, 'p', 1768 new _PrefixExpectation(ReferenceKind.prefix, 'p')
1776 inLibraryDefiningUnit: true)
1777 ], 1769 ],
1778 allowTypeParameters: true); 1770 allowTypeParameters: true);
1779 checkTypeRef(r.typeArguments[0], 'dart:core', 'dart:core', 'int'); 1771 checkTypeRef(r.typeArguments[0], 'dart:core', 'dart:core', 'int');
1780 checkTypeRef(r.typeArguments[1], 'dart:core', 'dart:core', 'String'); 1772 checkTypeRef(r.typeArguments[1], 'dart:core', 'dart:core', 'String');
1781 } 1773 }
1782 ]); 1774 ]);
1783 } 1775 }
1784 1776
1785 test_constExpr_invokeConstructor_generic_unnamed() { 1777 test_constExpr_invokeConstructor_generic_unnamed() {
1786 UnlinkedVariable variable = serializeVariableText(''' 1778 UnlinkedVariable variable = serializeVariableText('''
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 ], ints: [ 1844 ], ints: [
1853 0, 1845 0,
1854 0 1846 0
1855 ], referenceValidators: [ 1847 ], referenceValidators: [
1856 (EntityRef r) { 1848 (EntityRef r) {
1857 checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C', 1849 checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C',
1858 expectedKind: ReferenceKind.classOrEnum, 1850 expectedKind: ReferenceKind.classOrEnum,
1859 numTypeParameters: 2, 1851 numTypeParameters: 2,
1860 allowTypeParameters: true, 1852 allowTypeParameters: true,
1861 prefixExpectations: [ 1853 prefixExpectations: [
1862 new _PrefixExpectation(ReferenceKind.prefix, 'p', 1854 new _PrefixExpectation(ReferenceKind.prefix, 'p')
1863 inLibraryDefiningUnit: true)
1864 ]); 1855 ]);
1865 checkTypeRef(r.typeArguments[0], 'dart:core', 'dart:core', 'int'); 1856 checkTypeRef(r.typeArguments[0], 'dart:core', 'dart:core', 'int');
1866 checkTypeRef(r.typeArguments[1], 'dart:core', 'dart:core', 'String'); 1857 checkTypeRef(r.typeArguments[1], 'dart:core', 'dart:core', 'String');
1867 } 1858 }
1868 ]); 1859 ]);
1869 } 1860 }
1870 1861
1871 test_constExpr_invokeConstructor_named() { 1862 test_constExpr_invokeConstructor_named() {
1872 UnlinkedVariable variable = serializeVariableText(''' 1863 UnlinkedVariable variable = serializeVariableText('''
1873 class C { 1864 class C {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 UnlinkedConstOperation.invokeConstructor, 1923 UnlinkedConstOperation.invokeConstructor,
1933 ], ints: [ 1924 ], ints: [
1934 0, 1925 0,
1935 0 1926 0
1936 ], referenceValidators: [ 1927 ], referenceValidators: [
1937 (EntityRef r) => checkTypeRef(r, null, null, 'named', 1928 (EntityRef r) => checkTypeRef(r, null, null, 'named',
1938 expectedKind: ReferenceKind.constructor, 1929 expectedKind: ReferenceKind.constructor,
1939 prefixExpectations: [ 1930 prefixExpectations: [
1940 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 1931 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
1941 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 1932 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
1942 new _PrefixExpectation(ReferenceKind.prefix, 'p', 1933 new _PrefixExpectation(ReferenceKind.prefix, 'p')
1943 inLibraryDefiningUnit: true)
1944 ]) 1934 ])
1945 ]); 1935 ]);
1946 } 1936 }
1947 1937
1948 test_constExpr_invokeConstructor_unnamed() { 1938 test_constExpr_invokeConstructor_unnamed() {
1949 UnlinkedVariable variable = serializeVariableText(''' 1939 UnlinkedVariable variable = serializeVariableText('''
1950 class C { 1940 class C {
1951 const C(a, b, c, d, {e, f, g}); 1941 const C(a, b, c, d, {e, f, g});
1952 } 1942 }
1953 const v = const C(11, 22, 3.3, '444', e: 55, g: '777', f: 66); 1943 const v = const C(11, 22, 3.3, '444', e: 55, g: '777', f: 66);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2023 '''); 2013 ''');
2024 _assertUnlinkedConst(variable.constExpr, operators: [ 2014 _assertUnlinkedConst(variable.constExpr, operators: [
2025 UnlinkedConstOperation.invokeConstructor, 2015 UnlinkedConstOperation.invokeConstructor,
2026 ], ints: [ 2016 ], ints: [
2027 0, 2017 0,
2028 0 2018 0
2029 ], referenceValidators: [ 2019 ], referenceValidators: [
2030 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C', 2020 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C',
2031 expectedKind: ReferenceKind.classOrEnum, 2021 expectedKind: ReferenceKind.classOrEnum,
2032 prefixExpectations: [ 2022 prefixExpectations: [
2033 new _PrefixExpectation(ReferenceKind.prefix, 'p', 2023 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2034 inLibraryDefiningUnit: true)
2035 ]) 2024 ])
2036 ]); 2025 ]);
2037 } 2026 }
2038 2027
2039 test_constExpr_invokeConstructor_unresolved_named() { 2028 test_constExpr_invokeConstructor_unresolved_named() {
2040 UnlinkedVariable variable = serializeVariableText( 2029 UnlinkedVariable variable = serializeVariableText(
2041 ''' 2030 '''
2042 class C {} 2031 class C {}
2043 const v = const C.foo(); 2032 const v = const C.foo();
2044 ''', 2033 ''',
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 ], ints: [ 2086 ], ints: [
2098 0, 2087 0,
2099 0 2088 0
2100 ], referenceValidators: [ 2089 ], referenceValidators: [
2101 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 2090 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
2102 expectedKind: ReferenceKind.unresolved, 2091 expectedKind: ReferenceKind.unresolved,
2103 checkAstDerivedDataOverride: true, 2092 checkAstDerivedDataOverride: true,
2104 prefixExpectations: [ 2093 prefixExpectations: [
2105 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2094 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2106 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 2095 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
2107 new _PrefixExpectation(ReferenceKind.prefix, 'p', 2096 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2108 inLibraryDefiningUnit: true)
2109 ]) 2097 ])
2110 ]); 2098 ]);
2111 } 2099 }
2112 2100
2113 test_constExpr_invokeConstructor_unresolved_named_prefixed2() { 2101 test_constExpr_invokeConstructor_unresolved_named_prefixed2() {
2114 addNamedSource('/a.dart', ''); 2102 addNamedSource('/a.dart', '');
2115 UnlinkedVariable variable = serializeVariableText( 2103 UnlinkedVariable variable = serializeVariableText(
2116 ''' 2104 '''
2117 import 'a.dart' as p; 2105 import 'a.dart' as p;
2118 const v = const p.C.foo(); 2106 const v = const p.C.foo();
2119 ''', 2107 ''',
2120 allowErrors: true); 2108 allowErrors: true);
2121 _assertUnlinkedConst(variable.constExpr, operators: [ 2109 _assertUnlinkedConst(variable.constExpr, operators: [
2122 UnlinkedConstOperation.invokeConstructor, 2110 UnlinkedConstOperation.invokeConstructor,
2123 ], ints: [ 2111 ], ints: [
2124 0, 2112 0,
2125 0 2113 0
2126 ], referenceValidators: [ 2114 ], referenceValidators: [
2127 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 2115 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
2128 expectedKind: ReferenceKind.unresolved, 2116 expectedKind: ReferenceKind.unresolved,
2129 checkAstDerivedDataOverride: true, 2117 checkAstDerivedDataOverride: true,
2130 prefixExpectations: [ 2118 prefixExpectations: [
2131 new _PrefixExpectation(ReferenceKind.unresolved, 'C'), 2119 new _PrefixExpectation(ReferenceKind.unresolved, 'C'),
2132 new _PrefixExpectation(ReferenceKind.prefix, 'p', 2120 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2133 inLibraryDefiningUnit: true)
2134 ]) 2121 ])
2135 ]); 2122 ]);
2136 } 2123 }
2137 2124
2138 test_constExpr_invokeConstructor_unresolved_unnamed() { 2125 test_constExpr_invokeConstructor_unresolved_unnamed() {
2139 UnlinkedVariable variable = serializeVariableText( 2126 UnlinkedVariable variable = serializeVariableText(
2140 ''' 2127 '''
2141 const v = const Foo(); 2128 const v = const Foo();
2142 ''', 2129 ''',
2143 allowErrors: true); 2130 allowErrors: true);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 const int v = p.C.length; 2171 const int v = p.C.length;
2185 '''); 2172 ''');
2186 _assertUnlinkedConst(variable.constExpr, operators: [ 2173 _assertUnlinkedConst(variable.constExpr, operators: [
2187 UnlinkedConstOperation.pushReference 2174 UnlinkedConstOperation.pushReference
2188 ], referenceValidators: [ 2175 ], referenceValidators: [
2189 (EntityRef r) => checkTypeRef(r, null, null, 'length', 2176 (EntityRef r) => checkTypeRef(r, null, null, 'length',
2190 expectedKind: ReferenceKind.propertyAccessor, 2177 expectedKind: ReferenceKind.propertyAccessor,
2191 prefixExpectations: [ 2178 prefixExpectations: [
2192 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2179 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2193 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 2180 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
2194 new _PrefixExpectation(ReferenceKind.prefix, 'p', 2181 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2195 inLibraryDefiningUnit: true)
2196 ]) 2182 ])
2197 ]); 2183 ]);
2198 } 2184 }
2199 2185
2200 test_constExpr_length_identifierTarget() { 2186 test_constExpr_length_identifierTarget() {
2201 UnlinkedVariable variable = serializeVariableText(''' 2187 UnlinkedVariable variable = serializeVariableText('''
2202 const String a = 'aaa'; 2188 const String a = 'aaa';
2203 const int v = a.length; 2189 const int v = a.length;
2204 '''); 2190 ''');
2205 _assertUnlinkedConst(variable.constExpr, operators: [ 2191 _assertUnlinkedConst(variable.constExpr, operators: [
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2268 '''); 2254 ''');
2269 _assertUnlinkedConst(variable.constExpr, operators: [ 2255 _assertUnlinkedConst(variable.constExpr, operators: [
2270 UnlinkedConstOperation.pushReference 2256 UnlinkedConstOperation.pushReference
2271 ], referenceValidators: [ 2257 ], referenceValidators: [
2272 (EntityRef r) => checkTypeRef(r, null, null, 'length', 2258 (EntityRef r) => checkTypeRef(r, null, null, 'length',
2273 expectedKind: ReferenceKind.length, 2259 expectedKind: ReferenceKind.length,
2274 prefixExpectations: [ 2260 prefixExpectations: [
2275 new _PrefixExpectation( 2261 new _PrefixExpectation(
2276 ReferenceKind.topLevelPropertyAccessor, 'a', 2262 ReferenceKind.topLevelPropertyAccessor, 'a',
2277 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 2263 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
2278 new _PrefixExpectation(ReferenceKind.prefix, 'p', 2264 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2279 inLibraryDefiningUnit: true)
2280 ]) 2265 ])
2281 ]); 2266 ]);
2282 } 2267 }
2283 2268
2284 test_constExpr_length_parenthesizedBinaryTarget() { 2269 test_constExpr_length_parenthesizedBinaryTarget() {
2285 UnlinkedVariable variable = 2270 UnlinkedVariable variable =
2286 serializeVariableText('const v = ("abc" + "edf").length;'); 2271 serializeVariableText('const v = ("abc" + "edf").length;');
2287 _assertUnlinkedConst(variable.constExpr, operators: [ 2272 _assertUnlinkedConst(variable.constExpr, operators: [
2288 UnlinkedConstOperation.pushString, 2273 UnlinkedConstOperation.pushString,
2289 UnlinkedConstOperation.pushString, 2274 UnlinkedConstOperation.pushString,
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 const v = p.C.F; 2623 const v = p.C.F;
2639 '''); 2624 ''');
2640 _assertUnlinkedConst(variable.constExpr, operators: [ 2625 _assertUnlinkedConst(variable.constExpr, operators: [
2641 UnlinkedConstOperation.pushReference 2626 UnlinkedConstOperation.pushReference
2642 ], referenceValidators: [ 2627 ], referenceValidators: [
2643 (EntityRef r) => checkTypeRef(r, null, null, 'F', 2628 (EntityRef r) => checkTypeRef(r, null, null, 'F',
2644 expectedKind: ReferenceKind.propertyAccessor, 2629 expectedKind: ReferenceKind.propertyAccessor,
2645 prefixExpectations: [ 2630 prefixExpectations: [
2646 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2631 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2647 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 2632 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
2648 new _PrefixExpectation(ReferenceKind.prefix, 'p', 2633 new _PrefixExpectation(ReferenceKind.prefix, 'p'),
2649 inLibraryDefiningUnit: true),
2650 ]) 2634 ])
2651 ]); 2635 ]);
2652 } 2636 }
2653 2637
2654 test_constExpr_pushReference_field_simpleIdentifier() { 2638 test_constExpr_pushReference_field_simpleIdentifier() {
2655 UnlinkedVariable variable = serializeClassText(''' 2639 UnlinkedVariable variable = serializeClassText('''
2656 class C { 2640 class C {
2657 static const a = b; 2641 static const a = b;
2658 static const b = null; 2642 static const b = null;
2659 } 2643 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 const v = p.C.m; 2708 const v = p.C.m;
2725 '''); 2709 ''');
2726 _assertUnlinkedConst(variable.constExpr, operators: [ 2710 _assertUnlinkedConst(variable.constExpr, operators: [
2727 UnlinkedConstOperation.pushReference 2711 UnlinkedConstOperation.pushReference
2728 ], referenceValidators: [ 2712 ], referenceValidators: [
2729 (EntityRef r) => checkTypeRef(r, null, null, 'm', 2713 (EntityRef r) => checkTypeRef(r, null, null, 'm',
2730 expectedKind: ReferenceKind.method, 2714 expectedKind: ReferenceKind.method,
2731 prefixExpectations: [ 2715 prefixExpectations: [
2732 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2716 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2733 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 2717 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
2734 new _PrefixExpectation(ReferenceKind.prefix, 'p', 2718 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2735 inLibraryDefiningUnit: true)
2736 ]) 2719 ])
2737 ]); 2720 ]);
2738 } 2721 }
2739 2722
2740 test_constExpr_pushReference_staticMethod_simpleIdentifier() { 2723 test_constExpr_pushReference_staticMethod_simpleIdentifier() {
2741 UnlinkedVariable variable = serializeClassText(''' 2724 UnlinkedVariable variable = serializeClassText('''
2742 class C { 2725 class C {
2743 static const a = m; 2726 static const a = m;
2744 static m() {} 2727 static m() {}
2745 } 2728 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2795 UnlinkedVariable variable = serializeVariableText(''' 2778 UnlinkedVariable variable = serializeVariableText('''
2796 import 'a.dart' as p; 2779 import 'a.dart' as p;
2797 const v = p.f; 2780 const v = p.f;
2798 '''); 2781 ''');
2799 _assertUnlinkedConst(variable.constExpr, operators: [ 2782 _assertUnlinkedConst(variable.constExpr, operators: [
2800 UnlinkedConstOperation.pushReference 2783 UnlinkedConstOperation.pushReference
2801 ], referenceValidators: [ 2784 ], referenceValidators: [
2802 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'f', 2785 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'f',
2803 expectedKind: ReferenceKind.topLevelFunction, 2786 expectedKind: ReferenceKind.topLevelFunction,
2804 prefixExpectations: [ 2787 prefixExpectations: [
2805 new _PrefixExpectation(ReferenceKind.prefix, 'p', 2788 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2806 inLibraryDefiningUnit: true)
2807 ]) 2789 ])
2808 ]); 2790 ]);
2809 } 2791 }
2810 2792
2811 test_constExpr_pushReference_topLevelVariable() { 2793 test_constExpr_pushReference_topLevelVariable() {
2812 UnlinkedVariable variable = serializeVariableText(''' 2794 UnlinkedVariable variable = serializeVariableText('''
2813 const int a = 1; 2795 const int a = 1;
2814 const v = a; 2796 const v = a;
2815 '''); 2797 ''');
2816 _assertUnlinkedConst(variable.constExpr, operators: [ 2798 _assertUnlinkedConst(variable.constExpr, operators: [
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2911 allowErrors: true); 2893 allowErrors: true);
2912 _assertUnlinkedConst(variable.constExpr, operators: [ 2894 _assertUnlinkedConst(variable.constExpr, operators: [
2913 UnlinkedConstOperation.pushReference 2895 UnlinkedConstOperation.pushReference
2914 ], referenceValidators: [ 2896 ], referenceValidators: [
2915 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 2897 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
2916 expectedKind: ReferenceKind.unresolved, 2898 expectedKind: ReferenceKind.unresolved,
2917 checkAstDerivedDataOverride: true, 2899 checkAstDerivedDataOverride: true,
2918 prefixExpectations: [ 2900 prefixExpectations: [
2919 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2901 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2920 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 2902 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
2921 new _PrefixExpectation(ReferenceKind.prefix, 'p', 2903 new _PrefixExpectation(ReferenceKind.prefix, 'p'),
2922 inLibraryDefiningUnit: true),
2923 ]) 2904 ])
2924 ]); 2905 ]);
2925 } 2906 }
2926 2907
2927 test_constExpr_pushString_adjacent() { 2908 test_constExpr_pushString_adjacent() {
2928 UnlinkedVariable variable = 2909 UnlinkedVariable variable =
2929 serializeVariableText('const v = "aaa" "b" "ccc";'); 2910 serializeVariableText('const v = "aaa" "b" "ccc";');
2930 _assertUnlinkedConst(variable.constExpr, 2911 _assertUnlinkedConst(variable.constExpr,
2931 operators: [UnlinkedConstOperation.pushString], strings: ['aaabccc']); 2912 operators: [UnlinkedConstOperation.pushString], strings: ['aaabccc']);
2932 } 2913 }
(...skipping 4150 matching lines...) Expand 10 before | Expand all | Expand 10 after
7083 expect(v.visibleLength, expectedVisibleLength); 7064 expect(v.visibleLength, expectedVisibleLength);
7084 } 7065 }
7085 } 7066 }
7086 7067
7087 /** 7068 /**
7088 * Description of expectations for a prelinked prefix reference. 7069 * Description of expectations for a prelinked prefix reference.
7089 */ 7070 */
7090 class _PrefixExpectation { 7071 class _PrefixExpectation {
7091 final ReferenceKind kind; 7072 final ReferenceKind kind;
7092 final String name; 7073 final String name;
7093 final bool inLibraryDefiningUnit;
7094 final String absoluteUri; 7074 final String absoluteUri;
7095 final String relativeUri; 7075 final String relativeUri;
7096 final int numTypeParameters; 7076 final int numTypeParameters;
7097 7077
7098 _PrefixExpectation(this.kind, this.name, 7078 _PrefixExpectation(this.kind, this.name,
7099 {this.inLibraryDefiningUnit: false, 7079 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0});
7100 this.absoluteUri,
7101 this.relativeUri,
7102 this.numTypeParameters: 0});
7103 } 7080 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698