r9725 - helma-ng/trunk/lib

[email protected] Tue, 12 May 2009 11:51:45 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090512095145.C39943D0D6@mia>
Author: hannes
Date: 2009-05-12 11:51:45 +0200 (Tue, 12 May 2009)
New Revision: 9725

Modified:
   helma-ng/trunk/lib/js.jar
   helma-ng/trunk/lib/rhino-patch.diff
Log:
Update rhino to CVS HEAD with minimal workaround patch for bug 492036

Details at http://dev.helma.org/trac/helma/changeset/9725

Modified: helma-ng/trunk/lib/js.jar
===================================================================
(Binary files differ)

Modified: helma-ng/trunk/lib/rhino-patch.diff
===================================================================
--- helma-ng/trunk/lib/rhino-patch.diff	2009-05-10 09:28:27 UTC (rev 9724)
+++ helma-ng/trunk/lib/rhino-patch.diff	2009-05-12 09:51:45 UTC (rev 9725)
@@ -1,940 +1,31 @@
-Index: src/org/mozilla/javascript/Context.java
+Index: src/org/mozilla/javascript/IRFactory.java
 ===================================================================
-RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Context.java,v
-retrieving revision 1.275.2.2
-diff -u -r1.275.2.2 Context.java
---- src/org/mozilla/javascript/Context.java	5 Nov 2008 21:22:50 -0000	1.275.2.2
-+++ src/org/mozilla/javascript/Context.java	20 Nov 2008 10:58:15 -0000
-@@ -142,6 +142,11 @@
-     public static final int VERSION_1_7 =      170;
- 
-     /**
-+     * JavaScript 1.8
-+     */
-+    public static final int VERSION_1_8 =      180;
-+
-+    /**
-      * Controls behaviour of <tt>Date.prototype.getYear()</tt>.
-      * If <tt>hasFeature(FEATURE_NON_ECMA_GET_YEAR)</tt> returns true,
-      * Date.prototype.getYear subtructs 1900 only if 1900 <= date < 2000.
-@@ -667,6 +672,7 @@
-             case VERSION_1_5:
-             case VERSION_1_6:
-             case VERSION_1_7:
-+            case VERSION_1_8:
-                 return true;
-         }
-         return false;
-Index: src/org/mozilla/javascript/ContextFactory.java
-===================================================================
-RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/ContextFactory.java,v
-retrieving revision 1.32
-diff -u -r1.32 ContextFactory.java
---- src/org/mozilla/javascript/ContextFactory.java	27 Aug 2008 15:23:59 -0000	1.32
-+++ src/org/mozilla/javascript/ContextFactory.java	20 Nov 2008 10:58:15 -0000
-@@ -253,7 +253,7 @@
-             return false;
- 
-           case Context.FEATURE_RESERVED_KEYWORD_AS_IDENTIFIER:
--            return false;
-+            return true;
- 
-           case Context.FEATURE_TO_STRING_AS_SOURCE:
-             version = cx.getLanguageVersion();
-Index: src/org/mozilla/javascript/Decompiler.java
-===================================================================
-RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Decompiler.java,v
-retrieving revision 1.25
-diff -u -r1.25 Decompiler.java
---- src/org/mozilla/javascript/Decompiler.java	11 Jul 2007 16:00:00 -0000	1.25
-+++ src/org/mozilla/javascript/Decompiler.java	20 Nov 2008 10:58:16 -0000
-@@ -106,6 +106,9 @@
-     // the last RC of object literals in case of function expressions
-     private static final int FUNCTION_END = Token.LAST_TOKEN + 1;
- 
-+    // Marker to denote that a function closes over a single expression as body
-+    private static final int FUNCTION_BODY_EXPRESSION = Token.LAST_TOKEN + 2;
-+
-     String getEncodedSource()
-     {
-         return sourceToString(0);
-@@ -131,6 +134,10 @@
-         return offset;
-     }
- 
-+    void markFunctionAsExpressionClosure() {
-+        append((char)FUNCTION_BODY_EXPRESSION);
-+    }
-+
-     void addToken(int token)
-     {
-         if (!(0 <= token && token <= Token.LAST_TOKEN))
-@@ -397,6 +404,10 @@
-                 result.append("function ");
-                 break;
- 
-+            case FUNCTION_BODY_EXPRESSION:
-+                result.append(' ');
-+                break;
-+
-             case FUNCTION_END:
-                 // Do nothing
-                 break;
-Index: src/org/mozilla/javascript/JavaAdapter.java
-===================================================================
-RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/JavaAdapter.java,v
-retrieving revision 1.116
-diff -u -r1.116 JavaAdapter.java
---- src/org/mozilla/javascript/JavaAdapter.java	22 Jul 2008 18:49:41 -0000	1.116
-+++ src/org/mozilla/javascript/JavaAdapter.java	20 Nov 2008 10:58:16 -0000
-@@ -204,7 +204,14 @@
-         try {
-             Object adapter = adapterClass.getConstructor(ctorParms).
-                                  newInstance(ctorArgs);
--            return getAdapterSelf(adapterClass, adapter);
-+            Object self = getAdapterSelf(adapterClass, adapter);
-+            if (self instanceof Wrapper) {
-+                Object unwrapped = ((Wrapper) self).unwrap();
-+                if (unwrapped instanceof Scriptable) {
-+                    return unwrapped;
-+                }
-+            }
-+            return self;
-         } catch (Exception ex) {
-             throw Context.throwAsScriptRuntimeEx(ex);
-         }
-Index: src/org/mozilla/javascript/JavaScriptException.java
-===================================================================
-RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/JavaScriptException.java,v
-retrieving revision 1.24
-diff -u -r1.24 JavaScriptException.java
---- src/org/mozilla/javascript/JavaScriptException.java	25 Mar 2008 14:32:26 -0000	1.24
-+++ src/org/mozilla/javascript/JavaScriptException.java	20 Nov 2008 10:58:16 -0000
-@@ -82,6 +82,8 @@
-            // ScriptRuntime.toString may throw a RuntimeException
-            if (value == null) {
-                return "null";
-+           } else if (value instanceof NativeError) {
-+               return value.toString();
-            } else if (value instanceof Scriptable) {
-                return ScriptRuntime.defaultObjectToString((Scriptable)value);
-            } else {
-Index: src/org/mozilla/javascript/NativeArray.java
-===================================================================
-RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/NativeArray.java,v
-retrieving revision 1.93
-diff -u -r1.93 NativeArray.java
---- src/org/mozilla/javascript/NativeArray.java	8 Aug 2008 19:45:36 -0000	1.93
-+++ src/org/mozilla/javascript/NativeArray.java	20 Nov 2008 10:58:16 -0000
-@@ -187,6 +187,10 @@
-                 "map", 2);
-         addIdFunctionProperty(ctor, ARRAY_TAG, ConstructorId_some,
-                 "some", 2);
-+        addIdFunctionProperty(ctor, ARRAY_TAG, ConstructorId_reduce,
-+                "reduce", 2);
-+        addIdFunctionProperty(ctor, ARRAY_TAG, ConstructorId_reduceRight,
-+                "reduceRight", 2);
-         super.fillConstructorProperties(ctor);
-     }
- 
-@@ -217,6 +221,8 @@
-           case Id_forEach:        arity=1; s="forEach";        break;
-           case Id_map:            arity=1; s="map";            break;
-           case Id_some:           arity=1; s="some";           break;
-+          case Id_reduce:         arity=1; s="reduce";         break;
-+          case Id_reduceRight:    arity=1; s="reduceRight";    break;
-           default: throw new IllegalArgumentException(String.valueOf(id));
-         }
-         initPrototypeMethod(ARRAY_TAG, id, s, arity);
-@@ -249,7 +255,9 @@
-               case ConstructorId_filter:
-               case ConstructorId_forEach:
-               case ConstructorId_map:
--              case ConstructorId_some: {
-+              case ConstructorId_some:
-+              case ConstructorId_reduce:
-+              case ConstructorId_reduceRight: {
-                 thisObj = ScriptRuntime.toObject(scope, args[0]);
-                 Object[] newArgs = new Object[args.length-1];
-                 for (int i=0; i < newArgs.length; i++)
-@@ -320,6 +328,9 @@
-               case Id_map:
-               case Id_some:
-                 return iterativeMethod(cx, id, scope, thisObj, args);
-+              case Id_reduce:
-+              case Id_reduceRight:
-+                return reduceMethod(cx, id, scope, thisObj, args);
-             }
-             throw new IllegalArgumentException(String.valueOf(id));
-         }
-@@ -634,6 +645,15 @@
-         }
-     }
- 
-+    // same as getElem, but without converting NOT_FOUND to undefined
-+    private static Object getRawElem(Scriptable target, long index) {
-+        if (index > Integer.MAX_VALUE) {
-+            return ScriptableObject.getProperty(target, Long.toString(index));
-+        } else {
-+            return ScriptableObject.getProperty(target, (int) index);
-+        }
-+    }
-+
-     private static void setElem(Context cx, Scriptable target, long index,
-                                 Object value)
-     {
-@@ -1552,8 +1572,7 @@
-     {
-         Object callbackArg = args.length > 0 ? args[0] : Undefined.instance;
-         if (callbackArg == null || !(callbackArg instanceof Function)) {
--            throw ScriptRuntime.notFunctionError(
--                     ScriptRuntime.toString(callbackArg));
-+            throw ScriptRuntime.notFunctionError(callbackArg);
-         }
-         Function f = (Function) callbackArg;
-         Scriptable parent = ScriptableObject.getTopLevelScope(f);
-@@ -1569,9 +1588,7 @@
-         long j=0;
-         for (long i=0; i < length; i++) {
-             Object[] innerArgs = new Object[3];
--            Object elem = (i > Integer.MAX_VALUE)
--                ? ScriptableObject.getProperty(thisObj, Long.toString(i))
--                : ScriptableObject.getProperty(thisObj, (int)i);
-+            Object elem = getRawElem(thisObj, i);
-             if (elem == Scriptable.NOT_FOUND) {
-                 continue;
-             }
-@@ -1613,6 +1630,46 @@
-         }
-     }
- 
-+    /**
-+     * Implements the methods "reduce" and "reduceRight".
-+     */
-+    private Object reduceMethod(Context cx, int id, Scriptable scope,
-+                                   Scriptable thisObj, Object[] args)
-+    {
-+        Object callbackArg = args.length > 0 ? args[0] : Undefined.instance;
-+        if (callbackArg == null || !(callbackArg instanceof Function)) {
-+            throw ScriptRuntime.notFunctionError(callbackArg);
-+        }
-+        Function f = (Function) callbackArg;
-+        Scriptable parent = ScriptableObject.getTopLevelScope(f);
-+        long length = getLengthProperty(cx, thisObj);
-+        // offset hack to serve both reduce and reduceRight with the same loop
-+        long offset = id == Id_reduceRight ? length - 1 : 0;
-+        Object value = args.length > 1 ? args[1] : Scriptable.NOT_FOUND;
-+        for (long i = 0; i < length; i++) {
-+            Object elem = getRawElem(thisObj, Math.abs(i - offset));
-+            if (elem == Scriptable.NOT_FOUND) {
-+                continue;
-+            }
-+            if (value == Scriptable.NOT_FOUND) {
-+                // no initial value passed, use first element found as inital value
-+                value = elem;
-+            } else {
-+                Object[] innerArgs = new Object[4];
-+                innerArgs[0] = value;
-+                innerArgs[1] = elem;
-+                innerArgs[2] = new Long(i);
-+                innerArgs[3] = thisObj;
-+                value = f.call(cx, parent, parent, innerArgs);
-+            }
-+        }
-+        if (value == Scriptable.NOT_FOUND) {
-+            // reproduce spidermonkey error message
-+            throw Context.reportRuntimeError0("msg.empty.array.reduce");
-+        }
-+        return value;
-+    }
-+
- // #string_id_map#
- 
-     @Override
-@@ -1641,6 +1698,7 @@
-                 if (c=='c') { X="concat";id=Id_concat; }
-                 else if (c=='f') { X="filter";id=Id_filter; }
-                 else if (c=='s') { X="splice";id=Id_splice; }
-+                else if (c=='r') { X="reduce";id=Id_reduce; }
-                 break L;
-             case 7: switch (s.charAt(0)) {
-                 case 'f': X="forEach";id=Id_forEach; break L;
-@@ -1655,6 +1713,7 @@
-             case 11: c=s.charAt(0);
-                 if (c=='c') { X="constructor";id=Id_constructor; }
-                 else if (c=='l') { X="lastIndexOf";id=Id_lastIndexOf; }
-+                else if (c=='r') { X="reduceRight";id=Id_reduceRight; }
-                 break L;
-             case 14: X="toLocaleString";id=Id_toLocaleString; break L;
-             }
-@@ -1686,8 +1745,10 @@
-         Id_forEach              = 19,
-         Id_map                  = 20,
-         Id_some                 = 21,
-+        Id_reduce               = 22,
-+        Id_reduceRight          = 23,
- 
--        MAX_PROTOTYPE_ID        = 21;
-+        MAX_PROTOTYPE_ID        = 23;
- 
- // #/string_id_map#
-     
-@@ -1708,7 +1769,9 @@
-         ConstructorId_filter               = -Id_filter,
-         ConstructorId_forEach              = -Id_forEach,
-         ConstructorId_map                  = -Id_map,
--        ConstructorId_some                 = -Id_some;
-+        ConstructorId_some                 = -Id_some,
-+        ConstructorId_reduce               = -Id_reduce,
-+        ConstructorId_reduceRight          = -Id_reduceRight;
- 
-     /**
-      * Internal representation of the JavaScript array's length property.
-Index: src/org/mozilla/javascript/NativeJavaTopPackage.java
-===================================================================
-RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/NativeJavaTopPackage.java,v
-retrieving revision 1.20.2.1
-diff -u -r1.20.2.1 NativeJavaTopPackage.java
---- src/org/mozilla/javascript/NativeJavaTopPackage.java	5 Nov 2008 21:22:52 -0000	1.20.2.1
-+++ src/org/mozilla/javascript/NativeJavaTopPackage.java	20 Nov 2008 10:58:16 -0000
-@@ -98,7 +98,9 @@
-             Context.reportRuntimeError0("msg.not.classloader");
-             return null;
-         }
--        return new NativeJavaPackage(true, "", loader);
-+        NativeJavaPackage pkg = new NativeJavaPackage(true, "", loader);
-+        ScriptRuntime.setObjectProtoAndParent(pkg, scope);
-+        return pkg;        
-     }
- 
-     public static void init(Context cx, Scriptable scope, boolean sealed)
-@@ -108,7 +110,7 @@
-         top.setPrototype(getObjectPrototype(scope));
-         top.setParentScope(scope);
- 
--        for (int i = 0; i != commonPackages.length; i++) {
-+        for (int i = 0; i != commonPackages.length; ++i) {
-             NativeJavaPackage parent = top;
-             for (int j = 0; j != commonPackages[i].length; j++) {
-                 parent = parent.forcePackage(commonPackages[i][j], scope);
-Index: src/org/mozilla/javascript/NativeString.java
-===================================================================
-RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/NativeString.java,v
-retrieving revision 1.62
-diff -u -r1.62 NativeString.java
---- src/org/mozilla/javascript/NativeString.java	22 Jul 2008 18:49:42 -0000	1.62
-+++ src/org/mozilla/javascript/NativeString.java	20 Nov 2008 10:58:16 -0000
-@@ -465,6 +465,26 @@
-         super.put(index, start, value);
-     }
- 
-+    @Override
-+    public boolean has(int index, Scriptable start) {
-+        return 0 <= index && index < string.length();
-+    }
-+
-+    @Override
-+    Object[] getIds(boolean getAll) {
-+        Object[] superIds = super.getIds(getAll);
-+        int length = string.length();
-+        if (length == 0) {
-+            return superIds;
-+        }
-+        Object[] ids = new Object[superIds.length + length];
-+        for (int i = 0; i < length; i++) {
-+            ids[i] = new Integer(i);
-+        }
-+        System.arraycopy(superIds, 0, ids, length, superIds.length);
-+        return ids;
-+    }
-+
-     /*
-      *
-      * See ECMA 15.5.4.6.  Uses Java String.indexOf()
-Index: src/org/mozilla/javascript/Node.java
-===================================================================
-RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Node.java,v
-retrieving revision 1.75
-diff -u -r1.75 Node.java
---- src/org/mozilla/javascript/Node.java	22 May 2008 20:42:31 -0000	1.75
-+++ src/org/mozilla/javascript/Node.java	20 Nov 2008 10:58:16 -0000
-@@ -1114,8 +1114,6 @@
-           case Token.SEMI:
-           case Token.INC:
-           case Token.DEC:
--          case Token.EXPORT:
--          case Token.IMPORT:
-           case Token.IF:
-           case Token.ELSE:
-           case Token.SWITCH:
+RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/IRFactory.java,v
+retrieving revision 1.122
+diff -u -r1.122 IRFactory.java
+--- src/org/mozilla/javascript/IRFactory.java	3 Mar 2009 16:02:09 -0000	1.122
++++ src/org/mozilla/javascript/IRFactory.java	8 May 2009 20:46:17 -0000
+@@ -398,7 +398,7 @@
+             // Bug: for code like "var obj={p:3};[obj.p]=[9];", "left" will
+             // be ARRAYLITERAL with an embedded GETPROP. This causes errors
+             // at codegen.
+-            Kit.codeBug();
++            // Kit.codeBug();
+             target = left;
+         } else {
+             target = transform(left);
 Index: src/org/mozilla/javascript/Parser.java
 ===================================================================
 RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Parser.java,v
-retrieving revision 1.128
-diff -u -r1.128 Parser.java
---- src/org/mozilla/javascript/Parser.java	16 May 2008 21:13:01 -0000	1.128
-+++ src/org/mozilla/javascript/Parser.java	20 Nov 2008 10:58:16 -0000
-@@ -85,6 +85,8 @@
- 
-     private int nestingOfFunction;
- 
-+    private boolean inDestructuringAssignment;
-+
-     private Decompiler decompiler;
-     private String encodedSource;
- 
-@@ -474,6 +476,21 @@
-         return pn;
-     }
- 
-+    private Node parseExpressionClosureExpr()
-+        throws IOException
-+    {
-+        ++nestingOfFunction;
-+        int lineno = ts.getLineno();
-+        Node n = nf.createBlock(lineno);
-+        try {
-+            decompiler.markFunctionAsExpressionClosure();
-+            nf.addChildToBack(n, nf.createReturn(assignExpr(false), lineno));
-+        } finally {
-+            --nestingOfFunction;
-+        }
-+        return n;
-+    }
-+
-     private Node function(int functionType)
-         throws IOException, ParserException
-     {
-@@ -551,7 +568,7 @@
-         int savedFunctionEndFlags = endFlags;
-         endFlags = 0;
- 
--        Node destructuring = null;
-+        Map<String,Node> destructuring = null;
-         Node body;
-         try {
-             decompiler.addToken(Token.LP);
-@@ -567,14 +584,12 @@
-                         // dummy parameter name, and add a statement to the
-                         // body to initialize variables from the destructuring
-                         // assignment
--                        if (destructuring == null) {
--                            destructuring = new Node(Token.COMMA);
--                        }
-                         String parmName = currentScriptOrFn.getNextTempName();
-                         defineSymbol(Token.LP, false, parmName);
--                        destructuring.addChildToBack(
--                            nf.createDestructuringAssignment(Token.VAR,
--                                primaryExpr(), nf.createName(parmName)));
-+                        if (destructuring == null) {
-+                            destructuring = new HashMap<String,Node>();
-+                        }
-+                        destructuring.put(parmName, primaryExpr());
-                     } else {
-                         mustMatchToken(Token.NAME, "msg.no.parm");
-                         String s = ts.getString();
-@@ -587,14 +602,29 @@
-             }
-             decompiler.addToken(Token.RP);
- 
--            mustMatchToken(Token.LC, "msg.no.brace.body");
--            decompiler.addEOL(Token.LC);
--            body = parseFunctionBody();
-+            if (matchToken(Token.LC)) {
-+                decompiler.addEOL(Token.LC);
-+                body = parseFunctionBody();
-+                mustMatchToken(Token.RC, "msg.no.brace.after.body");
-+                decompiler.addToken(Token.RC);
-+            } else {
-+                if (compilerEnv.getLanguageVersion() < Context.VERSION_1_8) {
-+                    reportError("msg.no.brace.body");
-+                }
-+                body = parseExpressionClosureExpr();
-+            }
-+
-             if (destructuring != null) {
--                body.addChildToFront(
--                    new Node(Token.EXPR_VOID, destructuring, ts.getLineno()));
-+                // Add assignment helper for each destructuring parameter
-+                for (String parmName: destructuring.keySet()) {
-+                    Node da = nf.createDestructuringAssignment(Token.VAR,
-+                            destructuring.get(parmName),
-+                            nf.createName(parmName));
-+                    body.addChildToFront(new Node(Token.EXPR_VOID, da,
-+                            ts.getLineno()));
-+                }
-             }
--            mustMatchToken(Token.RC, "msg.no.brace.after.body");
-+            // mustMatchToken(Token.RC, "msg.no.brace.after.body");
- 
-             if (compilerEnv.isStrictMode() && !body.hasConsistentReturnUsage())
-             {
-@@ -611,7 +641,7 @@
-                 defineSymbol(Token.FUNCTION, false, name);
-             }
-             
--            decompiler.addToken(Token.RC);
-+            // decompiler.addToken(Token.RC);
-             functionSourceEnd = decompiler.markFunctionEnd(functionSourceStart);
-             if (functionType != FunctionNode.FUNCTION_EXPRESSION) {
-                 // Add EOL only if function is not part of expression
-@@ -1374,7 +1404,7 @@
-             int tt = peekToken();
-             if (tt == Token.LB || tt == Token.LC) {
-                 // Destructuring assignment, e.g., var [a,b] = ...
--                destructuring = primaryExpr();
-+                destructuring = destructuringPrimaryExpr();
-             } else {
-                 // Simple variable name
-                 mustMatchToken(Token.NAME, "msg.bad.var");
-@@ -2163,28 +2193,23 @@
-         mustMatchToken(Token.LP, "msg.no.paren.for");
-         decompiler.addToken(Token.LP);
-         String name;
-+        Node init;
-         int tt = peekToken();
-         if (tt == Token.LB || tt == Token.LC) {
-             // handle destructuring assignment
--            name = currentScriptOrFn.getNextTempName();
--            defineSymbol(Token.LP, false, name);
--            expr = nf.createBinary(Token.COMMA,
--                nf.createAssignment(Token.ASSIGN, primaryExpr(), 
--                                    nf.createName(name)),
--                expr);
-+            init = variables(true, Token.LET);
-         } else if (tt == Token.NAME) {
-             consumeToken();
-             name = ts.getString();
-             decompiler.addName(name);
-+            // Define as a let since we want the scope of the variable to
-+            // be restricted to the array comprehension
-+            init = nf.createName(name);
-+            defineSymbol(Token.LET, false, name);            
-         } else {
-             reportError("msg.bad.var");
-             return nf.createNumber(0);
-         }
--
--        Node init = nf.createName(name);
--        // Define as a let since we want the scope of the variable to
--        // be restricted to the array comprehension
--        defineSymbol(Token.LET, false, name);
-         
-         mustMatchToken(Token.IN, "msg.in.after.for.name");
-         decompiler.addToken(Token.IN);
-@@ -2221,7 +2246,18 @@
-             exitLoop(false);
-         }
-     }
--    
-+
-+    private Node destructuringPrimaryExpr()
-+        throws IOException, ParserException
-+    {
-+        try {
-+            inDestructuringAssignment = true;
-+            return primaryExpr();
-+        } finally {
-+            inDestructuringAssignment = false;
-+        }
-+    }
-+
-     private Node primaryExpr()
-         throws IOException, ParserException
-     {
-@@ -2352,7 +2388,7 @@
-                             decompiler.addString(s);
-                         }
-                         property = ScriptRuntime.getIndexObject(s);
--                        plainProperty(elems, property);
-+                        plainProperty(elems, property, tt);
-                         break;
- 
-                       case Token.NUMBER:
-@@ -2360,7 +2396,7 @@
-                         double n = ts.getNumber();
-                         decompiler.addNumber(n);
-                         property = ScriptRuntime.getIndexObject(n);
--                        plainProperty(elems, property);
-+                        plainProperty(elems, property, tt);
-                         break;
- 
-                       case Token.RC:
-@@ -2472,8 +2508,27 @@
-         return null;    // should never reach here
-     }
- 
--    private void plainProperty(ObjArray elems, Object property)
-+    private void plainProperty(ObjArray elems, Object property, int ptt)
-             throws IOException {
-+        // Support, e.g., |var {x, y} = o| as destructuring shorthand
-+        // for |var {x: x, y: y} = o|, per proposed JS2/ES4 for JS1.8.
-+        int tt = peekToken();
-+        if (compilerEnv.getLanguageVersion() >= Context.VERSION_1_8 &&
-+                (tt == Token.COMMA || tt == Token.RC)) {
-+            if (ptt == Token.NAME) {
-+                if (!inDestructuringAssignment) {
-+                    reportError("msg.bad.object.init");
-+                }
-+                String name = property.toString();
-+                decompiler.addToken(Token.OBJECTLIT);
-+                decompiler.addName(name);
-+                elems.add(property);
-+                Node n = nf.createName(name);
-+                elems.add(n);
-+            }
-+            return;
-+        }
-+        
-         mustMatchToken(Token.COLON, "msg.no.colon.prop");
- 
-         // OBJLIT is used as ':' in object literal for
-Index: src/org/mozilla/javascript/ScriptableObject.java
-===================================================================
-RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/ScriptableObject.java,v
-retrieving revision 1.137.2.1
-diff -u -r1.137.2.1 ScriptableObject.java
---- src/org/mozilla/javascript/ScriptableObject.java	5 Nov 2008 21:22:53 -0000	1.137.2.1
-+++ src/org/mozilla/javascript/ScriptableObject.java	20 Nov 2008 10:58:17 -0000
-@@ -28,6 +28,7 @@
-  *   Bob Jervis
-  *   Roger Lawrence
-  *   Steve Weiss
-+ *   Hannes Wallnoefer
-  *
-  * Alternatively, the contents of this file may be used under the terms of
-  * the GNU General Public License Version 2 or later (the "GPL"), in which
-@@ -46,9 +47,7 @@
- package org.mozilla.javascript;
- 
- import java.lang.reflect.*;
--import java.util.HashMap;
--import java.util.HashSet;
--import java.util.Map;
-+import java.util.*;
- import java.io.*;
- import org.mozilla.javascript.debug.DebuggableObject;
- 
-@@ -68,7 +67,7 @@
- 
- public abstract class ScriptableObject implements Scriptable, Serializable,
-                                                   DebuggableObject,
--                                                  ConstProperties
-+                                                  ConstProperties, Map
- {
- 
-     /**
-@@ -2196,14 +2195,13 @@
-                     if (sname != null) {
-                         if (sname == name)
-                             break;
--                        if (name != null && indexOrHash == slot.indexOrHash) {
--                            if (name.equals(sname)) {
--                                // This will avoid calling String.equals when
--                                // slot is accessed with same string object
--                                // next time.
--                                slot.name = name;
--                                break;
--                            }
-+                        if (name != null && indexOrHash == slot.indexOrHash
-+                                         && name.equals(sname)) {
-+                            // This will avoid calling String.equals when
-+                            // slot is accessed with same string object
-+                            // next time.
-+                            slot.name = name;
-+                            break;
-                         }
-                     } else if (name == null &&
-                                indexOrHash == slot.indexOrHash) {
-@@ -2510,4 +2508,218 @@
-         }
-     }
- 
-+    // Methods and classes to implement java.util.Map interface
-+
-+    public int size() {
-+        return count;
-+    }
-+
-+    public boolean isEmpty() {
-+        return count == 0;
-+    }
-+
-+    public boolean containsKey(Object key) {
-+        if (key instanceof String) {
-+            return has((String) key, this);
-+        } else if (key instanceof Number) {
-+            return has(((Number) key).intValue(), this);
-+        }
-+        return false;
-+    }
-+
-+    public boolean containsValue(Object value) {
-+        for (Object obj : values()) {
-+            if (value == obj ||
-+                    value != null && value.equals(obj)) {
-+                return true;
-+            }
-+        }
-+        return false;
-+    }
-+
-+    public Object get(Object key) {
-+        Object value = null;
-+        if (key instanceof String) {
-+            value = getImpl((String) key, 0, this);
-+        } else if (key instanceof Number) {
-+            value = getImpl(null, ((Number) key).intValue(), this);
-+        }
-+        if (value == Scriptable.NOT_FOUND || value == Undefined.instance) {
-+            return null;
-+        } else if (value instanceof Wrapper) {
-+            return ((Wrapper) value).unwrap();
-+        } else {
-+            return value;
-+        }
-+    }
-+
-+    public Object remove(Object key) {
-+        Object value = get(key);
-+        if (key instanceof String) {
-+            delete((String) key);
-+        } else if (key instanceof Number) {
-+            delete(((Number) key).intValue());
-+        }
-+        return value;
-+    }
-+
-+    public Set<Object> keySet() {
-+        return new KeySet();
-+    }
-+
-+    public Collection values() {
-+        return new ValueCollection();
-+    }
-+
-+    public Set<Map.Entry> entrySet() {
-+        return new EntrySet();
-+    }
-+
-+    public Object put(Object key, Object value) {
-+        throw new UnsupportedOperationException();
-+    }
-+
-+    public void putAll(Map m) {
-+        throw new UnsupportedOperationException();
-+    }
-+
-+    public void clear() {
-+        throw new UnsupportedOperationException();
-+    }
-+
-+
-+    class EntrySet extends AbstractSet<Map.Entry> {
-+        @Override
-+        public Iterator<Map.Entry> iterator() {
-+            return new Iterator<Map.Entry>() {
-+                Object[] ids = getIds();
-+                Object key = null;
-+                int index = 0;
-+
-+                public boolean hasNext() {
-+                    return index < ids.length;
-+                }
-+
-+                public Map.Entry next() {
-+                    final Object ekey = key = ids[index++];
-+                    final Object value = get(key);
-+                    return new Map.Entry<Object, Object>() {
-+                        public Object getKey() {
-+                            return ekey;
-+                        }
-+
-+                        public Object getValue() {
-+                            return value;
-+                        }
-+
-+                        public Object setValue(Object value) {
-+                            throw new UnsupportedOperationException();
-+                        }
-+
-+                        public boolean equals(Object other) {
-+                            if (!(other instanceof Map.Entry)) {
-+                                return false;
-+                            }
-+                            Map.Entry e = (Map.Entry) other;
-+                            return (ekey == null ? e.getKey() == null : ekey.equals(e.getKey()))
-+                                && (value == null ? e.getValue() == null : value.equals(e.getValue()));
-+                        }
-+
-+                        public int hashCode() {
-+                            return (ekey == null ? 0 : ekey.hashCode()) ^
-+                                   (value == null ? 0 : value.hashCode());
-+                        }
-+
-+                        public String toString() {
-+                            return ekey + "=" + value;
-+                        }
-+                    };
-+                }
-+
-+                public void remove() {
-+                    if (key == null) {
-+                        throw new IllegalStateException();
-+                    }
-+                    ScriptableObject.this.remove(key);
-+                    key = null;
-+                }
-+            };
-+        }
-+
-+        @Override
-+        public int size() {
-+            return count;
-+        }
-+    }
-+
-+    class KeySet extends AbstractSet<Object> {
-+
-+        @Override
-+        public boolean contains(Object key) {
-+            return containsKey(key);
-+        }
-+
-+        @Override
-+        public Iterator<Object> iterator() {
-+            return new Iterator<Object>() {
-+                Object[] ids = getIds();
-+                Object key;
-+                int index = 0;
-+
-+                public boolean hasNext() {
-+                    return index < ids.length;
-+                }
-+
-+                public Object next() {
-+                    return (key = ids[index++]);
-+                }
-+
-+                public void remove() {
-+                    if (key == null) {
-+                        throw new IllegalStateException();
-+                    }
-+                    ScriptableObject.this.remove(key);
-+                    key = null;                }
-+           };
-+        }
-+
-+        @Override
-+        public int size() {
-+            return count;
-+        }
-+    }
-+
-+    class ValueCollection extends AbstractCollection {
-+
-+        @Override
-+        public Iterator iterator() {
-+            return new Iterator() {
-+                Object[] ids = getIds();
-+                Object key;
-+                int index = 0;
-+
-+                public boolean hasNext() {
-+                    return index < ids.length;
-+                }
-+
-+                public Object next() {
-+                    return get((key = ids[index++]));
-+                }
-+
-+                public void remove() {
-+                    if (key == null) {
-+                        throw new IllegalStateException();
-+                    }
-+                    ScriptableObject.this.remove(key);
-+                    key = null;
-+                }
-+            };
-+        }
-+
-+        @Override
-+        public int size() {
-+            return count;
-+        }
-+    }
-+
- }
-Index: src/org/mozilla/javascript/TokenStream.java
-===================================================================
-RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/TokenStream.java,v
-retrieving revision 1.71.2.1
-diff -u -r1.71.2.1 TokenStream.java
---- src/org/mozilla/javascript/TokenStream.java	5 Nov 2008 21:22:53 -0000	1.71.2.1
-+++ src/org/mozilla/javascript/TokenStream.java	20 Nov 2008 10:58:17 -0000
-@@ -127,7 +127,7 @@
-             Id_delete        = Token.DELPROP,
-             Id_do            = Token.DO,
-             Id_else          = Token.ELSE,
--            Id_export        = Token.EXPORT,
-+            Id_export        = Token.RESERVED,
-             Id_false         = Token.FALSE,
-             Id_for           = Token.FOR,
-             Id_function      = Token.FUNCTION,
-@@ -164,7 +164,7 @@
-             Id_float         = Token.RESERVED,
-             Id_goto          = Token.RESERVED,
-             Id_implements    = Token.RESERVED,
--            Id_import        = Token.IMPORT,
-+            Id_import        = Token.RESERVED,
-             Id_instanceof    = Token.INSTANCEOF,
-             Id_int           = Token.RESERVED,
-             Id_interface     = Token.RESERVED,
-@@ -414,11 +414,6 @@
-                                         isReservedKeywordAsIdentifier())
-                         {
-                             return result;
--                        } else {
--                            // If implementation permits to use future reserved
--                            // keywords in violation with the EcmaScript,
--                            // treat it as name but issue warning
--                            parser.addWarning("msg.reserved.keyword", str);
-                         }
-                     }
-                 }
-Index: src/org/mozilla/javascript/resources/Messages.properties
-===================================================================
-RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/resources/Messages.properties,v
-retrieving revision 1.88
-diff -u -r1.88 Messages.properties
---- src/org/mozilla/javascript/resources/Messages.properties	27 Jun 2008 12:54:05 -0000	1.88
-+++ src/org/mozilla/javascript/resources/Messages.properties	20 Nov 2008 10:58:17 -0000
-@@ -282,6 +282,9 @@
- msg.let.decl.not.in.block =\
-     SyntaxError: let declaration not directly within block
- 
-+msg.bad.object.init =\
-+    SyntaxError: invalid object initializer
-+
- # NodeTransformer
- msg.dup.label =\
-     duplicated label
-@@ -746,6 +749,8 @@
- msg.only.one.super = \
- Only one class may be extended by a JavaAdapter. Had {0} and {1}.
- 
-+msg.defineProperty.expected = \
-+    Expecting at least two parameters to __defineProperty__.
- 
- # Arrays
- msg.arraylength.bad =\
-@@ -755,6 +760,9 @@
- msg.arraylength.too.big =\
-     Array length {0} exceeds supported capacity limit.
- 
-+msg.empty.array.reduce =\
-+    Reduce of empty array with no initial value
-+
- # URI
- msg.bad.uri =\
-     Malformed URI sequence.
+retrieving revision 1.135
+diff -u -r1.135 Parser.java
+--- src/org/mozilla/javascript/Parser.java	7 Apr 2009 21:12:33 -0000	1.135
++++ src/org/mozilla/javascript/Parser.java	8 May 2009 20:46:19 -0000
+@@ -3439,6 +3439,7 @@
+               int type;
+               if (nodeType == Token.GETPROP) {
+                   type = Token.SETPROP;
++                  id.setType(Token.STRING);
+               } else {
+                   type = Token.SETELEM;
+               }