Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Dec 16, 2024
1 parent a49325d commit 945f962
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion compiler/ast/Stmt.v
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub:
pub struct WhileStmt {
pub:
tags Tags
init_stmt ?Stmt
init_stmt ?LetStmt
cond Expr
continue_expr ?Expr
stmts []Stmt
Expand Down
8 changes: 4 additions & 4 deletions compiler/parser/stmt.v
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ fn (mut p Parser) parse_fn_stmt(is_pub bool) ast.FnStmt {
return ast.FnStmt{p.tags, is_pub, name, name_pos, args, return_type, stmts}
}

fn (mut p Parser) parse_let_stmt(is_pub bool) ast.Stmt {
fn (mut p Parser) parse_let_stmt(is_pub bool) ast.LetStmt {
p.expect(.kw_let)
mut lefts := []ast.Variable{}
for {
Expand Down Expand Up @@ -206,10 +206,10 @@ fn (mut p Parser) parse_let_stmt(is_pub bool) ast.Stmt {
}
}

fn (mut p Parser) parse_while_stmt() ast.Stmt {
fn (mut p Parser) parse_while_stmt() ast.WhileStmt {
p.expect(.kw_while)
p.expect(.lparen)
mut init_stmt := ?ast.Stmt(none)
mut init_stmt := ?ast.LetStmt(none)
if p.tok.kind == .kw_let {
init_stmt = p.parse_let_stmt(false)
p.expect(.semicolon)
Expand All @@ -224,7 +224,7 @@ fn (mut p Parser) parse_while_stmt() ast.Stmt {
return ast.WhileStmt{p.tags, init_stmt, cond, continue_expr, stmts}
}

fn (mut p Parser) parse_defer_stmt() ast.Stmt {
fn (mut p Parser) parse_defer_stmt() ast.DeferStmt {
p.expect(.kw_defer)
mut defer_mode := ast.DeferMode.default
if p.accept(.lparen) {
Expand Down

0 comments on commit 945f962

Please sign in to comment.