Skip to main content

parse_script_strict

Function parse_script_strict 

Source
pub fn parse_script_strict(src: &str) -> Result<Program>
Expand description

Parse src as a Script whose code is strict from the first token.

This is what a direct eval needs: the eval’d code inherits strictness from the code that called it, so eval("x = 1") inside a strict function is a ReferenceError rather than an implicit global. Prepending a "use strict" directive instead would shift every column on the first line, and the positions are exactly what a stack trace has to report.