fileset: box FunctionCallNode to make enum smaller

For the same reason as the previous commit.
This commit is contained in:
Yuya Nishihara 2024-05-16 22:52:57 +09:00
parent e87b49ccc1
commit 3e51e93265

View file

@ -184,7 +184,7 @@ pub enum ExpressionKind<'i> {
StringPattern { kind: &'i str, value: String },
Unary(UnaryOp, Box<ExpressionNode<'i>>),
Binary(BinaryOp, Box<ExpressionNode<'i>>, Box<ExpressionNode<'i>>),
FunctionCall(FunctionCallNode<'i>),
FunctionCall(Box<FunctionCallNode<'i>>),
}
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
@ -251,7 +251,7 @@ fn parse_primary_node(pair: Pair<Rule>) -> FilesetParseResult<ExpressionNode> {
let expr = match first.as_rule() {
Rule::expression => return parse_expression_node(first),
Rule::function => {
let function = parse_function_call_node(first)?;
let function = Box::new(parse_function_call_node(first)?);
ExpressionKind::FunctionCall(function)
}
Rule::string_pattern => {
@ -412,7 +412,8 @@ mod tests {
ExpressionKind::Binary(op, lhs, rhs)
}
ExpressionKind::FunctionCall(function) => {
ExpressionKind::FunctionCall(normalize_function_call(function))
let function = Box::new(normalize_function_call(*function));
ExpressionKind::FunctionCall(function)
}
};
ExpressionNode {