Skip to content

Commit

Permalink
Try to reduce the number of lines
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Aug 22, 2024
1 parent 7a20b92 commit 10af7da
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,8 @@ fn expr_as_comptime(
return_type: Type,
location: Location,
) -> IResult<Value> {
use ExpressionKind::Block;

expr_as(arguments, return_type, location, |expr| {
if let ExprValue::Expression(ExpressionKind::Comptime(block_expr, _)) = expr {
Some(block_expression_to_value(block_expr))
Expand All @@ -876,12 +878,9 @@ fn expr_as_comptime(
// and in that case we return the block expression statements
// (comptime as a statement can also be comptime for, but in that case we'll
// return the for statement as a single expression)
if let StatementKind::Expression(Expression {
kind: ExpressionKind::Block(block_expr),
..
}) = statement.kind
if let StatementKind::Expression(Expression { kind: Block(block), .. }) = statement.kind
{
Some(block_expression_to_value(block_expr))
Some(block_expression_to_value(block))
} else {
let mut elements = Vector::new();
elements.push_back(Value::statement(statement.kind));
Expand Down

0 comments on commit 10af7da

Please sign in to comment.