| Index: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
|
| diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
|
| index cd9905eb2497fe008a269513540e2bf53ccf5cc4..735a031d09c224df8661b80a487bd28daa261fcf 100644
|
| --- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
|
| +++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
|
| @@ -11,6 +11,7 @@ import com.google.common.collect.Iterables;
|
| import com.google.dart.compiler.CompilerTestCase;
|
| import com.google.dart.compiler.DartCompilationError;
|
| import com.google.dart.compiler.ast.DartClass;
|
| +import com.google.dart.compiler.ast.DartExprStmt;
|
| import com.google.dart.compiler.ast.DartExpression;
|
| import com.google.dart.compiler.ast.DartField;
|
| import com.google.dart.compiler.ast.DartFieldDefinition;
|
| @@ -23,6 +24,8 @@ import com.google.dart.compiler.ast.DartNode;
|
| import com.google.dart.compiler.ast.DartNodeTraverser;
|
| import com.google.dart.compiler.ast.DartParameter;
|
| import com.google.dart.compiler.ast.DartUnit;
|
| +import com.google.dart.compiler.ast.DartUnqualifiedInvocation;
|
| +import com.google.dart.compiler.common.Symbol;
|
| import com.google.dart.compiler.parser.ParserErrorCode;
|
| import com.google.dart.compiler.resolver.ClassElement;
|
| import com.google.dart.compiler.resolver.Element;
|
| @@ -561,4 +564,35 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
|
| DartField field = fieldDefinition.getFields().get(0);
|
| return field.getValue();
|
| }
|
| +
|
| + public void test_bindToLibraryFunctionFirst() throws Exception {
|
| + AnalyzeLibraryResult libraryResult =
|
| + analyzeLibrary(
|
| + getName(),
|
| + makeCode(
|
| + "// filler filler filler filler filler filler filler filler filler filler",
|
| + "foo() {}",
|
| + "class A {",
|
| + " foo() {}",
|
| + "}",
|
| + "class B extends A {",
|
| + " bar() {",
|
| + " foo();",
|
| + " }",
|
| + "}",
|
| + ""));
|
| + DartUnit unit = libraryResult.getLibraryUnitResult().getUnit(getName());
|
| + // Find foo() invocation.
|
| + DartUnqualifiedInvocation invocation;
|
| + {
|
| + DartClass classB = (DartClass) unit.getTopLevelNodes().get(2);
|
| + DartMethodDefinition methodBar = (DartMethodDefinition) classB.getMembers().get(0);
|
| + DartExprStmt stmt = (DartExprStmt) methodBar.getFunction().getBody().getStatements().get(0);
|
| + invocation = (DartUnqualifiedInvocation) stmt.getExpression();
|
| + }
|
| + // Check that unqualified foo() invocation is resolved to the top-level (library) function.
|
| + Symbol symbol = invocation.getTarget().getSymbol();
|
| + assertNotNull(symbol);
|
| + assertSame(unit, symbol.getNode().getParent());
|
| + }
|
| }
|
|
|