aboutsummaryrefslogtreecommitdiff
path: root/pkg/lang/ast
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-07-03 18:11:55 +0200
committerMel <einebeere@gmail.com>2022-07-03 18:11:55 +0200
commited9a0c8f0f3c1eed3582d722935cd1df1d055afd (patch)
treede68dd7510f03457693593d7dbd8636804f89ded /pkg/lang/ast
parent4774f6373d3e41acba54cb4c63ca51f1b3de2ddd (diff)
downloadjinx-ed9a0c8f0f3c1eed3582d722935cd1df1d055afd.tar.zst
jinx-ed9a0c8f0f3c1eed3582d722935cd1df1d055afd.zip
Compile If Stmts
Diffstat (limited to 'pkg/lang/ast')
-rw-r--r--pkg/lang/ast/expr.go8
-rw-r--r--pkg/lang/ast/stmt.go5
2 files changed, 8 insertions, 5 deletions
diff --git a/pkg/lang/ast/expr.go b/pkg/lang/ast/expr.go
index f98f9b3..b0ed599 100644
--- a/pkg/lang/ast/expr.go
+++ b/pkg/lang/ast/expr.go
@@ -1,6 +1,8 @@
package ast
-import "jinx/pkg/libs/source"
+import (
+ "jinx/pkg/libs/source"
+)
type ExprKind int
@@ -24,6 +26,10 @@ const (
type Expr ExprT[any]
+func (e Expr) IsEmpty() bool {
+ return e == Expr{}
+}
+
type ExprT[T any] struct {
At source.Loc
Kind ExprKind
diff --git a/pkg/lang/ast/stmt.go b/pkg/lang/ast/stmt.go
index e25dee9..6395f57 100644
--- a/pkg/lang/ast/stmt.go
+++ b/pkg/lang/ast/stmt.go
@@ -47,10 +47,7 @@ type StmtVarDecl struct {
}
type StmtIf struct {
- Cond Expr
- Then BlockNode
- Elifs []CondNode
- Else BlockNode
+ Conds []CondNode
}
type StmtTry struct {