mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
transformer: clean up expr_stmt_match_expr() (#16655)
This commit is contained in:
parent
1e7208d28b
commit
d87e400e77
@ -404,8 +404,8 @@ pub fn (mut t Transformer) expr_stmt_match_expr(mut node ast.MatchExpr) ast.Expr
|
|||||||
|
|
||||||
match cond {
|
match cond {
|
||||||
ast.BoolLiteral {
|
ast.BoolLiteral {
|
||||||
if expr is ast.BoolLiteral {
|
if mut expr is ast.BoolLiteral {
|
||||||
if cond.val == (expr as ast.BoolLiteral).val {
|
if cond.val == expr.val {
|
||||||
branch.exprs = [expr]
|
branch.exprs = [expr]
|
||||||
node.branches = [branch]
|
node.branches = [branch]
|
||||||
terminate = true
|
terminate = true
|
||||||
@ -413,8 +413,8 @@ pub fn (mut t Transformer) expr_stmt_match_expr(mut node ast.MatchExpr) ast.Expr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast.IntegerLiteral {
|
ast.IntegerLiteral {
|
||||||
if expr is ast.IntegerLiteral {
|
if mut expr is ast.IntegerLiteral {
|
||||||
if cond.val.int() == (expr as ast.IntegerLiteral).val.int() {
|
if cond.val.int() == expr.val.int() {
|
||||||
branch.exprs = [expr]
|
branch.exprs = [expr]
|
||||||
node.branches = [branch]
|
node.branches = [branch]
|
||||||
terminate = true
|
terminate = true
|
||||||
@ -422,8 +422,8 @@ pub fn (mut t Transformer) expr_stmt_match_expr(mut node ast.MatchExpr) ast.Expr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast.FloatLiteral {
|
ast.FloatLiteral {
|
||||||
if expr is ast.FloatLiteral {
|
if mut expr is ast.FloatLiteral {
|
||||||
if cond.val.f32() == (expr as ast.FloatLiteral).val.f32() {
|
if cond.val.f32() == expr.val.f32() {
|
||||||
branch.exprs = [expr]
|
branch.exprs = [expr]
|
||||||
node.branches = [branch]
|
node.branches = [branch]
|
||||||
terminate = true
|
terminate = true
|
||||||
@ -431,8 +431,8 @@ pub fn (mut t Transformer) expr_stmt_match_expr(mut node ast.MatchExpr) ast.Expr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast.StringLiteral {
|
ast.StringLiteral {
|
||||||
if expr is ast.StringLiteral {
|
if mut expr is ast.StringLiteral {
|
||||||
if cond.val == (expr as ast.StringLiteral).val {
|
if cond.val == expr.val {
|
||||||
branch.exprs = [expr]
|
branch.exprs = [expr]
|
||||||
node.branches = [branch]
|
node.branches = [branch]
|
||||||
terminate = true
|
terminate = true
|
||||||
|
Loading…
Reference in New Issue
Block a user