Search in sources :

Example 91 with Property

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

the class ArgumentsObject method CreateUnmappedArgumentsObject.

/**
 * 9.4.4.6 CreateUnmappedArgumentsObject(argumentsList)
 * <p>
 * [Called from generated code]
 *
 * @param cx
 *            the execution context
 * @param argumentsList
 *            the function arguments
 * @return the strict mode arguments object
 */
public static ArgumentsObject CreateUnmappedArgumentsObject(ExecutionContext cx, Object[] argumentsList) {
    /* step 1 */
    int len = argumentsList.length;
    /* steps 2-3 */
    ArgumentsObject obj = new ArgumentsObject(cx.getRealm(), null);
    /* step 4 */
    obj.infallibleDefineOwnProperty("length", new Property(len, true, false, true));
    /* steps 5-6 */
    for (int index = 0; index < len; ++index) {
        obj.setIndexed(index, argumentsList[index]);
    }
    Callable thrower = cx.getRealm().getThrowTypeError();
    /* step 7 */
    obj.infallibleDefineOwnProperty(BuiltinSymbol.iterator.get(), new Property(cx.getIntrinsic(Intrinsics.ArrayProto_values), true, false, true));
    /* step 8 */
    obj.infallibleDefineOwnProperty("callee", new Property(thrower, thrower, false, false));
    /* step 9 */
    return obj;
}
Also used : Property(com.github.anba.es6draft.runtime.types.Property) Callable(com.github.anba.es6draft.runtime.types.Callable)

Example 92 with Property

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

the class BuiltinFunction method reifyDefaultProperties.

private void reifyDefaultProperties() {
    assert hasDefaultName || hasDefaultLength;
    // This is a bit kludgy, but necessary to ensure the property order is spec-compliant. Alternatively we could
    // store the default 'name' and 'length' properties as Property objects.
    defineOwnPropertiesUncheckedAtFront(p -> {
        if (hasDefaultLength) {
            p.accept("length", new Property(arity, false, false, true));
        }
        if (hasDefaultName) {
            p.accept("name", new Property(name, false, false, true));
        }
    });
    hasDefaultName = false;
    hasDefaultLength = false;
}
Also used : Property(com.github.anba.es6draft.runtime.types.Property)

Example 93 with Property

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

the class ZoneConstructor method initialize.

@Override
public void initialize(Realm realm) {
    createProperties(realm, this, Properties.class);
    ZoneObject initialZone = new ZoneObject(realm, null, realm.getIntrinsic(Intrinsics.ZonePrototype));
    initialZone.infallibleDefineOwnProperty("name", new Property("(root zone)", false, false, true));
    realm.setCurrentZone(initialZone);
}
Also used : Property(com.github.anba.es6draft.runtime.types.Property)

Aggregations

Property (com.github.anba.es6draft.runtime.types.Property)93 ScriptObject (com.github.anba.es6draft.runtime.types.ScriptObject)54 Callable (com.github.anba.es6draft.runtime.types.Callable)44 OrdinaryObject (com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)19 PropertyDescriptor (com.github.anba.es6draft.runtime.types.PropertyDescriptor)18 OrdinaryGenerator (com.github.anba.es6draft.runtime.types.builtins.OrdinaryGenerator)6 OrdinaryAsyncGenerator (com.github.anba.es6draft.runtime.types.builtins.OrdinaryAsyncGenerator)5 PrivateName (com.github.anba.es6draft.runtime.types.PrivateName)4 ArrayObject (com.github.anba.es6draft.runtime.types.builtins.ArrayObject)4 FunctionObject (com.github.anba.es6draft.runtime.types.builtins.FunctionObject)4 CreateDataProperty (com.github.anba.es6draft.runtime.AbstractOperations.CreateDataProperty)3 IsCallable (com.github.anba.es6draft.runtime.AbstractOperations.IsCallable)3 GlobalEnvironmentRecord (com.github.anba.es6draft.runtime.GlobalEnvironmentRecord)3 RuntimeInfo (com.github.anba.es6draft.runtime.internal.RuntimeInfo)3 OrdinaryFunction (com.github.anba.es6draft.runtime.types.builtins.OrdinaryFunction)3 ArrayList (java.util.ArrayList)3 CompilationException (com.github.anba.es6draft.compiler.CompilationException)2 ParserException (com.github.anba.es6draft.parser.ParserException)2 DeclarativeEnvironmentRecord (com.github.anba.es6draft.runtime.DeclarativeEnvironmentRecord)2 ScriptLoader (com.github.anba.es6draft.runtime.internal.ScriptLoader)2