| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.context.context_test; | 5 library analyzer.test.src.context.context_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 '''); | 331 '''); |
| 332 Source exporterSource = addSource( | 332 Source exporterSource = addSource( |
| 333 "/exporter.dart", | 333 "/exporter.dart", |
| 334 r''' | 334 r''' |
| 335 export 'lib.dart'; | 335 export 'lib.dart'; |
| 336 '''); | 336 '''); |
| 337 _performPendingAnalysisTasks(); | 337 _performPendingAnalysisTasks(); |
| 338 // initially: A | 338 // initially: A |
| 339 { | 339 { |
| 340 LibraryElement libraryElement = | 340 LibraryElement libraryElement = |
| 341 context.getResult(exporterSource, LIBRARY_ELEMENT1) as LibraryElement; | 341 context.getResult(exporterSource, LIBRARY_ELEMENT1); |
| 342 expect(libraryElement.exportNamespace.definedNames.keys, | 342 expect(libraryElement.exportNamespace.definedNames.keys, |
| 343 unorderedEquals(['A'])); | 343 unorderedEquals(['A'])); |
| 344 } | 344 } |
| 345 // after update: B | 345 // after update: B |
| 346 context.setContents( | 346 context.setContents( |
| 347 libSource, | 347 libSource, |
| 348 r''' | 348 r''' |
| 349 class B {}'''); | 349 class B {}'''); |
| 350 _performPendingAnalysisTasks(); | 350 _performPendingAnalysisTasks(); |
| 351 { | 351 { |
| 352 LibraryElement libraryElement = | 352 LibraryElement libraryElement = |
| 353 context.getResult(exporterSource, LIBRARY_ELEMENT1) as LibraryElement; | 353 context.getResult(exporterSource, LIBRARY_ELEMENT1); |
| 354 expect(libraryElement.exportNamespace.definedNames.keys, | 354 expect(libraryElement.exportNamespace.definedNames.keys, |
| 355 unorderedEquals(['B'])); | 355 unorderedEquals(['B'])); |
| 356 } | 356 } |
| 357 } | 357 } |
| 358 | 358 |
| 359 Future test_applyChanges_remove() { | 359 Future test_applyChanges_remove() { |
| 360 SourcesChangedListener listener = new SourcesChangedListener(); | 360 SourcesChangedListener listener = new SourcesChangedListener(); |
| 361 context.onSourcesChanged.listen(listener.onData); | 361 context.onSourcesChanged.listen(listener.onData); |
| 362 String libAContents = r''' | 362 String libAContents = r''' |
| 363 library libA; | 363 library libA; |
| (...skipping 4619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4983 * Initialize the visitor. | 4983 * Initialize the visitor. |
| 4984 */ | 4984 */ |
| 4985 _ElementGatherer(); | 4985 _ElementGatherer(); |
| 4986 | 4986 |
| 4987 @override | 4987 @override |
| 4988 void visitElement(Element element) { | 4988 void visitElement(Element element) { |
| 4989 elements[element] = element; | 4989 elements[element] = element; |
| 4990 super.visitElement(element); | 4990 super.visitElement(element); |
| 4991 } | 4991 } |
| 4992 } | 4992 } |
| OLD | NEW |