diff options
Diffstat (limited to 'pkg/lang/ast/stmt.go')
| -rw-r--r-- | pkg/lang/ast/stmt.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/pkg/lang/ast/stmt.go b/pkg/lang/ast/stmt.go index e924f8c..4f24cc5 100644 --- a/pkg/lang/ast/stmt.go +++ b/pkg/lang/ast/stmt.go @@ -5,7 +5,8 @@ import "jinx/pkg/lang/scanner/token" type StmtKind int const ( - StmtKindUse StmtKind = iota + StmtKindEmpty StmtKind = iota + StmtKindUse StmtKindFnDecl StmtKindObjectDecl StmtKindVarDecl @@ -18,7 +19,9 @@ const ( StmtKindExpr ) -type Stmt[T any] struct { +type Stmt StmtT[any] + +type StmtT[T any] struct { At token.Loc Kind StmtKind Value T @@ -40,11 +43,11 @@ type StmtObjectDecl struct{} type StmtVarDecl struct { Name IdentNode - Value Expr[any] + Value Expr } type StmtIf struct { - Cond Expr[any] + Cond Expr Then BlockNode Elifs []CondNode Else BlockNode @@ -58,7 +61,7 @@ type StmtTry struct { } type StmtReturn struct { - Value Expr[any] + Value Expr } type StmtContinue struct{} @@ -66,9 +69,11 @@ type StmtContinue struct{} type StmtBreak struct{} type StmtThrow struct { - Value Expr[any] + Value Expr } type StmtExpr struct { - Value Expr[any] + Value Expr } + +type StmtEmpty struct{} |
