Tuesday, January 3, 2023

GetValue abstract operation

GetValue abstract operation GetValue ( V )
  1. ReturnIfAbrupt(V).
  2. If Type(V) is not Reference, return V.
  3. If IsUnresolvableReference(V) is true, throw a ReferenceError exception.
  4. Let base be GetBase(V).
  5. If HasPrimitiveBase(V) is true, Set base to !ToObject(base)
  6. If IsPropertyReference(V) is true, Return ? base.[[Get]](GetReferencedName(V), Receiver = GetThisValue(V)).
  7. Return ? base.GetBindingValue(GetReferencedName(V), IsStrictReference(V))

note If IsSuperReference(V), GetThisValue(V) returns the thisValue component of the reference V; else returns GetBase(V).

abstract operation O.[[Get]](P, Receiver) works as:

  • Let desc be ? O.[[GetOwnProperty]](P).
  • If desc is undefined, Return ?O.[[Prototype]].[[Get]](P, Receiver).
  • If IsDataDescriptor(desc) is true, return desc.[[Value]].
  • Return ? Call(desc.[[Get]], Receiver)// Receiver is only used by AccessorDescriptor

above all

  1. super is parent and super.super is grandpa
  2. desc.[[Get]] can accept base, base.super, base.super.super... as Receiver
  3. refer to new.target for more info regarding the super keyword

No comments:

Post a Comment