Search in sources :

Example 1 with AccessorPropertyDescriptor

use of com.github.anba.es6draft.runtime.types.PropertyDescriptor.AccessorPropertyDescriptor in project es6draft by anba.

the class ScriptRuntime method EvaluatePropertyDefinitionSetter.

/**
     * 14.3 Method Definitions
     * <p>
     * 14.3.9 Runtime Semantics: PropertyDefinitionEvaluation
     * <ul>
     * <li>set PropertyName ( PropertySetParameterList ) { FunctionBody }
     * </ul>
     * 
     * @param object
     *            the script object
     * @param propKey
     *            the property key
     * @param enumerable
     *            the enumerable property attribute
     * @param fd
     *            the function runtime info object
     * @param cx
     *            the execution context
     */
public static void EvaluatePropertyDefinitionSetter(OrdinaryObject object, Symbol propKey, boolean enumerable, RuntimeInfo.Function fd, ExecutionContext cx) {
    /* steps 1-3 (generated code) */
    /* step 4 */
    LexicalEnvironment<?> scope = cx.getLexicalEnvironment();
    /* step 5 */
    OrdinaryFunction closure = FunctionCreate(cx, FunctionKind.Method, fd, scope);
    /* step 6 */
    MakeMethod(closure, object);
    /* steps 7-8 */
    SetFunctionName(closure, propKey, "set");
    /* step 9 */
    PropertyDescriptor desc = AccessorPropertyDescriptor(null, closure, enumerable, true);
    /* step 10 */
    DefinePropertyOrThrow(cx, object, propKey, desc);
}
Also used : AccessorPropertyDescriptor(com.github.anba.es6draft.runtime.types.PropertyDescriptor.AccessorPropertyDescriptor) ToPropertyDescriptor(com.github.anba.es6draft.runtime.types.PropertyDescriptor.ToPropertyDescriptor) FromPropertyDescriptor(com.github.anba.es6draft.runtime.types.PropertyDescriptor.FromPropertyDescriptor) OrdinaryFunction(com.github.anba.es6draft.runtime.types.builtins.OrdinaryFunction)

Example 2 with AccessorPropertyDescriptor

use of com.github.anba.es6draft.runtime.types.PropertyDescriptor.AccessorPropertyDescriptor in project es6draft by anba.

the class ScriptRuntime method EvaluatePropertyDefinitionGetter.

/**
     * 14.3 Method Definitions
     * <p>
     * 14.3.9 Runtime Semantics: PropertyDefinitionEvaluation
     * <ul>
     * <li>get PropertyName ( ) { FunctionBody }
     * </ul>
     * 
     * @param object
     *            the script object
     * @param propKey
     *            the property key
     * @param enumerable
     *            the enumerable property attribute
     * @param fd
     *            the function runtime info object
     * @param cx
     *            the execution context
     */
public static void EvaluatePropertyDefinitionGetter(OrdinaryObject object, Symbol propKey, boolean enumerable, RuntimeInfo.Function fd, ExecutionContext cx) {
    /* steps 1-3 (generated code) */
    /* step 4 */
    LexicalEnvironment<?> scope = cx.getLexicalEnvironment();
    /* steps 5-6 */
    OrdinaryFunction closure = FunctionCreate(cx, FunctionKind.Method, fd, scope);
    /* step 7 */
    MakeMethod(closure, object);
    /* steps 8-9 */
    SetFunctionName(closure, propKey, "get");
    /* step 10 */
    PropertyDescriptor desc = AccessorPropertyDescriptor(closure, null, enumerable, true);
    /* step 11 */
    DefinePropertyOrThrow(cx, object, propKey, desc);
}
Also used : AccessorPropertyDescriptor(com.github.anba.es6draft.runtime.types.PropertyDescriptor.AccessorPropertyDescriptor) ToPropertyDescriptor(com.github.anba.es6draft.runtime.types.PropertyDescriptor.ToPropertyDescriptor) FromPropertyDescriptor(com.github.anba.es6draft.runtime.types.PropertyDescriptor.FromPropertyDescriptor) OrdinaryFunction(com.github.anba.es6draft.runtime.types.builtins.OrdinaryFunction)

Example 3 with AccessorPropertyDescriptor

use of com.github.anba.es6draft.runtime.types.PropertyDescriptor.AccessorPropertyDescriptor in project es6draft by anba.

the class ScriptRuntime method EvaluatePropertyDefinitionSetter.

