| 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 7254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7265 | 7265 |
| 7266 p.A a; | 7266 p.A a; |
| 7267 p.B b; | 7267 p.B b; |
| 7268 '''); | 7268 '''); |
| 7269 checkTypeRef(findVariable('a').type, absUri('/a.dart'), 'a.dart', 'A', | 7269 checkTypeRef(findVariable('a').type, absUri('/a.dart'), 'a.dart', 'A', |
| 7270 expectedPrefix: 'p'); | 7270 expectedPrefix: 'p'); |
| 7271 checkTypeRef(findVariable('b').type, absUri('/b.dart'), 'b.dart', 'B', | 7271 checkTypeRef(findVariable('b').type, absUri('/b.dart'), 'b.dart', 'B', |
| 7272 expectedPrefix: 'p'); | 7272 expectedPrefix: 'p'); |
| 7273 } | 7273 } |
| 7274 | 7274 |
| 7275 test_import_self() { |
| 7276 if (!checkAstDerivedData) { |
| 7277 // TODO(paulberry): this test fails when building the summary from the |
| 7278 // element model because the element model can't tell the difference |
| 7279 // between self references via a local name and self references via a |
| 7280 // self-import. |
| 7281 return; |
| 7282 } |
| 7283 serializeLibraryText(''' |
| 7284 import 'test.dart' as p; |
| 7285 class C {} |
| 7286 class D extends p.C {} // Prevent "unused import" warning |
| 7287 '''); |
| 7288 expect(unlinkedUnits[0].imports[0].uri, 'test.dart'); |
| 7289 checkDependency( |
| 7290 linked.importDependencies[0], absUri('/test.dart'), 'test.dart'); |
| 7291 checkTypeRef(unlinkedUnits[0].classes[1].supertype, absUri('/test.dart'), |
| 7292 'test.dart', 'C', |
| 7293 expectedPrefix: 'p'); |
| 7294 } |
| 7295 |
| 7275 test_import_show_order() { | 7296 test_import_show_order() { |
| 7276 String libraryText = | 7297 String libraryText = |
| 7277 'import "dart:async" show Future, Stream; Future x; Stream y;'; | 7298 'import "dart:async" show Future, Stream; Future x; Stream y;'; |
| 7278 serializeLibraryText(libraryText); | 7299 serializeLibraryText(libraryText); |
| 7279 // Second import is the implicit import of dart:core | 7300 // Second import is the implicit import of dart:core |
| 7280 expect(unlinkedUnits[0].imports, hasLength(2)); | 7301 expect(unlinkedUnits[0].imports, hasLength(2)); |
| 7281 expect(unlinkedUnits[0].imports[0].combinators, hasLength(1)); | 7302 expect(unlinkedUnits[0].imports[0].combinators, hasLength(1)); |
| 7282 expect(unlinkedUnits[0].imports[0].combinators[0].shows, hasLength(2)); | 7303 expect(unlinkedUnits[0].imports[0].combinators[0].shows, hasLength(2)); |
| 7283 expect(unlinkedUnits[0].imports[0].combinators[0].hides, isEmpty); | 7304 expect(unlinkedUnits[0].imports[0].combinators[0].hides, isEmpty); |
| 7284 expect(unlinkedUnits[0].imports[0].combinators[0].shows[0], 'Future'); | 7305 expect(unlinkedUnits[0].imports[0].combinators[0].shows[0], 'Future'); |
| (...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9357 class _PrefixExpectation { | 9378 class _PrefixExpectation { |
| 9358 final ReferenceKind kind; | 9379 final ReferenceKind kind; |
| 9359 final String name; | 9380 final String name; |
| 9360 final String absoluteUri; | 9381 final String absoluteUri; |
| 9361 final String relativeUri; | 9382 final String relativeUri; |
| 9362 final int numTypeParameters; | 9383 final int numTypeParameters; |
| 9363 | 9384 |
| 9364 _PrefixExpectation(this.kind, this.name, | 9385 _PrefixExpectation(this.kind, this.name, |
| 9365 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); | 9386 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); |
| 9366 } | 9387 } |
| OLD | NEW |