Introduce typed semantic analysis pipeline

This commit is contained in:
pavel 2026-08-27 19:28:24 +02:00
commit f4cd4f4458
30 changed files with 2079 additions and 2381 deletions

View file

@ -6,7 +6,6 @@ type Program struct {
Interfaces []InterfaceDecl
Enums []EnumDecl
Classes []ClassDecl
Workers []WorkerDecl
Functions []FunctionDecl
Embeds []EmbedDecl
}
@ -44,19 +43,6 @@ type ClassDecl struct {
Methods []FunctionDecl
}
type WorkerDecl struct {
Name string
Fields []WorkerFieldDecl
Methods []FunctionDecl
}
type WorkerFieldDecl struct {
Mutable bool
Name string
Type string
Value Expr
}
type FieldDecl struct {
Mutable bool
Private bool
@ -148,12 +134,6 @@ type ThrowStmt struct {
func (ThrowStmt) stmtNode() {}
type GoStmt struct {
Value Expr
}
func (GoStmt) stmtNode() {}
type DeferStmt struct {
Value Expr
}
@ -198,12 +178,6 @@ type TryCatchStmt struct {
func (TryCatchStmt) stmtNode() {}
type SelectStmt struct {
Cases []SelectCase
}
func (SelectStmt) stmtNode() {}
type MatchStmt struct {
Value Expr
Cases []MatchCase
@ -218,6 +192,7 @@ type MatchCase struct {
}
type MatchExpr struct {
Meta ExprMeta
Value Expr
Cases []MatchExprCase
}
@ -230,46 +205,47 @@ type MatchExprCase struct {
Value Expr
}
type SelectCase struct {
Source Expr
Body []Stmt
}
type IdentExpr struct {
Meta ExprMeta
Name string
}
func (IdentExpr) exprNode() {}
type IntExpr struct {
Meta ExprMeta
Value string
}
func (IntExpr) exprNode() {}
type FloatExpr struct {
Meta ExprMeta
Value string
}
func (FloatExpr) exprNode() {}
type StringExpr struct {
Meta ExprMeta
Value string
}
func (StringExpr) exprNode() {}
type BoolExpr struct {
Meta ExprMeta
Value bool
}
func (BoolExpr) exprNode() {}
type NullExpr struct{}
type NullExpr struct{ Meta ExprMeta }
func (NullExpr) exprNode() {}
type UnaryExpr struct {
Meta ExprMeta
Op string
Value Expr
}
@ -277,6 +253,7 @@ type UnaryExpr struct {
func (UnaryExpr) exprNode() {}
type BinaryExpr struct {
Meta ExprMeta
Left Expr
Op string
Right Expr
@ -285,6 +262,7 @@ type BinaryExpr struct {
func (BinaryExpr) exprNode() {}
type CallExpr struct {
Meta ExprMeta
Callee Expr
Args []Expr
TypeArgs []string
@ -299,6 +277,7 @@ type NamedArg struct {
func (CallExpr) exprNode() {}
type SelectorExpr struct {
Meta ExprMeta
Receiver Expr
Name string
}
@ -306,21 +285,29 @@ type SelectorExpr struct {
func (SelectorExpr) exprNode() {}
type SafeSelectorExpr struct {
Meta ExprMeta
Receiver Expr
Name string
}
func (SafeSelectorExpr) exprNode() {}
type NonNullExpr struct{ Value Expr }
type NonNullExpr struct {
Meta ExprMeta
Value Expr
}
func (NonNullExpr) exprNode() {}
type TryExpr struct{ Value Expr }
type TryExpr struct {
Meta ExprMeta
Value Expr
}
func (TryExpr) exprNode() {}
type IndexExpr struct {
Meta ExprMeta
Receiver Expr
Index Expr
}
@ -328,6 +315,7 @@ type IndexExpr struct {
func (IndexExpr) exprNode() {}
type EnumVariantExpr struct {
Meta ExprMeta
EnumName, VariantName string
Values []Expr
}
@ -335,6 +323,7 @@ type EnumVariantExpr struct {
func (EnumVariantExpr) exprNode() {}
type LambdaExpr struct {
Meta ExprMeta
Params []Param
ImplicitIt bool
Body []Stmt