use of com.github.anba.es6draft.runtime.types.builtins.FunctionObject.ConstructorKind in project es6draft by anba.
the class ScriptRuntime method EvaluateConstructorMethod.
/**
* 14.3 Method Definitions, 14.5 Class Definitions
* <p>
* 14.3.8 Runtime Semantics: DefineMethod<br>
* 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
*
* @param constructorParent
* the constructor prototype
* @param proto
* the class prototype
* @param fd
* the function runtime info object
* @param isDerived
* {@code true} if evaluating the constructor of a derived class
* @param cx
* the execution context
* @return the new function instance
*/
public static OrdinaryConstructorFunction EvaluateConstructorMethod(ScriptObject constructorParent, OrdinaryObject proto, RuntimeInfo.Function fd, boolean isDerived, ExecutionContext cx) {
// ClassDefinitionEvaluation - steps 11-13 (call DefineMethod)
LexicalEnvironment<?> scope = cx.getLexicalEnvironment();
ConstructorKind constructorKind = isDerived ? ConstructorKind.Derived : ConstructorKind.Base;
OrdinaryConstructorFunction constructor = ConstructorFunctionCreate(cx, FunctionKind.ClassConstructor, constructorKind, fd, scope, constructorParent);
MakeMethod(constructor, proto);
// ClassDefinitionEvaluation - step 14 (not applicable, cf. ConstructorFunctionCreate)
// ClassDefinitionEvaluation - step 15
MakeConstructor(constructor, false, proto);
// ClassDefinitionEvaluation - step 16
MakeClassConstructor(constructor);
// ClassDefinitionEvaluation - step 17
proto.defineOwnProperty(cx, "constructor", new PropertyDescriptor(constructor, true, false, true));
return constructor;
}
Aggregations