/**
     * 14.3 Method Definitions
     * <p>
     * 14.3.9 Runtime Semantics: PropertyDefinitionEvaluation
     * <ul>
     * <li>set PropertyName ( PropertySetParameterList ) { FunctionBody }
     * </ul>
     * 
     * @param object
     *            the script object
     * @param propKey
     *            the property key
     * @param enumerable
     *            the enumerable property attribute
     * @param fd
     *            the function runtime info object
     * @param cx
     *            the execution context
     */
public static void EvaluatePropertyDefinitionSetter(OrdinaryObject object, String propKey, boolean enumerable, RuntimeInfo.Function fd, ExecutionContext cx) {
    /* steps 1-3 (generated code) */
    /* step 4 */
    LexicalEnvironment<?> scope = cx.getLexicalEnvironment();
    /* step 5 */
    OrdinaryFunction closure = FunctionCreate(cx, FunctionKind.Method, fd, scope);
    /* step 6 */
    MakeMethod(closure, object);
    /* steps 7-8 */
    SetFunctionName(closure, propKey, "set");
    /* step 9 */
    PropertyDescriptor desc = AccessorPropertyDescriptor(null, closure, enumerable, true);
    /* step 10 */
    DefinePropertyOrThrow(cx, object, propKey, desc);
}
Also used : AccessorPropertyDescriptor(com.github.anba.es6draft.runtime.types.PropertyDescriptor.AccessorPropertyDescriptor) ToPropertyDescriptor(com.github.anba.es6draft.runtime.types.PropertyDescriptor.ToPropertyDescriptor) FromPropertyDescriptor(com.github.anba.es6draft.runtime.types.PropertyDescriptor.FromPropertyDescriptor) OrdinaryFunction(com.github.anba.es6draft.runtime.types.builtins.OrdinaryFunction)

Example 4 with AccessorPropertyDescriptor

use of com.github.anba.es6draft.runtime.types.PropertyDescriptor.AccessorPropertyDescriptor in project es6draft by anba.

the class ScriptRuntime method EvaluatePropertyDefinitionGetter.

/**
     * 14.3 Method Definitions
     * <p>
     * 14.3.9 Runtime Semantics: PropertyDefinitionEvaluation
     * <ul>
     * <li>get PropertyName ( ) { FunctionBody }
     * </ul>
     * 
     * @param object
     *            the script object
     * @param propKey
     *            the property key
     * @param enumerable
     *            the enumerable property attribute
     * @param fd
     *            the function runtime info object
     * @param cx
     *            the execution context
     */
public static void EvaluatePropertyDefinitionGetter(OrdinaryObject object, String propKey, boolean enumerable, RuntimeInfo.Function fd, ExecutionContext cx) {
    /* steps 1-3 (generated code) */
    /* step 4 */
    LexicalEnvironment<?> scope = cx.getLexicalEnvironment();
    /* steps 5-6 */
    OrdinaryFunction closure = FunctionCreate(cx, FunctionKind.Method, fd, scope);
    /* step 7 */
    MakeMethod(closure, object);
    /* steps 8-9 */
    SetFunctionName(closure, propKey, "get");
    /* step 10 */
    PropertyDescriptor desc = AccessorPropertyDescriptor(closure, null, enumerable, true);
    /* step 11 */
    DefinePropertyOrThrow(cx, object, propKey, desc);
}
Also used : AccessorPropertyDescriptor(com.github.anba.es6draft.runtime.types.PropertyDescriptor.AccessorPropertyDescriptor) ToPropertyDescriptor(com.github.anba.es6draft.runtime.types.PropertyDescriptor.ToPropertyDescriptor) FromPropertyDescriptor(com.github.anba.es6draft.runtime.types.PropertyDescriptor.FromPropertyDescriptor) OrdinaryFunction(com.github.anba.es6draft.runtime.types.builtins.OrdinaryFunction)

Aggregations

AccessorPropertyDescriptor (com.github.anba.es6draft.runtime.types.PropertyDescriptor.AccessorPropertyDescriptor)4 FromPropertyDescriptor (com.github.anba.es6draft.runtime.types.PropertyDescriptor.FromPropertyDescriptor)4 ToPropertyDescriptor (com.github.anba.es6draft.runtime.types.PropertyDescriptor.ToPropertyDescriptor)4 OrdinaryFunction (com.github.anba.es6draft.runtime.types.builtins.OrdinaryFunction)4