| 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.generated.resolver_test; | 5 library analyzer.test.generated.resolver_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 main() { | 36 main() { |
| 37 initializeTestEnvironment(); | 37 initializeTestEnvironment(); |
| 38 runReflectiveTests(AnalysisDeltaTest); | 38 runReflectiveTests(AnalysisDeltaTest); |
| 39 runReflectiveTests(ChangeSetTest); | 39 runReflectiveTests(ChangeSetTest); |
| 40 runReflectiveTests(DisableAsyncTestCase); | 40 runReflectiveTests(DisableAsyncTestCase); |
| 41 runReflectiveTests(EnclosedScopeTest); | 41 runReflectiveTests(EnclosedScopeTest); |
| 42 runReflectiveTests(ErrorResolverTest); | 42 runReflectiveTests(ErrorResolverTest); |
| 43 runReflectiveTests(LibraryImportScopeTest); | 43 runReflectiveTests(LibraryImportScopeTest); |
| 44 runReflectiveTests(LibraryScopeTest); | 44 runReflectiveTests(LibraryScopeTest); |
| 45 runReflectiveTests(PrefixedNamespaceTest); |
| 45 runReflectiveTests(ScopeTest); | 46 runReflectiveTests(ScopeTest); |
| 46 runReflectiveTests(StrictModeTest); | 47 runReflectiveTests(StrictModeTest); |
| 47 runReflectiveTests(SubtypeManagerTest); | 48 runReflectiveTests(SubtypeManagerTest); |
| 48 runReflectiveTests(TypeOverrideManagerTest); | 49 runReflectiveTests(TypeOverrideManagerTest); |
| 49 runReflectiveTests(TypePropagationTest); | 50 runReflectiveTests(TypePropagationTest); |
| 50 runReflectiveTests(TypeProviderImplTest); | 51 runReflectiveTests(TypeProviderImplTest); |
| 51 runReflectiveTests(TypeResolverVisitorTest); | 52 runReflectiveTests(TypeResolverVisitorTest); |
| 52 } | 53 } |
| 53 | 54 |
| 54 @reflectiveTest | 55 @reflectiveTest |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 } | 529 } |
| 529 | 530 |
| 530 void test_getErrorListener() { | 531 void test_getErrorListener() { |
| 531 LibraryElement definingLibrary = createDefaultTestLibrary(); | 532 LibraryElement definingLibrary = createDefaultTestLibrary(); |
| 532 GatheringErrorListener errorListener = new GatheringErrorListener(); | 533 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 533 LibraryScope scope = new LibraryScope(definingLibrary, errorListener); | 534 LibraryScope scope = new LibraryScope(definingLibrary, errorListener); |
| 534 expect(scope.errorListener, errorListener); | 535 expect(scope.errorListener, errorListener); |
| 535 } | 536 } |
| 536 } | 537 } |
| 537 | 538 |
| 539 @reflectiveTest |
| 540 class PrefixedNamespaceTest extends ResolverTestCase { |
| 541 void test_lookup_missing() { |
| 542 ClassElement element = ElementFactory.classElement2('A'); |
| 543 PrefixedNamespace namespace = new PrefixedNamespace('p', _toMap([element])); |
| 544 expect(namespace.get('p.B'), isNull); |
| 545 } |
| 546 |
| 547 void test_lookup_missing_matchesPrefix() { |
| 548 ClassElement element = ElementFactory.classElement2('A'); |
| 549 PrefixedNamespace namespace = new PrefixedNamespace('p', _toMap([element])); |
| 550 expect(namespace.get('p'), isNull); |
| 551 } |
| 552 |
| 553 void test_lookup_valid() { |
| 554 ClassElement element = ElementFactory.classElement2('A'); |
| 555 PrefixedNamespace namespace = new PrefixedNamespace('p', _toMap([element])); |
| 556 expect(namespace.get('p.A'), same(element)); |
| 557 } |
| 558 |
| 559 HashMap<String, Element> _toMap(List<Element> elements) { |
| 560 HashMap<String, Element> map = new HashMap<String, Element>(); |
| 561 for (Element element in elements) { |
| 562 map[element.name] = element; |
| 563 } |
| 564 return map; |
| 565 } |
| 566 } |
| 567 |
| 538 class Scope_EnclosedScopeTest_test_define_duplicate extends Scope { | 568 class Scope_EnclosedScopeTest_test_define_duplicate extends Scope { |
| 539 GatheringErrorListener listener; | 569 GatheringErrorListener listener; |
| 540 | 570 |
| 541 Scope_EnclosedScopeTest_test_define_duplicate(this.listener) : super(); | 571 Scope_EnclosedScopeTest_test_define_duplicate(this.listener) : super(); |
| 542 | 572 |
| 543 @override | 573 @override |
| 544 AnalysisErrorListener get errorListener => listener; | 574 AnalysisErrorListener get errorListener => listener; |
| 545 | 575 |
| 546 @override | 576 @override |
| 547 Element internalLookup(Identifier identifier, String name, | 577 Element internalLookup(Identifier identifier, String name, |
| (...skipping 3049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3597 */ | 3627 */ |
| 3598 class _StaleElement extends ElementImpl { | 3628 class _StaleElement extends ElementImpl { |
| 3599 _StaleElement() : super("_StaleElement", -1); | 3629 _StaleElement() : super("_StaleElement", -1); |
| 3600 | 3630 |
| 3601 @override | 3631 @override |
| 3602 get kind => throw "_StaleElement's kind shouldn't be accessed"; | 3632 get kind => throw "_StaleElement's kind shouldn't be accessed"; |
| 3603 | 3633 |
| 3604 @override | 3634 @override |
| 3605 accept(_) => throw "_StaleElement shouldn't be visited"; | 3635 accept(_) => throw "_StaleElement shouldn't be visited"; |
| 3606 } | 3636 } |
| OLD | NEW |