use of com.github.anba.es6draft.runtime.Realm in project es6draft by anba.
the class OrdinaryAsyncFunction method FunctionAllocate.
/* ***************************************************************************************** */
/**
* 9.2.3 FunctionAllocate (functionPrototype, strict [,functionKind] )
*
* @param cx
* the execution context
* @param functionPrototype
* the function prototype
* @param strict
* the strict mode flag
* @param kind
* the function kind
* @return the new async function object
*/
public static OrdinaryAsyncFunction FunctionAllocate(ExecutionContext cx, ScriptObject functionPrototype, boolean strict, FunctionKind kind) {
assert kind != FunctionKind.ClassConstructor;
Realm realm = cx.getRealm();
/* steps 1-5 (implicit) */
/* steps 6-9 */
OrdinaryAsyncFunction f = new OrdinaryAsyncFunction(realm);
/* steps 10-14 */
f.allocate(realm, functionPrototype, strict, kind, ConstructorKind.Base);
/* step 15 */
return f;
}
use of com.github.anba.es6draft.runtime.Realm in project es6draft by anba.
the class OrdinaryConstructorGenerator method FunctionAllocate.
/* ***************************************************************************************** */
/**
* 9.2.3 FunctionAllocate (functionPrototype, strict [,functionKind] )
*
* @param cx
* the execution context
* @param functionPrototype
* the function prototype
* @param strict
* the strict mode flag
* @param kind
* the function kind
* @return the new generator function object
*/
public static OrdinaryConstructorGenerator FunctionAllocate(ExecutionContext cx, ScriptObject functionPrototype, boolean strict, FunctionKind kind) {
assert kind != FunctionKind.ClassConstructor;
Realm realm = cx.getRealm();
/* steps 1-5 (implicit) */
/* steps 6-9 */
OrdinaryConstructorGenerator f = new OrdinaryConstructorGenerator(realm);
/* steps 10-14 */
f.allocate(realm, functionPrototype, strict, kind, ConstructorKind.Derived);
/* step 15 */
return f;
}
use of com.github.anba.es6draft.runtime.Realm in project es6draft by anba.
the class OrdinaryFunction method FunctionAllocate.
/* ***************************************************************************************** */
/**
* 9.2.3 FunctionAllocate (functionPrototype, strict)
*
* @param cx
* the execution context
* @param functionPrototype
* the function prototype
* @param strict
* the strict mode flag
* @param functionKind
* the function kind
* @return the new function object
*/
public static OrdinaryFunction FunctionAllocate(ExecutionContext cx, ScriptObject functionPrototype, boolean strict, FunctionKind functionKind) {
assert !(functionKind == FunctionKind.Normal || functionKind == FunctionKind.ClassConstructor);
Realm realm = cx.getRealm();
/* steps 1-5 (implicit) */
/* steps 6-9 */
OrdinaryFunction f = new OrdinaryFunction(realm);
/* steps 10-14 */
f.allocate(realm, functionPrototype, strict, functionKind, ConstructorKind.Base);
/* step 15 */
return f;
}
use of com.github.anba.es6draft.runtime.Realm in project es6draft by anba.
the class OrdinaryGenerator method FunctionAllocate.
/* ***************************************************************************************** */
/**
* 9.2.3 FunctionAllocate (functionPrototype, strict [,functionKind] )
*
* @param cx
* the execution context
* @param functionPrototype
* the function prototype
* @param strict
* the strict mode flag
* @param kind
* the function kind
* @return the new generator function object
*/
public static OrdinaryGenerator FunctionAllocate(ExecutionContext cx, ScriptObject functionPrototype, boolean strict, FunctionKind kind) {
assert kind != FunctionKind.ClassConstructor;
Realm realm = cx.getRealm();
/* steps 1-5 (implicit) */
/* steps 6-9 */
OrdinaryGenerator f = new OrdinaryGenerator(realm);
/* steps 10-14 */
f.allocate(realm, functionPrototype, strict, kind, ConstructorKind.Base);
/* step 15 */
return f;
}
use of com.github.anba.es6draft.runtime.Realm in project es6draft by anba.
the class InterpretedScriptBody method scriptEvaluation.
/**
* 15.1.7 Runtime Semantics: ScriptEvaluation
*
* @param cx
* the execution context
* @param script
* the script object
* @param interpreter
* the interpreter
* @return the script evaluation result
*/
private Object scriptEvaluation(ExecutionContext cx, Script script, Interpreter interpreter) {
Realm realm = cx.getRealm();
/* step 1 (not applicable) */
/* step 2 */
LexicalEnvironment<GlobalEnvironmentRecord> globalEnv = realm.getGlobalEnv();
/* steps 3-7 */
ExecutionContext scriptCxt = newScriptExecutionContext(realm, script);
/* steps 8-9 */
ExecutionContext oldScriptContext = realm.getWorld().getScriptContext();
try {
realm.getWorld().setScriptContext(scriptCxt);
/* step 10 */
GlobalDeclarationInstantiation(scriptCxt, parsedScript, globalEnv);
/* steps 11-12 */
Object result = parsedScript.accept(interpreter, scriptCxt);
/* step 16 */
return result;
} finally {
/* steps 13-15 */
realm.getWorld().setScriptContext(oldScriptContext);
}
}
Aggregations