[−][src]Trait swc_ecma_transforms::util::ExprExt
Extension methods for Expr.
Required methods
Loading content...Provided methods
pub fn is_immutable_value(&self) -> bool
Returns true if this is an immutable value.
pub fn is_number(&self) -> bool
pub fn is_str(&self) -> bool
pub fn is_array_lit(&self) -> bool
pub fn is_nan(&self) -> bool
Checks if self
is NaN
.
pub fn is_undefined(&self) -> bool
pub fn is_void(&self) -> bool
pub fn is_ident_ref_to(&self, id: Atom<JsWordStaticSet>) -> bool
Is self
an IdentifierReference to id
?
pub fn as_pure_bool(&self) -> Value<bool>
Get bool value of self
if it does not have any side effects.
pub fn as_bool(&self) -> (Purity, Value<bool>)
This method emulates the Boolean()
JavaScript cast function.
Note: unlike getPureBooleanValue this function does not return None
for expressions with side-effects.
pub fn as_number(&self) -> Value<f64>
Emulates javascript Number() cast function.
pub fn as_string(&self) -> Value<Cow<'_, str>>
Returns Known only if it's pure.
pub fn get_type(&self) -> Value<Type>
Apply the supplied predicate against all possible result Nodes of the expression.