diff options
| author | Mel <einebeere@gmail.com> | 2022-04-21 03:18:46 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-04-21 03:18:46 +0200 |
| commit | 5267c0e8653b431cfd2c06212cdba4f22225bd02 (patch) | |
| tree | 9ec6205f01629918407edb97a531248e1bb6c762 /pkg/lang/ast/stmt.go | |
| parent | 20bc0c2243888900d2f04328e57ad2d7ca0a2403 (diff) | |
| download | jinx-5267c0e8653b431cfd2c06212cdba4f22225bd02.tar.zst jinx-5267c0e8653b431cfd2c06212cdba4f22225bd02.zip | |
Do not force generics for Expr and Stmt
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{} |
