if (value instanceof ScriptableObject) {  ScriptableObject obj = (ScriptableObject) value; if (obj.getParentScope() == tmpObjProto) { obj.setParentScope(objProto); } }
        public void commitCompilation() {            // loop through properties defined on the temporary proto and            // copy them over to the actual prototype object. Then, remove             // those properties that haven't been renewed in this compilation            Set newProperties = new HashSet();            Object[] keys = tmpObjProto.getAllIds();            for (int i = 0; i < keys.length; i++) {                if (! (keys[i] instanceof String)) {                    System.err.println("JUMP: "+keys[i]);                    continue;                }                                String key = (String) keys[i];                if (predefinedProperties.contains(key)) {                    // don't mess with properties we didn't set                    continue;                }                // add properties to newProperties set                newProperties.add(key);                // copy them over to the actual prototype object                int attributes = tmpObjProto.getAttributes(key);                Object value = tmpObjProto.get(key, tmpObjProto);                objProto.defineProperty(key, value, attributes);             }            // switch property set over to new version and             // get a set of those old properties that weren't renewed            Set oldProperties = compiledProperties;            compiledProperties = newProperties;            oldProperties.removeAll(newProperties);            for (Iterator it = oldProperties.iterator(); it.hasNext(); ) {                // remove those properties that weren't renewed, meaning                 // their definition has gone from the source files                String key = (String) it.next();                try {                    objProto.setAttributes(key, 0);                    objProto.delete(key);                } catch (Exception px) {                    System.err.println("Error unsetting property "+key+" on "+                                       frameworkProto.getName());                }            }                        // mark this type as updated            lastUpdate = frameworkProto.getLastUpdate();            // If this prototype defines a postCompile() function, call it            Context cx = Context.getCurrentContext();            try {                Object fObj = ScriptableObject.getProperty(objProto,                                                            "onCodeUpdate");                if (fObj instanceof Function) {                    Object[] args = {frameworkProto.getName()};                    ((Function) fObj).call(cx, global, objProto, args);                }            } catch (Exception x) {                app.logError("Exception in "+frameworkProto.getName()+                             ".onCodeUpdate(): " + x, x);            }        }