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

Unified Diff: compiler/java/com/google/dart/compiler/backend/js/TranslationContext.java

Issue 8659022: Puts JsScope on a diet (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changed the strategy to only walk a specific class when TranslationContext is created 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
Index: compiler/java/com/google/dart/compiler/backend/js/TranslationContext.java
diff --git a/compiler/java/com/google/dart/compiler/backend/js/TranslationContext.java b/compiler/java/com/google/dart/compiler/backend/js/TranslationContext.java
index 19fe3af30d44e735adaa7cd61907d1643f511ef1..6240e61857faa69dc539e46d416e075c7e848fe9 100644
--- a/compiler/java/com/google/dart/compiler/backend/js/TranslationContext.java
+++ b/compiler/java/com/google/dart/compiler/backend/js/TranslationContext.java
@@ -5,6 +5,7 @@
package com.google.dart.compiler.backend.js;
import com.google.dart.compiler.ast.DartFunction;
+import com.google.dart.compiler.ast.DartNode;
import com.google.dart.compiler.ast.DartUnit;
import com.google.dart.compiler.backend.js.ast.JsFunction;
import com.google.dart.compiler.backend.js.ast.JsProgram;
@@ -52,11 +53,26 @@ public class TranslationContext {
return program;
}
+ /**
+ *
+ * @param unit Unit to create translation context for
+ * @param program
+ * @param mangler
+ * @param filterNode If not null, create names for this node only.
+ * @return
+ */
public static TranslationContext createContext(DartUnit unit, JsProgram program,
- DartMangler mangler) {
+ DartMangler mangler, DartNode filterNode) {
TranslationContext translationContext = new TranslationContext(program, mangler);
LibraryElement unitLibrary = unit.getLibrary().getElement();
- new GenerateNamesAndScopes(translationContext, unitLibrary).accept(unit);
+ GenerateNamesAndScopes visitor = new GenerateNamesAndScopes(translationContext, unitLibrary);
+ if (filterNode != null) {
+ visitor.accept(filterNode);
+ } else {
+ visitor.accept(unit);
+ }
return translationContext;
}
+
+
}

Powered by Google App Engine
This is Rietveld 408576698