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

Unified Diff: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java

Issue 9148026: Recompile unit with potential conflict/dependency on some top-level symbol. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase and merge 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
« no previous file with comments | « compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
+ }
}
« no previous file with comments | « compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698