LibJS: Box ExpressionKind::TaggedTemplateLiteral variant
This commit is contained in:
parent
9d0d8129f4
commit
15097fa8e0
4 changed files with 18 additions and 24 deletions
|
|
@ -370,12 +370,9 @@ impl FunctionTable {
|
|||
self.collect_from_expression(expr, result);
|
||||
}
|
||||
}
|
||||
ExpressionKind::TaggedTemplateLiteral {
|
||||
tag,
|
||||
template_literal,
|
||||
} => {
|
||||
self.collect_from_expression(tag, result);
|
||||
self.collect_from_expression(template_literal, result);
|
||||
ExpressionKind::TaggedTemplateLiteral(data) => {
|
||||
self.collect_from_expression(&data.tag, result);
|
||||
self.collect_from_expression(&data.template_literal, result);
|
||||
}
|
||||
ExpressionKind::Yield { argument, .. } => {
|
||||
if let Some(expr) = argument {
|
||||
|
|
@ -1365,6 +1362,12 @@ pub struct OptionalChainData {
|
|||
pub references: Vec<OptionalChainReference>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct TaggedTemplateData {
|
||||
pub tag: Box<Expression>,
|
||||
pub template_literal: Box<Expression>,
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Expression enum
|
||||
// =============================================================================
|
||||
|
|
@ -1423,10 +1426,7 @@ pub enum ExpressionKind {
|
|||
|
||||
// Templates
|
||||
TemplateLiteral(Box<TemplateLiteralData>),
|
||||
TaggedTemplateLiteral {
|
||||
tag: Box<Expression>,
|
||||
template_literal: Box<Expression>,
|
||||
},
|
||||
TaggedTemplateLiteral(Box<TaggedTemplateData>),
|
||||
|
||||
// Meta
|
||||
MetaProperty(MetaPropertyType),
|
||||
|
|
|
|||
|
|
@ -974,13 +974,10 @@ fn dump_expression(expression: &Expression, state: &DumpState) {
|
|||
}
|
||||
}
|
||||
|
||||
ExpressionKind::TaggedTemplateLiteral {
|
||||
tag,
|
||||
template_literal,
|
||||
} => {
|
||||
ExpressionKind::TaggedTemplateLiteral(data) => {
|
||||
dump_node!(state, "TaggedTemplateLiteral", &expression.range);
|
||||
dump_labeled_expression("tag", tag, false, state);
|
||||
dump_labeled_expression("template", template_literal, true, state);
|
||||
dump_labeled_expression("tag", &data.tag, false, state);
|
||||
dump_labeled_expression("template", &data.template_literal, true, state);
|
||||
}
|
||||
|
||||
ExpressionKind::MetaProperty(meta_type) => {
|
||||
|
|
|
|||
|
|
@ -286,13 +286,10 @@ fn generate_expression_inner(
|
|||
}
|
||||
|
||||
// === Tagged template literals ===
|
||||
ExpressionKind::TaggedTemplateLiteral {
|
||||
tag,
|
||||
template_literal,
|
||||
} => Some(generate_tagged_template_literal(
|
||||
ExpressionKind::TaggedTemplateLiteral(data) => Some(generate_tagged_template_literal(
|
||||
generator,
|
||||
tag,
|
||||
template_literal,
|
||||
&data.tag,
|
||||
&data.template_literal,
|
||||
preferred_dst,
|
||||
)),
|
||||
|
||||
|
|
|
|||
|
|
@ -2013,10 +2013,10 @@ impl Parser<'_> {
|
|||
let template = self.parse_template_literal(true);
|
||||
expression = self.expression(
|
||||
tag_start,
|
||||
ExpressionKind::TaggedTemplateLiteral {
|
||||
ExpressionKind::TaggedTemplateLiteral(Box::new(TaggedTemplateData {
|
||||
tag: Box::new(expression),
|
||||
template_literal: Box::new(template),
|
||||
},
|
||||
})),
|
||||
);
|
||||
}
|
||||
expression
|
||||
|
|
|
|||
Loading…
Reference in a new issue