nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java
changeset 29281 8cc2618a07aa
parent 29133 1cd7d8af99ba
child 29282 a8523237b66c
equal deleted inserted replaced
29280:8a79b4040d2a 29281:8cc2618a07aa
   111 
   111 
   112     /**
   112     /**
   113      * Throws a reference error for an undefined variable.
   113      * Throws a reference error for an undefined variable.
   114      */
   114      */
   115     public static final Call THROW_REFERENCE_ERROR = staticCall(MethodHandles.lookup(), ScriptRuntime.class, "throwReferenceError", void.class, String.class);
   115     public static final Call THROW_REFERENCE_ERROR = staticCall(MethodHandles.lookup(), ScriptRuntime.class, "throwReferenceError", void.class, String.class);
       
   116 
       
   117     /**
       
   118      * Throws a reference error for an undefined variable.
       
   119      */
       
   120     public static final Call THROW_CONST_TYPE_ERROR = staticCall(MethodHandles.lookup(), ScriptRuntime.class, "throwConstTypeError", void.class, String.class);
   116 
   121 
   117     /**
   122     /**
   118      * Used to invalidate builtin names, e.g "Function" mapping to all properties in Function.prototype and Function.prototype itself.
   123      * Used to invalidate builtin names, e.g "Function" mapping to all properties in Function.prototype and Function.prototype itself.
   119      */
   124      */
   120     public static final Call INVALIDATE_RESERVED_BUILTIN_NAME = staticCallNoLookup(ScriptRuntime.class, "invalidateReservedBuiltinName", void.class, String.class);
   125     public static final Call INVALIDATE_RESERVED_BUILTIN_NAME = staticCallNoLookup(ScriptRuntime.class, "invalidateReservedBuiltinName", void.class, String.class);
   401     public static void throwReferenceError(final String name) {
   406     public static void throwReferenceError(final String name) {
   402         throw referenceError("not.defined", name);
   407         throw referenceError("not.defined", name);
   403     }
   408     }
   404 
   409 
   405     /**
   410     /**
       
   411      * Throws a type error for an assignment to a const.
       
   412      *
       
   413      * @param name the const name
       
   414      */
       
   415     public static void throwConstTypeError(final String name) {
       
   416         throw typeError("assign.constant", name);
       
   417     }
       
   418 
       
   419     /**
   406      * Call a script function as a constructor with given args.
   420      * Call a script function as a constructor with given args.
   407      *
   421      *
   408      * @param target ScriptFunction object.
   422      * @param target ScriptFunction object.
   409      * @param args   Call arguments.
   423      * @param args   Call arguments.
   410      * @return Constructor call result.
   424      * @return Constructor call result.