mirror of
https://github.com/dart-lang/sdk
synced 2024-07-21 10:25:52 +00:00
Fix other tests in 'try' after elementvisitor changes
TBR=sra@google.com,johnniwinther@google.com Review URL: https://codereview.chromium.org//1056133008 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45323 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
4c03f25626
commit
41a675b771
|
@ -34,7 +34,7 @@ import 'package:compiler/src/dart2jslib.dart' show
|
|||
WorkItem;
|
||||
|
||||
import 'package:compiler/src/elements/visitor.dart' show
|
||||
ElementVisitor;
|
||||
BaseElementVisitor;
|
||||
|
||||
import 'package:compiler/src/elements/elements.dart' show
|
||||
AbstractFieldElement,
|
||||
|
@ -492,24 +492,24 @@ Future<Element> runPoiInternal(
|
|||
|
||||
Element findPosition(int position, Element element) {
|
||||
FindPositionVisitor visitor = new FindPositionVisitor(position, element);
|
||||
element.accept(visitor);
|
||||
element.accept(visitor, null);
|
||||
return visitor.element;
|
||||
}
|
||||
|
||||
String scopeInformation(Element element, int position) {
|
||||
ScopeInformationVisitor visitor =
|
||||
new ScopeInformationVisitor(cachedCompiler, element, position);
|
||||
element.accept(visitor);
|
||||
element.accept(visitor, null);
|
||||
return '${visitor.buffer}';
|
||||
}
|
||||
|
||||
class FindPositionVisitor extends ElementVisitor {
|
||||
class FindPositionVisitor extends BaseElementVisitor {
|
||||
final int position;
|
||||
Element element;
|
||||
|
||||
FindPositionVisitor(this.position, this.element);
|
||||
|
||||
visitElement(modelx.ElementX e) {
|
||||
visitElement(modelx.ElementX e, _) {
|
||||
DeclarationSite site = e.declarationSite;
|
||||
if (site is PartialElement) {
|
||||
if (site.beginToken.charOffset <= position &&
|
||||
|
@ -519,18 +519,18 @@ class FindPositionVisitor extends ElementVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
visitClassElement(ClassElement e) {
|
||||
visitClassElement(ClassElement e, _) {
|
||||
if (e is PartialClassElement) {
|
||||
if (e.beginToken.charOffset <= position &&
|
||||
position < e.endToken.next.charOffset) {
|
||||
element = e;
|
||||
visitScopeContainerElement(e);
|
||||
visitScopeContainerElement(e, _);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
visitScopeContainerElement(ScopeContainerElement e) {
|
||||
e.forEachLocalMember((Element element) => element.accept(this));
|
||||
visitScopeContainerElement(ScopeContainerElement e, _) {
|
||||
e.forEachLocalMember((Element element) => element.accept(this, _));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import 'package:compiler/src/elements/modelx.dart' show
|
|||
FieldElementX;
|
||||
|
||||
import 'package:compiler/src/elements/visitor.dart' show
|
||||
ElementVisitor;
|
||||
BaseElementVisitor;
|
||||
|
||||
import 'package:compiler/src/dart2jslib.dart' show
|
||||
Compiler;
|
||||
|
@ -34,7 +34,7 @@ import 'package:compiler/src/dart_types.dart' show
|
|||
* calling the [serialize] method on each element. Some elements need special
|
||||
* treatment, as their enclosing scope must also be serialized.
|
||||
*/
|
||||
class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
|
||||
class ScopeInformationVisitor extends BaseElementVisitor/* <void> */ {
|
||||
// TODO(ahe): Include function parameters and local variables.
|
||||
|
||||
final Compiler compiler;
|
||||
|
@ -54,11 +54,11 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
|
|||
|
||||
StringBuffer get indented => buffer..write(indentation);
|
||||
|
||||
void visitElement(Element e) {
|
||||
void visitElement(Element e, _) {
|
||||
serialize(e, omitEnclosing: false);
|
||||
}
|
||||
|
||||
void visitLibraryElement(LibraryElement e) {
|
||||
void visitLibraryElement(LibraryElement e, _) {
|
||||
bool isFirst = true;
|
||||
forEach(Element member) {
|
||||
if (!isFirst) {
|
||||
|
@ -103,7 +103,7 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
|
|||
});
|
||||
}
|
||||
|
||||
void visitClassElement(ClassElement e) {
|
||||
void visitClassElement(ClassElement e, _) {
|
||||
currentClass = e;
|
||||
serializeClassSide(e, isStatic: true);
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
|
|||
});
|
||||
}
|
||||
|
||||
void visitScopeContainerElement(ScopeContainerElement e) {
|
||||
void visitScopeContainerElement(ScopeContainerElement e, _) {
|
||||
bool isFirst = true;
|
||||
serialize(e, omitEnclosing: false, serializeMembers: () {
|
||||
localMembersSorted(e).forEach((Element member) {
|
||||
|
@ -183,11 +183,11 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
|
|||
});
|
||||
}
|
||||
|
||||
void visitCompilationUnitElement(CompilationUnitElement e) {
|
||||
e.enclosingElement.accept(this);
|
||||
void visitCompilationUnitElement(CompilationUnitElement e, _) {
|
||||
e.enclosingElement.accept(this, _);
|
||||
}
|
||||
|
||||
void visitAbstractFieldElement(AbstractFieldElement e) {
|
||||
void visitAbstractFieldElement(AbstractFieldElement e, _) {
|
||||
throw new UnsupportedError('AbstractFieldElement cannot be serialized.');
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
|
|||
if (serializeEnclosing != null) {
|
||||
serializeEnclosing();
|
||||
} else {
|
||||
element.enclosingElement.accept(this);
|
||||
element.enclosingElement.accept(this, null);
|
||||
}
|
||||
}
|
||||
indentationLevel--;
|
||||
|
|
Loading…
Reference in a new issue