Implemented source tracking and type checking
All checks were successful
/ test (push) Successful in 21s
All checks were successful
/ test (push) Successful in 21s
This commit is contained in:
parent
70c2da4a4d
commit
329fcfff6f
30 changed files with 427 additions and 125 deletions
|
@ -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()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue