| 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/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2241 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'F', | 2241 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'F', |
| 2242 expectedKind: ReferenceKind.constField, | 2242 expectedKind: ReferenceKind.constField, |
| 2243 prefixExpectations: [ | 2243 prefixExpectations: [ |
| 2244 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'), | 2244 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'), |
| 2245 new _PrefixExpectation(ReferenceKind.prefix, 'p', | 2245 new _PrefixExpectation(ReferenceKind.prefix, 'p', |
| 2246 inLibraryDefiningUnit: true), | 2246 inLibraryDefiningUnit: true), |
| 2247 ]) | 2247 ]) |
| 2248 ]); | 2248 ]); |
| 2249 } | 2249 } |
| 2250 | 2250 |
| 2251 test_constExpr_pushReference_staticMethod() { |
| 2252 UnlinkedVariable variable = serializeVariableText(''' |
| 2253 class C { |
| 2254 static m() {} |
| 2255 } |
| 2256 const v = C.m; |
| 2257 '''); |
| 2258 _assertUnlinkedConst(variable.constExpr, operators: [ |
| 2259 UnlinkedConstOperation.pushReference |
| 2260 ], referenceValidators: [ |
| 2261 (EntityRef r) => checkTypeRef(r, null, null, 'm', |
| 2262 expectedKind: ReferenceKind.staticMethod, |
| 2263 prefixExpectations: [ |
| 2264 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') |
| 2265 ]) |
| 2266 ]); |
| 2267 } |
| 2268 |
| 2269 test_constExpr_pushReference_staticMethod_imported() { |
| 2270 addNamedSource( |
| 2271 '/a.dart', |
| 2272 ''' |
| 2273 class C { |
| 2274 static m() {} |
| 2275 } |
| 2276 '''); |
| 2277 UnlinkedVariable variable = serializeVariableText(''' |
| 2278 import 'a.dart'; |
| 2279 const v = C.m; |
| 2280 '''); |
| 2281 _assertUnlinkedConst(variable.constExpr, operators: [ |
| 2282 UnlinkedConstOperation.pushReference |
| 2283 ], referenceValidators: [ |
| 2284 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'm', |
| 2285 expectedKind: ReferenceKind.staticMethod, |
| 2286 prefixExpectations: [ |
| 2287 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') |
| 2288 ]) |
| 2289 ]); |
| 2290 } |
| 2291 |
| 2292 test_constExpr_pushReference_staticMethod_imported_withPrefix() { |
| 2293 addNamedSource( |
| 2294 '/a.dart', |
| 2295 ''' |
| 2296 class C { |
| 2297 static m() {} |
| 2298 } |
| 2299 '''); |
| 2300 UnlinkedVariable variable = serializeVariableText(''' |
| 2301 import 'a.dart' as p; |
| 2302 const v = p.C.m; |
| 2303 '''); |
| 2304 _assertUnlinkedConst(variable.constExpr, operators: [ |
| 2305 UnlinkedConstOperation.pushReference |
| 2306 ], referenceValidators: [ |
| 2307 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'm', |
| 2308 expectedKind: ReferenceKind.staticMethod, |
| 2309 prefixExpectations: [ |
| 2310 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'), |
| 2311 new _PrefixExpectation(ReferenceKind.prefix, 'p', |
| 2312 inLibraryDefiningUnit: true) |
| 2313 ]) |
| 2314 ]); |
| 2315 } |
| 2316 |
| 2251 test_constExpr_pushReference_topLevelVariable() { | 2317 test_constExpr_pushReference_topLevelVariable() { |
| 2252 UnlinkedVariable variable = serializeVariableText(''' | 2318 UnlinkedVariable variable = serializeVariableText(''' |
| 2253 const int a = 1; | 2319 const int a = 1; |
| 2254 const v = a; | 2320 const v = a; |
| 2255 '''); | 2321 '''); |
| 2256 _assertUnlinkedConst(variable.constExpr, operators: [ | 2322 _assertUnlinkedConst(variable.constExpr, operators: [ |
| 2257 UnlinkedConstOperation.pushReference | 2323 UnlinkedConstOperation.pushReference |
| 2258 ], referenceValidators: [ | 2324 ], referenceValidators: [ |
| 2259 (EntityRef r) => checkTypeRef(r, null, null, 'a', | 2325 (EntityRef r) => checkTypeRef(r, null, null, 'a', |
| 2260 expectedKind: ReferenceKind.topLevelPropertyAccessor) | 2326 expectedKind: ReferenceKind.topLevelPropertyAccessor) |
| (...skipping 2666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4927 final String absoluteUri; | 4993 final String absoluteUri; |
| 4928 final String relativeUri; | 4994 final String relativeUri; |
| 4929 final int numTypeParameters; | 4995 final int numTypeParameters; |
| 4930 | 4996 |
| 4931 _PrefixExpectation(this.kind, this.name, | 4997 _PrefixExpectation(this.kind, this.name, |
| 4932 {this.inLibraryDefiningUnit: false, | 4998 {this.inLibraryDefiningUnit: false, |
| 4933 this.absoluteUri, | 4999 this.absoluteUri, |
| 4934 this.relativeUri, | 5000 this.relativeUri, |
| 4935 this.numTypeParameters: 0}); | 5001 this.numTypeParameters: 0}); |
| 4936 } | 5002 } |
| OLD | NEW |