Opened 7 months ago

#19103 new enhancement

Please apply patch to support new rhino

Reported by: broucari Owned by: mikeb
Priority: major Milestone:
Component: Accessibility Version:
Keywords: Cc:
Blocked By: Blocking:

Description

Hi,

Debian carry this patch to support newer rhino

Description: Compatibility patch for Rhino 1.7R3.
Author: James Page <james.page@ubuntu.com>
Forwarded: no
--- a/src/org/dojotoolkit/shrinksafe/Compressor.java
+++ b/src/org/dojotoolkit/shrinksafe/Compressor.java
@@ -35,11 +35,13 @@
 
 import org.mozilla.javascript.CompilerEnvirons;
 import org.mozilla.javascript.Decompiler;
-import org.mozilla.javascript.FunctionNode;
+import org.mozilla.javascript.ast.FunctionNode;
 import org.mozilla.javascript.Interpreter;
 import org.mozilla.javascript.Kit;
 import org.mozilla.javascript.Parser;
-import org.mozilla.javascript.ScriptOrFnNode;
+import org.mozilla.javascript.IRFactory;
+import org.mozilla.javascript.ast.ScriptNode;
+import org.mozilla.javascript.ast.AstRoot;
 import org.mozilla.javascript.ScriptRuntime;
 import org.mozilla.javascript.Token;
 import org.mozilla.javascript.UintMap;
@@ -64,7 +66,7 @@
     private static String compress(String encodedSource, 
     		                       int flags, 
     		                       UintMap properties, 
-    		                       ScriptOrFnNode parseTree, 
+    		                       ScriptNode parseTree, 
     		                       boolean escapeUnicode,
     		                       String stripConsole,
     		                       TokenMapper tm,
@@ -983,11 +985,13 @@
         CompilerEnvirons compilerEnv = new CompilerEnvirons();
 
         Parser parser = new Parser(compilerEnv, compilerEnv.getErrorReporter());
-        
-        ScriptOrFnNode tree = parser.parse(source, null, lineno);
-        String encodedSource = parser.getEncodedSource();
-   	 	if (encodedSource.length() == 0) { return ""; }
-   	 	
+        IRFactory irFactory = new IRFactory(compilerEnv, compilerEnv.getErrorReporter());
+
+        AstRoot parsedTree = parser.parse(source, null, lineno);
+        ScriptNode tree = irFactory.transformTree(parsedTree);
+        String encodedSource = tree.getEncodedSource();
+        if ( encodedSource.length() == 0 )  {  return ""; }
+
         Interpreter compiler = new Interpreter();
         compiler.compile(compilerEnv, tree, encodedSource, false);
         UintMap properties = new UintMap(1);
--- a/src/org/dojotoolkit/shrinksafe/TokenMapper.java
+++ b/src/org/dojotoolkit/shrinksafe/TokenMapper.java
@@ -32,7 +32,7 @@
 import java.util.List;
 import java.util.Map;
 
-import org.mozilla.javascript.ScriptOrFnNode;
+import org.mozilla.javascript.ast.ScriptNode;
 import org.mozilla.javascript.ScriptRuntime;
 import org.mozilla.javascript.Token;
 
@@ -58,7 +58,7 @@
 
 	private int lastTokenCount = 0;
 	
-	public TokenMapper(ScriptOrFnNode parseTree) {
+	public TokenMapper(ScriptNode parseTree) {
 		collectFunctionMappings(parseTree);
 	}
 
@@ -170,7 +170,7 @@
 	 *            Mapping for each function node and corresponding parameters &
 	 *            variables names
 	 */
-	private void collectFunctionMappings(ScriptOrFnNode parseTree) {
+	private void collectFunctionMappings(ScriptNode parseTree) {
 		int level = -1;
 		collectFuncNodes(parseTree, level, null);
 	}
@@ -185,7 +185,7 @@
 	 * @param level
 	 *            scoping level
 	 */
-	private void collectFuncNodes(ScriptOrFnNode parseTree, int level, ScriptOrFnNode parent) {
+	private void collectFuncNodes(ScriptNode parseTree, int level, ScriptNode parent) {
 		level++;
 		
         DebugData debugData = new DebugData();


Change History (0)

Note: See TracTickets for help on using tickets.