Skip to main content

re_compile

Function re_compile 

Source
pub(crate) fn re_compile(
    _it: &mut Interp,
    this: Value,
    a: &[Value],
) -> Result<Value, Value>
Expand description

RegExp.prototype.compile(pattern, flags)(レガシーだが今も仕様に残る メソッド。丸ごと未対応だった)。new RegExp(...) と異なり新しいオブジェクトを 作らず、this 自身の内部状態(パターン・フラグ・lastIndex)をその場で 差し替える。pattern が既存の RegExp なら仕様どおりその source/flags を 継承する(regexp_ctor の1引数解決ロジックと同じ規則)。