Implemented source tracking and type checking
All checks were successful
/ test (push) Successful in 21s

This commit is contained in:
Eduard Urbach 2025-06-27 00:05:16 +02:00
parent 70c2da4a4d
commit 329fcfff6f
Signed by: akyoto
GPG key ID: 49226B848C78F6C8
30 changed files with 427 additions and 125 deletions

View file

@ -5,6 +5,7 @@ import (
"git.urbach.dev/cli/q/src/expression"
"git.urbach.dev/cli/q/src/token"
"git.urbach.dev/cli/q/src/types"
)
type BinaryOperation struct {
@ -12,7 +13,7 @@ type BinaryOperation struct {
Right Value
Op token.Kind
Liveness
HasToken
Source
}
func (v *BinaryOperation) Dependencies() []Value {
@ -26,10 +27,6 @@ func (a *BinaryOperation) Equals(v Value) bool {
return false
}
if a.Source.Kind != b.Source.Kind {
return false
}
if !a.Left.Equals(b.Left) {
return false
}
@ -47,4 +44,8 @@ func (v *BinaryOperation) IsConst() bool {
func (v *BinaryOperation) String() string {
return fmt.Sprintf("%s %s %s", v.Left, expression.Operators[v.Op].Symbol, v.Right)
}
func (v *BinaryOperation) Type() types.Type {
return v.Left.Type()
}