Trait OutputType

Source
pub trait OutputType: Sized {
    const IS_IDENT_REQUIRED: bool;

    // Required methods
    fn finish_fn(
        span: Span,
        ident: Option<Ident>,
        f: Box<Function>,
    ) -> Result<Self, SyntaxError>;
    fn finish_class(
        span: Span,
        ident: Option<Ident>,
        class: Box<Class>,
    ) -> Result<Self, SyntaxError>;

    // Provided method
    fn is_fn_expr() -> bool { ... }
}

Required Associated Constants§

Required Methods§

Source

fn finish_fn( span: Span, ident: Option<Ident>, f: Box<Function>, ) -> Result<Self, SyntaxError>

Source

fn finish_class( span: Span, ident: Option<Ident>, class: Box<Class>, ) -> Result<Self, SyntaxError>

Provided Methods§

Source

fn is_fn_expr() -> bool

From babel..

When parsing function expression, the binding identifier is parsed according to the rules inside the function. e.g. (function* yield() {}) is invalid because “yield” is disallowed in generators. This isn’t the case with function declarations: function* yield() {} is valid because yield is parsed as if it was outside the generator. Therefore, this.state.inGenerator is set before or after parsing the function id according to the “isStatement” parameter.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl OutputType for Box<Expr>

Source§

const IS_IDENT_REQUIRED: bool = false

Source§

fn is_fn_expr() -> bool

Source§

fn finish_fn( _span: Span, ident: Option<Ident>, function: Box<Function>, ) -> Result<Self, SyntaxError>

Source§

fn finish_class( _span: Span, ident: Option<Ident>, class: Box<Class>, ) -> Result<Self, SyntaxError>

Source§

impl OutputType for Decl

Source§

const IS_IDENT_REQUIRED: bool = true

Source§

fn finish_fn( _span: Span, ident: Option<Ident>, function: Box<Function>, ) -> Result<Self, SyntaxError>

Source§

fn finish_class( _: Span, ident: Option<Ident>, class: Box<Class>, ) -> Result<Self, SyntaxError>

Source§

impl OutputType for ExportDefaultDecl

Source§

const IS_IDENT_REQUIRED: bool = false

Source§

fn finish_fn( span: Span, ident: Option<Ident>, function: Box<Function>, ) -> Result<Self, SyntaxError>

Source§

fn finish_class( span: Span, ident: Option<Ident>, class: Box<Class>, ) -> Result<Self, SyntaxError>

Implementors§