Skip to main content

name_call_site

Function name_call_site 

Source
pub fn name_call_site(vm: &VM, subject: &str, msg: String) -> String
Expand description

Rewrite a <subject> is not a function / is not a constructor message with the SOURCE TEXT of the callee at the currently executing op, as V8 does.

subject is what the raising code named — the method name, or the callee’s rendered value. The message’s own subject must END WITH it, which is the guard that keeps an unrelated error raised deeper inside a native method from being relabelled with this call’s text. (A native dispatcher may prefix its own receiver word, e.g. map.get is not a function, so the whole subject is replaced rather than trimmed by length.)

Returns the message unchanged when no site was recorded, so a shape the printer declines to print keeps the old wording rather than an invented one.