pub struct Program {
pub body: BlockStatement,
/* private fields */
}
Expand description
Represents a complete top-level JS script.
The only way to create a Program
externally is to use LexicalContext::new_program
,
maybe via Program::parse_from
or build::script
helpers. This ensures that
its bindings are statically analysed.
Fields
body: BlockStatement
Implementations
sourceimpl Program
impl Program
pub fn globals_iter(&self) -> impl Iterator<Item = &Binding>
pub fn bindings_iter(&self) -> BlockBindings<'_>ⓘNotable traits for BlockBindings<'b>impl<'b> Iterator for BlockBindings<'b> type Item = Binding;
sourceimpl Program
impl Program
sourcepub fn parse_from<S: SourceNode>(source: &S) -> ParseResult<Program>
pub fn parse_from<S: SourceNode>(source: &S) -> ParseResult<Program>
Makes a Program
from anything that implements SourceNode
e.g. from a JSON
ESTree.
Trait Implementations
sourceimpl Interpretable for Program
impl Interpretable for Program
sourceimpl<T, F> TryFrom<Builder<T, F>> for Program where
Statement: From<T>,
F: FnOnce(&mut LexicalContext) -> ParseResult<T>,
impl<T, F> TryFrom<Builder<T, F>> for Program where
Statement: From<T>,
F: FnOnce(&mut LexicalContext) -> ParseResult<T>,
type Error = ParseError
type Error = ParseError
The type returned in the event of a conversion error.
sourcefn try_from(builder: Builder<T, F>) -> Result<Self, ParseError>
fn try_from(builder: Builder<T, F>) -> Result<Self, ParseError>
Performs the conversion.
sourceimpl<F> TryFrom<Builder<Vec<Statement, Global>, F>> for Program where
F: FnOnce(&mut LexicalContext) -> ParseResult<Vec<Statement>>,
impl<F> TryFrom<Builder<Vec<Statement, Global>, F>> for Program where
F: FnOnce(&mut LexicalContext) -> ParseResult<Vec<Statement>>,
type Error = ParseError
type Error = ParseError
The type returned in the event of a conversion error.
sourcefn try_from(builder: BlockBuilder<F>) -> Result<Self, ParseError>
fn try_from(builder: BlockBuilder<F>) -> Result<Self, ParseError>
Performs the conversion.
sourceimpl TryFrom<Expression> for Program
impl TryFrom<Expression> for Program
type Error = ParseError
type Error = ParseError
The type returned in the event of a conversion error.
sourcefn try_from(expr: Expression) -> Result<Self, Self::Error>
fn try_from(expr: Expression) -> Result<Self, Self::Error>
Performs the conversion.
impl Eq for Program
Auto Trait Implementations
impl RefUnwindSafe for Program
impl !Send for Program
impl !Sync for Program
impl Unpin for Program
impl UnwindSafe for Program
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more