9.2.1.1 PrepareForOrdinaryCall ( F, newTarget )

当使用函数对象 F 和 ECMAScript 语言值 newTarget 调用抽象操作 PrepareForOrdinaryCall 时,将执行以下步骤:

  1. Assert: Type(newTarget) is Undefined or Object.
  2. Let callerContext be the running execution context.
  3. Let _calleeContext _be a new ECMAScript code execution context.
  4. Set the Function of calleeContext _to _F.
  5. Let calleeRealm _be _F.[[Realm]].
  6. Set the Realm of calleeContext _to _calleeRealm.
  7. Set the ScriptOrModule of calleeContext _to _F.[[ScriptOrModule]]
  8. Let localEnv _be NewFunctionEnvironment(_F, newTarget).
  9. Set the LexicalEnvironment of calleeContext _to _localEnv
  10. Set the VariableEnvironment of calleeContext _to _localEnv.
  11. If callerContext _is not already suspended, suspend _callerContext.
  12. Push _calleeContext _onto the execution context stack; _calleeContext _is now the running execution context.
  13. NOTE Any exception objects produced after this point are associated with calleeRealm.
  14. Return calleeContext.

原文地址:https://tc39.github.io/ecma262/#sec-prepareforordinarycall

results matching ""

    No results matching ""