| 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 2441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2452 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'm', | 2452 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'm', |
| 2453 expectedKind: ReferenceKind.method, | 2453 expectedKind: ReferenceKind.method, |
| 2454 prefixExpectations: [ | 2454 prefixExpectations: [ |
| 2455 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'), | 2455 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'), |
| 2456 new _PrefixExpectation(ReferenceKind.prefix, 'p', | 2456 new _PrefixExpectation(ReferenceKind.prefix, 'p', |
| 2457 inLibraryDefiningUnit: true) | 2457 inLibraryDefiningUnit: true) |
| 2458 ]) | 2458 ]) |
| 2459 ]); | 2459 ]); |
| 2460 } | 2460 } |
| 2461 | 2461 |
| 2462 test_constExpr_pushReference_topLevelFunction() { |
| 2463 UnlinkedVariable variable = serializeVariableText(''' |
| 2464 f() {} |
| 2465 const v = f; |
| 2466 '''); |
| 2467 _assertUnlinkedConst(variable.constExpr, operators: [ |
| 2468 UnlinkedConstOperation.pushReference |
| 2469 ], referenceValidators: [ |
| 2470 (EntityRef r) => checkTypeRef(r, null, null, 'f', |
| 2471 expectedKind: ReferenceKind.topLevelFunction) |
| 2472 ]); |
| 2473 } |
| 2474 |
| 2475 test_constExpr_pushReference_topLevelFunction_imported() { |
| 2476 addNamedSource( |
| 2477 '/a.dart', |
| 2478 ''' |
| 2479 f() {} |
| 2480 '''); |
| 2481 UnlinkedVariable variable = serializeVariableText(''' |
| 2482 import 'a.dart'; |
| 2483 const v = f; |
| 2484 '''); |
| 2485 _assertUnlinkedConst(variable.constExpr, operators: [ |
| 2486 UnlinkedConstOperation.pushReference |
| 2487 ], referenceValidators: [ |
| 2488 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'f', |
| 2489 expectedKind: ReferenceKind.topLevelFunction) |
| 2490 ]); |
| 2491 } |
| 2492 |
| 2493 test_constExpr_pushReference_topLevelFunction_imported_withPrefix() { |
| 2494 addNamedSource( |
| 2495 '/a.dart', |
| 2496 ''' |
| 2497 f() {} |
| 2498 '''); |
| 2499 UnlinkedVariable variable = serializeVariableText(''' |
| 2500 import 'a.dart' as p; |
| 2501 const v = p.f; |
| 2502 '''); |
| 2503 _assertUnlinkedConst(variable.constExpr, operators: [ |
| 2504 UnlinkedConstOperation.pushReference |
| 2505 ], referenceValidators: [ |
| 2506 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'f', |
| 2507 expectedKind: ReferenceKind.topLevelFunction, |
| 2508 prefixExpectations: [ |
| 2509 new _PrefixExpectation(ReferenceKind.prefix, 'p', |
| 2510 inLibraryDefiningUnit: true) |
| 2511 ]) |
| 2512 ]); |
| 2513 } |
| 2514 |
| 2462 test_constExpr_pushReference_topLevelVariable() { | 2515 test_constExpr_pushReference_topLevelVariable() { |
| 2463 UnlinkedVariable variable = serializeVariableText(''' | 2516 UnlinkedVariable variable = serializeVariableText(''' |
| 2464 const int a = 1; | 2517 const int a = 1; |
| 2465 const v = a; | 2518 const v = a; |
| 2466 '''); | 2519 '''); |
| 2467 _assertUnlinkedConst(variable.constExpr, operators: [ | 2520 _assertUnlinkedConst(variable.constExpr, operators: [ |
| 2468 UnlinkedConstOperation.pushReference | 2521 UnlinkedConstOperation.pushReference |
| 2469 ], referenceValidators: [ | 2522 ], referenceValidators: [ |
| 2470 (EntityRef r) => checkTypeRef(r, null, null, 'a', | 2523 (EntityRef r) => checkTypeRef(r, null, null, 'a', |
| 2471 expectedKind: ReferenceKind.topLevelPropertyAccessor) | 2524 expectedKind: ReferenceKind.topLevelPropertyAccessor) |
| (...skipping 2789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5261 final String absoluteUri; | 5314 final String absoluteUri; |
| 5262 final String relativeUri; | 5315 final String relativeUri; |
| 5263 final int numTypeParameters; | 5316 final int numTypeParameters; |
| 5264 | 5317 |
| 5265 _PrefixExpectation(this.kind, this.name, | 5318 _PrefixExpectation(this.kind, this.name, |
| 5266 {this.inLibraryDefiningUnit: false, | 5319 {this.inLibraryDefiningUnit: false, |
| 5267 this.absoluteUri, | 5320 this.absoluteUri, |
| 5268 this.relativeUri, | 5321 this.relativeUri, |
| 5269 this.numTypeParameters: 0}); | 5322 this.numTypeParameters: 0}); |
| 5270 } | 5323 } |
| OLD | NEW |