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

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

Issue 1646363002: Rename ReferenceKind.constField and referenceKind.staticMethod. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove unintentional deletion 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
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/generated/engine.dart'; 10 import 'package:analyzer/src/generated/engine.dart';
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 expect(className.kind, ReferenceKind.classOrEnum); 1091 expect(className.kind, ReferenceKind.classOrEnum);
1092 expect(className.name, 'C'); 1092 expect(className.name, 'C');
1093 expect(className.numTypeParameters, 0); 1093 expect(className.numTypeParameters, 0);
1094 // executables 1094 // executables
1095 Map<String, UnlinkedPublicName> executablesMap = 1095 Map<String, UnlinkedPublicName> executablesMap =
1096 <String, UnlinkedPublicName>{}; 1096 <String, UnlinkedPublicName>{};
1097 className.constMembers.forEach((e) => executablesMap[e.name] = e); 1097 className.constMembers.forEach((e) => executablesMap[e.name] = e);
1098 expect(executablesMap, hasLength(2)); 1098 expect(executablesMap, hasLength(2));
1099 { 1099 {
1100 UnlinkedPublicName executable = executablesMap['fieldStaticConst']; 1100 UnlinkedPublicName executable = executablesMap['fieldStaticConst'];
1101 expect(executable.kind, ReferenceKind.constField); 1101 expect(executable.kind, ReferenceKind.propertyAccessor);
1102 expect(executable.constMembers, isEmpty); 1102 expect(executable.constMembers, isEmpty);
1103 } 1103 }
1104 { 1104 {
1105 UnlinkedPublicName executable = executablesMap['methodStaticPublic']; 1105 UnlinkedPublicName executable = executablesMap['methodStaticPublic'];
1106 expect(executable.kind, ReferenceKind.staticMethod); 1106 expect(executable.kind, ReferenceKind.method);
1107 expect(executable.constMembers, isEmpty); 1107 expect(executable.constMembers, isEmpty);
1108 } 1108 }
1109 } 1109 }
1110 1110
1111 test_class_constMembers_constructors() { 1111 test_class_constMembers_constructors() {
1112 UnlinkedClass cls = serializeClassText(''' 1112 UnlinkedClass cls = serializeClassText('''
1113 class C { 1113 class C {
1114 const C(); 1114 const C();
1115 const C.constructorNamedPublicConst(); 1115 const C.constructorNamedPublicConst();
1116 C.constructorNamedPublic(); 1116 C.constructorNamedPublic();
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 UnlinkedVariable variable = serializeVariableText(''' 1732 UnlinkedVariable variable = serializeVariableText('''
1733 class C { 1733 class C {
1734 static const int length = 0; 1734 static const int length = 0;
1735 } 1735 }
1736 const int v = C.length; 1736 const int v = C.length;
1737 '''); 1737 ''');
1738 _assertUnlinkedConst(variable.constExpr, operators: [ 1738 _assertUnlinkedConst(variable.constExpr, operators: [
1739 UnlinkedConstOperation.pushReference 1739 UnlinkedConstOperation.pushReference
1740 ], referenceValidators: [ 1740 ], referenceValidators: [
1741 (EntityRef r) => checkTypeRef(r, null, null, 'length', 1741 (EntityRef r) => checkTypeRef(r, null, null, 'length',
1742 expectedKind: ReferenceKind.constField, 1742 expectedKind: ReferenceKind.propertyAccessor,
1743 prefixExpectations: [ 1743 prefixExpectations: [
1744 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 1744 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
1745 ]) 1745 ])
1746 ]); 1746 ]);
1747 } 1747 }
1748 1748
1749 test_constExpr_length_classConstField_imported_withPrefix() { 1749 test_constExpr_length_classConstField_imported_withPrefix() {
1750 addNamedSource( 1750 addNamedSource(
1751 '/a.dart', 1751 '/a.dart',
1752 ''' 1752 '''
1753 class C { 1753 class C {
1754 static const int length = 0; 1754 static const int length = 0;
1755 } 1755 }
1756 '''); 1756 ''');
1757 UnlinkedVariable variable = serializeVariableText(''' 1757 UnlinkedVariable variable = serializeVariableText('''
1758 import 'a.dart' as p; 1758 import 'a.dart' as p;
1759 const int v = p.C.length; 1759 const int v = p.C.length;
1760 '''); 1760 ''');
1761 _assertUnlinkedConst(variable.constExpr, operators: [ 1761 _assertUnlinkedConst(variable.constExpr, operators: [
1762 UnlinkedConstOperation.pushReference 1762 UnlinkedConstOperation.pushReference
1763 ], referenceValidators: [ 1763 ], referenceValidators: [
1764 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'length', 1764 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'length',
1765 expectedKind: ReferenceKind.constField, 1765 expectedKind: ReferenceKind.propertyAccessor,
1766 prefixExpectations: [ 1766 prefixExpectations: [
1767 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 1767 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
1768 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 1768 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
1769 new _PrefixExpectation(ReferenceKind.prefix, 'p', 1769 new _PrefixExpectation(ReferenceKind.prefix, 'p',
1770 inLibraryDefiningUnit: true) 1770 inLibraryDefiningUnit: true)
1771 ]) 1771 ])
1772 ]); 1772 ]);
1773 } 1773 }
1774 1774
1775 test_constExpr_length_identifierTarget() { 1775 test_constExpr_length_identifierTarget() {
(...skipping 19 matching lines...) Expand all
1795 static const String F = ''; 1795 static const String F = '';
1796 } 1796 }
1797 const int v = C.F.length; 1797 const int v = C.F.length;
1798 '''); 1798 ''');
1799 _assertUnlinkedConst(variable.constExpr, operators: [ 1799 _assertUnlinkedConst(variable.constExpr, operators: [
1800 UnlinkedConstOperation.pushReference 1800 UnlinkedConstOperation.pushReference
1801 ], referenceValidators: [ 1801 ], referenceValidators: [
1802 (EntityRef r) => checkTypeRef(r, null, null, 'length', 1802 (EntityRef r) => checkTypeRef(r, null, null, 'length',
1803 expectedKind: ReferenceKind.length, 1803 expectedKind: ReferenceKind.length,
1804 prefixExpectations: [ 1804 prefixExpectations: [
1805 new _PrefixExpectation(ReferenceKind.constField, 'F'), 1805 new _PrefixExpectation(ReferenceKind.propertyAccessor, 'F'),
1806 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'), 1806 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'),
1807 ]) 1807 ])
1808 ]); 1808 ]);
1809 } 1809 }
1810 1810
1811 test_constExpr_length_identifierTarget_imported() { 1811 test_constExpr_length_identifierTarget_imported() {
1812 addNamedSource( 1812 addNamedSource(
1813 '/a.dart', 1813 '/a.dart',
1814 ''' 1814 '''
1815 const String a = 'aaa'; 1815 const String a = 'aaa';
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
2162 UnlinkedVariable variable = serializeVariableText(''' 2162 UnlinkedVariable variable = serializeVariableText('''
2163 class C { 2163 class C {
2164 static const int F = 1; 2164 static const int F = 1;
2165 } 2165 }
2166 const v = C.F; 2166 const v = C.F;
2167 '''); 2167 ''');
2168 _assertUnlinkedConst(variable.constExpr, operators: [ 2168 _assertUnlinkedConst(variable.constExpr, operators: [
2169 UnlinkedConstOperation.pushReference 2169 UnlinkedConstOperation.pushReference
2170 ], referenceValidators: [ 2170 ], referenceValidators: [
2171 (EntityRef r) => checkTypeRef(r, null, null, 'F', 2171 (EntityRef r) => checkTypeRef(r, null, null, 'F',
2172 expectedKind: ReferenceKind.constField, 2172 expectedKind: ReferenceKind.propertyAccessor,
2173 prefixExpectations: [ 2173 prefixExpectations: [
2174 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 2174 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
2175 ]) 2175 ])
2176 ]); 2176 ]);
2177 } 2177 }
2178 2178
2179 test_constExpr_pushReference_field_imported() { 2179 test_constExpr_pushReference_field_imported() {
2180 addNamedSource( 2180 addNamedSource(
2181 '/a.dart', 2181 '/a.dart',
2182 ''' 2182 '''
2183 class C { 2183 class C {
2184 static const int F = 1; 2184 static const int F = 1;
2185 } 2185 }
2186 '''); 2186 ''');
2187 UnlinkedVariable variable = serializeVariableText(''' 2187 UnlinkedVariable variable = serializeVariableText('''
2188 import 'a.dart'; 2188 import 'a.dart';
2189 const v = C.F; 2189 const v = C.F;
2190 '''); 2190 ''');
2191 _assertUnlinkedConst(variable.constExpr, operators: [ 2191 _assertUnlinkedConst(variable.constExpr, operators: [
2192 UnlinkedConstOperation.pushReference 2192 UnlinkedConstOperation.pushReference
2193 ], referenceValidators: [ 2193 ], referenceValidators: [
2194 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'F', 2194 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'F',
2195 expectedKind: ReferenceKind.constField, 2195 expectedKind: ReferenceKind.propertyAccessor,
2196 prefixExpectations: [ 2196 prefixExpectations: [
2197 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 2197 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
2198 ]) 2198 ])
2199 ]); 2199 ]);
2200 } 2200 }
2201 2201
2202 test_constExpr_pushReference_field_imported_withPrefix() { 2202 test_constExpr_pushReference_field_imported_withPrefix() {
2203 addNamedSource( 2203 addNamedSource(
2204 '/a.dart', 2204 '/a.dart',
2205 ''' 2205 '''
2206 class C { 2206 class C {
2207 static const int F = 1; 2207 static const int F = 1;
2208 } 2208 }
2209 '''); 2209 ''');
2210 UnlinkedVariable variable = serializeVariableText(''' 2210 UnlinkedVariable variable = serializeVariableText('''
2211 import 'a.dart' as p; 2211 import 'a.dart' as p;
2212 const v = p.C.F; 2212 const v = p.C.F;
2213 '''); 2213 ''');
2214 _assertUnlinkedConst(variable.constExpr, operators: [ 2214 _assertUnlinkedConst(variable.constExpr, operators: [
2215 UnlinkedConstOperation.pushReference 2215 UnlinkedConstOperation.pushReference
2216 ], referenceValidators: [ 2216 ], referenceValidators: [
2217 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'F', 2217 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'F',
2218 expectedKind: ReferenceKind.constField, 2218 expectedKind: ReferenceKind.propertyAccessor,
2219 prefixExpectations: [ 2219 prefixExpectations: [
2220 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'), 2220 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'),
2221 new _PrefixExpectation(ReferenceKind.prefix, 'p', 2221 new _PrefixExpectation(ReferenceKind.prefix, 'p',
2222 inLibraryDefiningUnit: true), 2222 inLibraryDefiningUnit: true),
2223 ]) 2223 ])
2224 ]); 2224 ]);
2225 } 2225 }
2226 2226
2227 test_constExpr_pushReference_staticMethod() { 2227 test_constExpr_pushReference_staticMethod() {
2228 UnlinkedVariable variable = serializeVariableText(''' 2228 UnlinkedVariable variable = serializeVariableText('''
2229 class C { 2229 class C {
2230 static m() {} 2230 static m() {}
2231 } 2231 }
2232 const v = C.m; 2232 const v = C.m;
2233 '''); 2233 ''');
2234 _assertUnlinkedConst(variable.constExpr, operators: [ 2234 _assertUnlinkedConst(variable.constExpr, operators: [
2235 UnlinkedConstOperation.pushReference 2235 UnlinkedConstOperation.pushReference
2236 ], referenceValidators: [ 2236 ], referenceValidators: [
2237 (EntityRef r) => checkTypeRef(r, null, null, 'm', 2237 (EntityRef r) => checkTypeRef(r, null, null, 'm',
2238 expectedKind: ReferenceKind.staticMethod, 2238 expectedKind: ReferenceKind.method,
2239 prefixExpectations: [ 2239 prefixExpectations: [
2240 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 2240 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
2241 ]) 2241 ])
2242 ]); 2242 ]);
2243 } 2243 }
2244 2244
2245 test_constExpr_pushReference_staticMethod_imported() { 2245 test_constExpr_pushReference_staticMethod_imported() {
2246 addNamedSource( 2246 addNamedSource(
2247 '/a.dart', 2247 '/a.dart',
2248 ''' 2248 '''
2249 class C { 2249 class C {
2250 static m() {} 2250 static m() {}
2251 } 2251 }
2252 '''); 2252 ''');
2253 UnlinkedVariable variable = serializeVariableText(''' 2253 UnlinkedVariable variable = serializeVariableText('''
2254 import 'a.dart'; 2254 import 'a.dart';
2255 const v = C.m; 2255 const v = C.m;
2256 '''); 2256 ''');
2257 _assertUnlinkedConst(variable.constExpr, operators: [ 2257 _assertUnlinkedConst(variable.constExpr, operators: [
2258 UnlinkedConstOperation.pushReference 2258 UnlinkedConstOperation.pushReference
2259 ], referenceValidators: [ 2259 ], referenceValidators: [
2260 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'm', 2260 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'm',
2261 expectedKind: ReferenceKind.staticMethod, 2261 expectedKind: ReferenceKind.method,
2262 prefixExpectations: [ 2262 prefixExpectations: [
2263 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 2263 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
2264 ]) 2264 ])
2265 ]); 2265 ]);
2266 } 2266 }
2267 2267
2268 test_constExpr_pushReference_staticMethod_imported_withPrefix() { 2268 test_constExpr_pushReference_staticMethod_imported_withPrefix() {
2269 addNamedSource( 2269 addNamedSource(
2270 '/a.dart', 2270 '/a.dart',
2271 ''' 2271 '''
2272 class C { 2272 class C {
2273 static m() {} 2273 static m() {}
2274 } 2274 }
2275 '''); 2275 ''');
2276 UnlinkedVariable variable = serializeVariableText(''' 2276 UnlinkedVariable variable = serializeVariableText('''
2277 import 'a.dart' as p; 2277 import 'a.dart' as p;
2278 const v = p.C.m; 2278 const v = p.C.m;
2279 '''); 2279 ''');
2280 _assertUnlinkedConst(variable.constExpr, operators: [ 2280 _assertUnlinkedConst(variable.constExpr, operators: [
2281 UnlinkedConstOperation.pushReference 2281 UnlinkedConstOperation.pushReference
2282 ], referenceValidators: [ 2282 ], referenceValidators: [
2283 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'm', 2283 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'm',
2284 expectedKind: ReferenceKind.staticMethod, 2284 expectedKind: ReferenceKind.method,
2285 prefixExpectations: [ 2285 prefixExpectations: [
2286 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'), 2286 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'),
2287 new _PrefixExpectation(ReferenceKind.prefix, 'p', 2287 new _PrefixExpectation(ReferenceKind.prefix, 'p',
2288 inLibraryDefiningUnit: true) 2288 inLibraryDefiningUnit: true)
2289 ]) 2289 ])
2290 ]); 2290 ]);
2291 } 2291 }
2292 2292
2293 test_constExpr_pushReference_topLevelVariable() { 2293 test_constExpr_pushReference_topLevelVariable() {
2294 UnlinkedVariable variable = serializeVariableText(''' 2294 UnlinkedVariable variable = serializeVariableText('''
(...skipping 2674 matching lines...) Expand 10 before | Expand all | Expand 10 after
4969 final String absoluteUri; 4969 final String absoluteUri;
4970 final String relativeUri; 4970 final String relativeUri;
4971 final int numTypeParameters; 4971 final int numTypeParameters;
4972 4972
4973 _PrefixExpectation(this.kind, this.name, 4973 _PrefixExpectation(this.kind, this.name,
4974 {this.inLibraryDefiningUnit: false, 4974 {this.inLibraryDefiningUnit: false,
4975 this.absoluteUri, 4975 this.absoluteUri,
4976 this.relativeUri, 4976 this.relativeUri,
4977 this.numTypeParameters: 0}); 4977 this.numTypeParameters: 0});
4978 } 4978 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | pkg/analyzer/tool/summary/idl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698