Permalink
Browse files

Move the compressor to Rhino 1.7R2. This fixes the build.xml to point…

… to the new

jar, adds the new jar under the lib/, removes the old jar, makes YUI's
JavaScriptCompressor.java aware of "let" and "yield" by setting the env to 1.7 by
default, and adds the Rhino 1.7 changes to the src/org/mozilla/javascript tree.
  • Loading branch information...
1 parent ed236d6 commit 54f3bf2cb7d64e2ba22dca2c52917aa0cbc9095c @tml tml committed Apr 18, 2011
View
@@ -20,10 +20,10 @@
includes="**/*.java"
deprecation="off"
debug="on"
- source="1.4">
+ source="1.6">
<classpath>
<pathelement location="${lib.dir}/jargs-1.0.jar"/>
- <pathelement location="${lib.dir}/rhino-1.6R7.jar"/>
+ <pathelement location="${lib.dir}/rhino-1.7R2.jar"/>
</classpath>
</javac>
</target>
@@ -33,7 +33,7 @@
<!-- The order is important here. Rhino MUST be unjarred first!
(some of our own classes will override the Rhino classes) -->
<unjar src="${lib.dir}/jargs-1.0.jar" dest="${build.dir}/jar"/>
- <unjar src="${lib.dir}/rhino-1.6R7.jar" dest="${build.dir}/jar"/>
+ <unjar src="${lib.dir}/rhino-1.7R2.jar" dest="${build.dir}/jar"/>
<copy todir="${build.dir}/jar">
<fileset dir="${build.dir}/classes" includes="**/*.class"/>
</copy>
@@ -63,4 +63,4 @@
includes="${dist.package.name}/**/*"/>
</target>
-</project>
+</project>
View
Binary file not shown.
View
Binary file not shown.
@@ -170,6 +170,8 @@
literals.put(new Integer(Token.DOTDOT), "..");
literals.put(new Integer(Token.DOTQUERY), ".(");
literals.put(new Integer(Token.XMLATTR), "@");
+ literals.put(new Integer(Token.LET), "let ");
+ literals.put(new Integer(Token.YIELD), "yield ");
// See http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Reserved_Words
@@ -308,6 +310,7 @@ private static ArrayList parse(Reader in, ErrorReporter reporter)
throws IOException, EvaluatorException {
CompilerEnvirons env = new CompilerEnvirons();
+ env.setLanguageVersion(Context.VERSION_1_7);
Parser parser = new Parser(env, reporter);
parser.parse(in, null, 1);
String source = parser.getEncodedSource();
@@ -588,6 +588,10 @@ else if (nextToken == Token.NAME) {
result.append("var ");
break;
+ case Token.LET:
+ result.append("let ");
+ break;
+
case Token.SEMI:
result.append(';');
if (Token.EOL != getNext(source, length, i)) {
@@ -745,7 +749,11 @@ else if (nextToken == Token.NAME) {
case Token.CONST:
result.append("const ");
break;
-
+
+ case Token.YIELD:
+ result.append("yield ");
+ break;
+
case Token.NOT:
result.append('!');
break;
Oops, something went wrong.

0 comments on commit 54f3bf2

Please sign in to comment.