Skip to main content

resolve_intl_this

Function resolve_intl_this 

Source
fn resolve_intl_this(
    it: &mut Interp,
    this: Value,
    ctor_name: &str,
    new_target: Option<Value>,
) -> Result<ObjRef, Value>
Expand description

new / Reflect.construct / super() / 裸呼び出し(Intl.NumberFormat())を統一的に扱う。

  • new_target がある場合は OrdinaryCreateFromConstructor(newTarget, "%Intl.<ctor>.prototype%") に従い new_target.prototype(非オブジェクト時は既定プロトタイプ)を解決する。
  • new_target が無い場合でも this のプロトタイプチェーン上に既定プロトタイプがあるなら サブクラス super() 経由のインスタンスとしてそのまま再利用し、裸呼び出し時のみ新規作成する。