pub enum ExpressionKind {
Show 31 variants
Identifier(String),
NumericLiteral(f64),
StringLiteral(String),
BigIntLiteral(String),
BooleanLiteral(bool),
NullLiteral,
RegexLiteral(String),
TemplateString(String),
UnaryExpression {
operator: String,
argument: Box<Expression>,
},
UpdateExpression {
operator: String,
argument: Box<Expression>,
prefix: bool,
},
BinaryExpression {
left: Box<Expression>,
operator: String,
right: Box<Expression>,
},
ConditionalExpression {
test: Box<Expression>,
consequent: Box<Expression>,
alternate: Box<Expression>,
},
MemberExpression {
object: Box<Expression>,
property: Box<Expression>,
computed: bool,
optional: bool,
},
CallExpression {
func: Box<Expression>,
args: Vec<Expression>,
},
NewExpression {
func: Box<Expression>,
args: Vec<Expression>,
},
AssignmentExpression {
left: Box<Expression>,
operator: String,
right: Box<Expression>,
},
AsExpression {
expression: Box<Expression>,
type_annotation: TypeAnnotation,
},
ArrowFunction {
type_params: Vec<TypeParameter>,
params: Vec<FunctionParam>,
return_type: Option<TypeAnnotation>,
body: Box<Statement>,
async_: bool,
},
ObjectLiteral {
properties: Vec<ObjectProperty>,
},
ArrayLiteral {
elements: Vec<Expression>,
},
SpreadElement(Box<Expression>),
AwaitExpression(Box<Expression>),
YieldExpression(Option<Box<Expression>>),
ImportExpression {
module_specifier: Box<Expression>,
},
FunctionExpression {
name: Option<String>,
type_params: Vec<TypeParameter>,
params: Vec<FunctionParam>,
return_type: Option<TypeAnnotation>,
body: Vec<Statement>,
async_: bool,
generator: bool,
},
TaggedTemplateExpression {
tag: Box<Expression>,
template: Box<Expression>,
},
TypeAssertionExpression {
expression: Box<Expression>,
type_annotation: TypeAnnotation,
},
NonNullExpression(Box<Expression>),
JsxElement(Box<JsxElement>),
JsxFragment(Box<JsxFragment>),
JsxSelfClosingElement(Box<JsxSelfClosingElement>),
}Expand description
Represents the different kinds of expressions in TypeScript.
Variants§
Identifier(String)
An identifier.
NumericLiteral(f64)
A numeric literal.
StringLiteral(String)
A string literal.
BigIntLiteral(String)
A BigInt literal.
BooleanLiteral(bool)
A boolean literal.
NullLiteral
A null literal.
RegexLiteral(String)
A regular expression literal.
TemplateString(String)
A template string literal.
UnaryExpression
A unary expression.
UpdateExpression
An update expression.
Fields
argument: Box<Expression>Argument expression.
BinaryExpression
A binary expression.
Fields
left: Box<Expression>Left-hand side expression.
right: Box<Expression>Right-hand side expression.
ConditionalExpression
A conditional (ternary) expression.
Fields
test: Box<Expression>Condition expression.
consequent: Box<Expression>Expression to evaluate if the condition is true.
alternate: Box<Expression>Expression to evaluate if the condition is false.
MemberExpression
A member expression.
CallExpression
A call expression.
NewExpression
A new expression.
Fields
func: Box<Expression>Constructor function to call.
args: Vec<Expression>Arguments to the constructor call.
AssignmentExpression
An assignment expression.
Fields
left: Box<Expression>Left-hand side expression.
right: Box<Expression>Right-hand side expression.
AsExpression
An ‘as’ expression (type assertion).
Fields
expression: Box<Expression>Expression being asserted.
type_annotation: TypeAnnotationType annotation being asserted to.
ArrowFunction
An arrow function expression.
Fields
type_params: Vec<TypeParameter>Type parameters of the arrow function.
params: Vec<FunctionParam>Parameters of the arrow function.
return_type: Option<TypeAnnotation>Return type of the arrow function.
ObjectLiteral
An object literal.
Fields
properties: Vec<ObjectProperty>Properties within the object literal.
ArrayLiteral
An array literal.
Fields
elements: Vec<Expression>Elements within the array literal.
SpreadElement(Box<Expression>)
A spread element.
AwaitExpression(Box<Expression>)
An await expression.
YieldExpression(Option<Box<Expression>>)
A yield expression.
ImportExpression
An import expression.
Fields
module_specifier: Box<Expression>Module specifier being imported.
FunctionExpression
A function expression.
Fields
type_params: Vec<TypeParameter>Type parameters of the function.
params: Vec<FunctionParam>Parameters of the function.
return_type: Option<TypeAnnotation>Return type of the function.
TaggedTemplateExpression
A tagged template expression.
Fields
tag: Box<Expression>Tag function expression.
template: Box<Expression>Template literal expression.
TypeAssertionExpression
A type assertion expression (e.g., <Type>expression).
Fields
expression: Box<Expression>Expression being asserted.
type_annotation: TypeAnnotationType annotation being asserted to.
NonNullExpression(Box<Expression>)
A non-null expression (e.g., expression!).
JsxElement(Box<JsxElement>)
A JSX element.
JsxFragment(Box<JsxFragment>)
A JSX fragment.
JsxSelfClosingElement(Box<JsxSelfClosingElement>)
A self-closing JSX element.
Trait Implementations§
Source§impl Clone for ExpressionKind
impl Clone for ExpressionKind
Source§fn clone(&self) -> ExpressionKind
fn clone(&self) -> ExpressionKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more