F.[[Call]](thisArgument, argumentsList, thisConstructor) :
- ...
- If
thisArgument
is empty, then letcalledAsConstructor
be true; else letcalledAsConstructor
be false. - Let
result
be the result of EvaluateBody... - ReturnIfAbrupt(
result
). - If
calledAsConstructor
is true and Type(result
) is not Object, then - TODO: Interaction with Tail-Call semantics?
- Let
thisValue
be GetThisBinding(). - NOTE: 'thisValue' may be empty, callers need to handle this case!
- Let
result
be NormalCompletion(thisValue
). - Return
result
.
F.[[Construct]](receiver, argumentsList):
- If
F
.[[NeedsSuper]] is false, then - Let
obj
be the result of OrdinaryCreateFromConstructor(receiver.prototype
, "%ObjectPrototype%"). - ReturnIfAbrupt(
obj
). - Else,
- Let
obj
be empty. - Let
result
be the result ofF.[[Call]](obj, argumentsList, receiver)
. - ReturnIfAbrupt(
result
). - If
result
is empty, then throw a (Reference|Type)Error exception. - If Type(
result
) is Object, returnresult
. - Assert:
obj
is not empty. - Return
obj
.
Semantics of a super-method call:
- Let
F
be the method referenced bysuper.method
. (!!!) - Let
thisValue
be GetThisBinding(). - If
thisValue
is not empty,- Let
result
be the result ofF.[[Call]](thisValue, args)
.
- Let
- Else,
- If IsConstructor(
F
) is false, then throw a TypeError exception. - Let
receiver
be GetThisConstructor(). - Let
result
be the result ofF.[[Construct]](receiver, args)
. - ReturnIfAbrupt(
result
). - Assert: Type(
result
) is Object. - If GetThisBinding() is empty, then InitializeThisBinding(
result
).
- If IsConstructor(
- Return
result
.