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

Unified Diff: frog/tests/leg/src/ResolverTest.dart

Issue 9166010: Implement super calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 11 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
Index: frog/tests/leg/src/ResolverTest.dart
diff --git a/frog/tests/leg/src/ResolverTest.dart b/frog/tests/leg/src/ResolverTest.dart
index cfdfc1e9a868d739f921625c3ec777a81b58fb78..38adc83ab74977a209a39d2f01d57a0955348120 100644
--- a/frog/tests/leg/src/ResolverTest.dart
+++ b/frog/tests/leg/src/ResolverTest.dart
@@ -66,6 +66,31 @@ main() {
testTopLevelFields();
testInitializers();
testThis();
+ testSuperCalls();
+}
+
+testSuperCalls() {
+ MockCompiler compiler = new MockCompiler();
+ Universe universe = compiler.universe;
+ String script = """class A { foo() {} }
+ class B extends A { foo() => super.foo(); }""";
+ compiler.parseScript(script);
+ compiler.resolveStatement("B b;");
+
+ ClassElement classB = compiler.universe.find(buildSourceString("B"));
+ FunctionElement fooB = classB.lookupLocalMember(buildSourceString("foo"));
+ ClassElement classA = compiler.universe.find(buildSourceString("A"));
+ FunctionElement fooA = classA.lookupLocalMember(buildSourceString("foo"));
+
+ FullResolverVisitor visitor = new FullResolverVisitor(compiler, fooB);
+ FunctionExpression node = fooB.parseNode(compiler, compiler);
+ visitor.visit(node.body);
+ Map mapping = visitor.mapping.map;
+
+ Send superCall = node.body.asReturn().expression;
+ FunctionElement called = mapping[superCall];
+ Expect.isTrue(called !== null);
+ Expect.equals(fooA, called);
}
testThis() {
@@ -402,7 +427,7 @@ testTopLevelFields() {
Element element = compiler.universe.find(buildSourceString("a"));
Expect.equals(ElementKind.FIELD, element.kind);
VariableDefinitions node = element.variables.parseNode(compiler, compiler);
- Expect.equals(node.type.typeName.source.stringValue, 'int');
+ Expect.equals(node.type.typeName.asIdentifier().source.stringValue, 'int');
compiler.parseScript("var b, c;");
Element bElement = compiler.universe.find(buildSourceString("b"));

Powered by Google App Engine
This is Rietveld 408576698