pub struct EvalSite {
pub line: u32,
pub column: u32,
pub bindings: Vec<EvalVisible>,
pub private_names: Vec<EvalPrivate>,
pub arguments_allowed: bool,
}Expand description
One direct eval(...) call site and the bindings visible at it.
Fields§
§line: u32Source position of the call, which is how the runtime finds the site: it asks
for the position of the call instruction it is executing.
column: u32Column of the call.
bindings: Vec<EvalVisible>Visible bindings, innermost scope first, so the first name match wins.
private_names: Vec<EvalPrivate>The private names the calling code can see, for an eval inside a class body.
class C { #m = 44; f() { return eval("this.#m") } } is legal: private names are
lexically scoped and the eval runs inside the caller’s scope. The names come from the
call site’s class, not from the eval’d source, so they have to travel with the site.
arguments_allowed: boolWhether arguments is a binding at the call site.
A class field initializer and a static block have none, so eval('arguments') in one
is a SyntaxError. The eval’d source cannot know that; the call site can.