src/jdk/nashorn/internal/runtime/ScriptFunction.java

changeset 230
c62144b08c65
parent 137
e15806b9d716
child 376
51a5ee93d6bc
     1.1 --- a/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Fri Apr 26 18:31:42 2013 +0530
     1.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Fri Apr 26 17:35:40 2013 +0200
     1.3 @@ -71,9 +71,6 @@
     1.4  
     1.5      private static final MethodHandle IS_NONSTRICT_FUNCTION = findOwnMH("isNonStrictFunction", boolean.class, Object.class, Object.class, ScriptFunctionData.class);
     1.6  
     1.7 -    /** Reference to constructor prototype. */
     1.8 -    protected Object prototype;
     1.9 -
    1.10      /** The parent scope. */
    1.11      private final ScriptObject scope;
    1.12  
    1.13 @@ -221,6 +218,7 @@
    1.14          final ScriptObject object = data.allocate();
    1.15  
    1.16          if (object != null) {
    1.17 +            Object prototype = getPrototype();
    1.18              if (prototype instanceof ScriptObject) {
    1.19                  object.setProto((ScriptObject)prototype);
    1.20              }
    1.21 @@ -282,24 +280,18 @@
    1.22       * Get the prototype object for this function
    1.23       * @return prototype
    1.24       */
    1.25 -    public final Object getPrototype() {
    1.26 -        return prototype;
    1.27 -    }
    1.28 +    public abstract Object getPrototype();
    1.29  
    1.30      /**
    1.31       * Set the prototype object for this function
    1.32       * @param prototype new prototype object
    1.33 -     * @return the prototype parameter
    1.34       */
    1.35 -    public final Object setPrototype(final Object prototype) {
    1.36 -        this.prototype = prototype;
    1.37 -        return prototype;
    1.38 -    }
    1.39 +    public abstract void setPrototype(Object prototype);
    1.40  
    1.41      /**
    1.42       * Return the most appropriate invoke handle if there are specializations
    1.43       * @param type most specific method type to look for invocation with
    1.44 -     * @param callsite args for trampoline invocation
    1.45 +     * @param args args for trampoline invocation
    1.46       * @return invoke method handle
    1.47       */
    1.48      private MethodHandle getBestInvoker(final MethodType type, final Object[] args) {

mercurial