If statements get a type
This commit is contained in:
parent
4a981f3253
commit
b2f8b85969
@ -4,10 +4,10 @@ import "fmt"
|
||||
import "github.com/alecthomas/participle/v2"
|
||||
import "git.tebibyte.media/sashakoshka/fspl/entity"
|
||||
|
||||
// TODO all expression analysis routines must take in the type they are being
|
||||
// All expression analysis routines must take in the type they are being
|
||||
// assigned to and return an error if they can't be assigned to it. if the type
|
||||
// is nil, the expression must ignore it unless it can do upwards type
|
||||
// inference. need to also figure out comparison operators
|
||||
// inference.
|
||||
|
||||
func (this *Tree) analyzeVariable (
|
||||
into entity.Type,
|
||||
@ -610,6 +610,8 @@ func (this *Tree) analyzeIfElse (
|
||||
ifelse.False = falseBranch
|
||||
}
|
||||
|
||||
ifelse.Ty = into
|
||||
|
||||
return ifelse, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user