9.2.1.2 OrdinaryCallBindThis ( F, calleeContext, thisArgument )

当抽象操作普通调用绑定使用函数对象 F,执行上下文 callee 上下文和 ECMAScript 值 thisArgument 调用时,采取以下步骤:

  1. Let thisMode _be _F.[[ThisMode]].
  2. If _thisMode _is lexical, return NormalCompletion(undefined).
  3. Let calleeRealm _be _F.[[Realm]].
  4. Let localEnv _be the LexicalEnvironment of _calleeContext.
  5. If thisMode _is strict, let _thisValue _be _thisArgument.
  6. Else,

a. If thisArgument _is undefined or null, then i. Let _globalEnv _be _calleeRealm.[[GlobalEnv]].

ii. Let _globalEnvRec _be _globalEnv'_s EnvironmentRecord.

iii. Let thisValue _be _globalEnvRec.[[GlobalThisValue]].

b. Else,

i. Let thisValue _be ! ToObject(_thisArgument).

ii. NOTE ToObject _produces wrapper objects using _calleeRealm.

7.Let envRec be localEnv's EnvironmentRecord.

8.Assert: The next step never returns an abrupt completion because envRec.[[ThisBindingStatus]] is not "initialized".

9.Return envRec.BindThisValue(thisValue).

results matching ""

    No results matching ""