[][src]Struct swc_ecma_transforms::optimization::JsonParse

pub struct JsonParse {
    pub min_cost: usize,
}

Trnasform to optimize performance of literals.

This transform converts pure object literals like

{a: 1, b: 2}

to

JSON.parse('{"a":1, "b"}')

COnditions

If any of the conditions below is matched, pure object literal is converter to JSON.parse

  • Object literal is deeply nested (threshold: )

See https://github.com/swc-project/swc/issues/409

Fields

min_cost: usize

Trait Implementations

impl Debug for JsonParse[src]

impl Default for JsonParse[src]

impl Fold for JsonParse[src]

fn fold_expr(&mut self, e: Expr) -> Expr[src]

Handles parent expressions before child expressions.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Node for T where
    T: Any + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.