Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 2329313002: Remove Scope.errorListener. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/dart/resolver/scope.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index fa50111111274a8d99f06188e608ffd8ae727c8b..db8f4cff8511619394fe8871753f0ed2eed99705 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -190,30 +190,14 @@ class C {
@reflectiveTest
class EnclosedScopeTest extends ResolverTestCase {
void test_define_duplicate() {
- GatheringErrorListener listener = new GatheringErrorListener();
- Scope rootScope =
- new Scope_EnclosedScopeTest_test_define_duplicate(listener);
+ Scope rootScope = new _RootScope();
EnclosedScope scope = new EnclosedScope(rootScope);
- SimpleIdentifier identifier = AstFactory.identifier3("v1");
+ SimpleIdentifier identifier = AstFactory.identifier3('v');
VariableElement element1 = ElementFactory.localVariableElement(identifier);
VariableElement element2 = ElementFactory.localVariableElement(identifier);
scope.define(element1);
scope.define(element2);
- expect(scope.lookup(identifier, null), element1);
- }
-
- void test_define_normal() {
- GatheringErrorListener listener = new GatheringErrorListener();
- Scope rootScope = new Scope_EnclosedScopeTest_test_define_normal(listener);
- EnclosedScope outerScope = new EnclosedScope(rootScope);
- EnclosedScope innerScope = new EnclosedScope(outerScope);
- VariableElement element1 =
- ElementFactory.localVariableElement(AstFactory.identifier3("v1"));
- VariableElement element2 =
- ElementFactory.localVariableElement(AstFactory.identifier3("v2"));
- outerScope.define(element1);
- innerScope.define(element2);
- listener.assertNoErrors();
+ expect(scope.lookup(identifier, null), same(element1));
}
}
@@ -430,54 +414,16 @@ class PrefixedNamespaceTest extends ResolverTestCase {
}
}
-class Scope_EnclosedScopeTest_test_define_duplicate extends Scope {
- GatheringErrorListener listener;
-
- Scope_EnclosedScopeTest_test_define_duplicate(this.listener) : super();
-
- @override
- AnalysisErrorListener get errorListener => listener;
-
- @override
- Element internalLookup(Identifier identifier, String name,
- LibraryElement referencingLibrary) =>
- null;
-}
-
-class Scope_EnclosedScopeTest_test_define_normal extends Scope {
- GatheringErrorListener listener;
-
- Scope_EnclosedScopeTest_test_define_normal(this.listener) : super();
-
- @override
- AnalysisErrorListener get errorListener => listener;
-
- @override
- Element internalLookup(Identifier identifier, String name,
- LibraryElement referencingLibrary) =>
- null;
-}
-
@reflectiveTest
class ScopeTest extends ResolverTestCase {
void test_define_duplicate() {
- ScopeTest_TestScope scope = new ScopeTest_TestScope();
- SimpleIdentifier identifier = AstFactory.identifier3("v1");
+ Scope scope = new _RootScope();
+ SimpleIdentifier identifier = AstFactory.identifier3('v');
VariableElement element1 = ElementFactory.localVariableElement(identifier);
VariableElement element2 = ElementFactory.localVariableElement(identifier);
scope.define(element1);
scope.define(element2);
- expect(scope.lookup(identifier, null), element1);
- }
-
- void test_define_normal() {
- ScopeTest_TestScope scope = new ScopeTest_TestScope();
- VariableElement element1 =
- ElementFactory.localVariableElement(AstFactory.identifier3("v1"));
- VariableElement element2 =
- ElementFactory.localVariableElement(AstFactory.identifier3("v2"));
- scope.define(element1);
- scope.define(element2);
+ expect(scope.localLookup('v', null), same(element1));
}
void test_isPrivateName_nonPrivate() {
@@ -489,22 +435,6 @@ class ScopeTest extends ResolverTestCase {
}
}
-/**
- * A non-abstract subclass that can be used for testing purposes.
- */
-class ScopeTest_TestScope extends Scope {
- ScopeTest_TestScope();
-
- @deprecated
- @override
- AnalysisErrorListener get errorListener => null;
-
- @override
- Element internalLookup(Identifier identifier, String name,
- LibraryElement referencingLibrary) =>
- localLookup(name, referencingLibrary);
-}
-
class SourceContainer_ChangeSetTest_test_toString implements SourceContainer {
@override
bool contains(Source source) => false;
@@ -3369,6 +3299,13 @@ class TypeResolverVisitorTest {
}
}
+class _RootScope extends Scope {
+ @override
+ Element internalLookup(Identifier identifier, String name,
+ LibraryElement referencingLibrary) =>
+ null;
+}
+
/**
* Represents an element left over from a previous resolver run.
*
« no previous file with comments | « pkg/analyzer/lib/src/dart/resolver/scope.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698