Index: pkg/analyzer/test/generated/element_resolver_test.dart |
diff --git a/pkg/analyzer/test/generated/element_resolver_test.dart b/pkg/analyzer/test/generated/element_resolver_test.dart |
index 9d577d467da5a8f9a1dea62f3c87176c06dc4bda..a562940e19753f2be0769cb376c0af91bc0aebea 100644 |
--- a/pkg/analyzer/test/generated/element_resolver_test.dart |
+++ b/pkg/analyzer/test/generated/element_resolver_test.dart |
@@ -12,8 +12,6 @@ import 'package:analyzer/file_system/memory_file_system.dart'; |
import 'package:analyzer/src/dart/element/element.dart'; |
import 'package:analyzer/src/generated/element_resolver.dart'; |
import 'package:analyzer/src/generated/engine.dart'; |
-import 'package:analyzer/src/generated/java_core.dart'; |
-import 'package:analyzer/src/generated/java_engine.dart'; |
import 'package:analyzer/src/generated/resolver.dart'; |
import 'package:analyzer/src/generated/source.dart'; |
import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
@@ -884,12 +882,7 @@ class ElementResolverTest extends EngineTestCase { |
_visitor = new ResolverVisitor( |
_definingLibrary, source, _typeProvider, _listener, |
nameScope: new LibraryScope(_definingLibrary)); |
- try { |
- return _visitor.elementResolver; |
- } catch (exception) { |
- throw new IllegalArgumentException( |
- "Could not create resolver", exception); |
- } |
+ return _visitor.elementResolver; |
} |
/** |
@@ -943,21 +936,16 @@ class ElementResolverTest extends EngineTestCase { |
* @return the element to which the expression was resolved |
*/ |
void _resolveInClass(AstNode node, ClassElement enclosingClass) { |
+ Scope outerScope = _visitor.nameScope; |
try { |
- Scope outerScope = _visitor.nameScope; |
- try { |
- _visitor.enclosingClass = enclosingClass; |
- EnclosedScope innerScope = new ClassScope( |
- new TypeParameterScope(outerScope, enclosingClass), enclosingClass); |
- _visitor.nameScope = innerScope; |
- node.accept(_resolver); |
- } finally { |
- _visitor.enclosingClass = null; |
- _visitor.nameScope = outerScope; |
- } |
- } catch (exception, stackTrace) { |
- throw new IllegalArgumentException( |
- "Could not resolve node", new CaughtException(exception, stackTrace)); |
+ _visitor.enclosingClass = enclosingClass; |
+ EnclosedScope innerScope = new ClassScope( |
+ new TypeParameterScope(outerScope, enclosingClass), enclosingClass); |
+ _visitor.nameScope = innerScope; |
+ node.accept(_resolver); |
+ } finally { |
+ _visitor.enclosingClass = null; |
+ _visitor.nameScope = outerScope; |
} |
} |
@@ -986,22 +974,18 @@ class ElementResolverTest extends EngineTestCase { |
* @return the element to which the expression was resolved |
*/ |
void _resolveNode(AstNode node, [List<Element> definedElements]) { |
+ Scope outerScope = _visitor.nameScope; |
try { |
- Scope outerScope = _visitor.nameScope; |
- try { |
- EnclosedScope innerScope = new EnclosedScope(outerScope); |
- if (definedElements != null) { |
- for (Element element in definedElements) { |
- innerScope.define(element); |
- } |
+ EnclosedScope innerScope = new EnclosedScope(outerScope); |
+ if (definedElements != null) { |
+ for (Element element in definedElements) { |
+ innerScope.define(element); |
} |
- _visitor.nameScope = innerScope; |
- node.accept(_resolver); |
- } finally { |
- _visitor.nameScope = outerScope; |
} |
- } catch (exception) { |
- throw new IllegalArgumentException("Could not resolve node", exception); |
+ _visitor.nameScope = innerScope; |
+ node.accept(_resolver); |
+ } finally { |
+ _visitor.nameScope = outerScope; |
} |
} |
@@ -1015,23 +999,19 @@ class ElementResolverTest extends EngineTestCase { |
*/ |
void _resolveStatement( |
Statement statement, LabelElementImpl labelElement, AstNode labelTarget) { |
+ LabelScope outerScope = _visitor.labelScope; |
try { |
- LabelScope outerScope = _visitor.labelScope; |
- try { |
- LabelScope innerScope; |
- if (labelElement == null) { |
- innerScope = outerScope; |
- } else { |
- innerScope = new LabelScope( |
- outerScope, labelElement.name, labelTarget, labelElement); |
- } |
- _visitor.labelScope = innerScope; |
- statement.accept(_resolver); |
- } finally { |
- _visitor.labelScope = outerScope; |
+ LabelScope innerScope; |
+ if (labelElement == null) { |
+ innerScope = outerScope; |
+ } else { |
+ innerScope = new LabelScope( |
+ outerScope, labelElement.name, labelTarget, labelElement); |
} |
- } catch (exception) { |
- throw new IllegalArgumentException("Could not resolve node", exception); |
+ _visitor.labelScope = innerScope; |
+ statement.accept(_resolver); |
+ } finally { |
+ _visitor.labelScope = outerScope; |
} |
} |
} |