Skip to main content

call_site_text

Function call_site_text 

Source
pub fn call_site_text(vm: &VM) -> Option<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. The source text recorded for the op currently executing, if any. vm.ip has already advanced past it.