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

Unified Diff: compiler/javatests/com/google/dart/compiler/backend/js/analysis/DependencyComputerTest.java

Issue 8659041: Fix recursion bug when adding members to native JS objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address offline comment about parens Created 9 years, 1 month 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/java/com/google/dart/compiler/backend/js/analysis/DependencyComputer.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/backend/js/analysis/DependencyComputerTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/backend/js/analysis/DependencyComputerTest.java b/compiler/javatests/com/google/dart/compiler/backend/js/analysis/DependencyComputerTest.java
index c62030bc2cc79c62221e80d9df6164cc44b4b8fb..595067c919c298495f783eb1d2847fa88e4dd517 100644
--- a/compiler/javatests/com/google/dart/compiler/backend/js/analysis/DependencyComputerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/backend/js/analysis/DependencyComputerTest.java
@@ -54,6 +54,30 @@ public class DependencyComputerTest extends TestCase {
}
/**
+ * Tests that we can find dependencies to methods added to the prototype chain of native objects.
+ */
+ public void testNativeDependencies() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("function A() {}\n");
+ sb.append("A.prototype.foo = function() {}\n");
+ sb.append("Array.prototype.foo = function() {}\n");
+ sb.append("function execute() { Array.prototype.foo.call(); }");
+
+ AstRoot astRoot = parser.parse(sb.toString(), "", 1);
+ astRoot.visit(topLevelElementIndexer);
+ AstNode executeFunction = (AstNode) astRoot.getLastChild();
+ List<JavascriptElement> computedDependencies =
+ dependencyComputer.computeDependencies(executeFunction);
+ assertNotNull(computedDependencies);
+
+ /*
+ * The foo method is added to the native Array object's prototype directly, ensure that we found
+ * it.
+ */
+ assertEquals(1, computedDependencies.size());
+ }
+
+ /**
* Tests that we do add a virtual dependency to a member of an instantiated
* class even though its name is shadowed by a local variable.
*/
« no previous file with comments | « compiler/java/com/google/dart/compiler/backend/js/analysis/DependencyComputer.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698