Removed Void as a concept

This commit is contained in:
2023-10-29 14:47:28 -04:00
parent 24af8e0b49
commit d435a1b1be
6 changed files with 11 additions and 34 deletions

View File

@@ -365,7 +365,7 @@ type Break struct {
}
func (*Break) expression(){}
func (*Break) statement(){}
func (this *Break) Type () Type { return &TypeVoid { } }
func (this *Break) Type () Type { return nil }
func (this *Break) String () string {
if this.Value == nil {
return "[break]"
@@ -388,7 +388,7 @@ type Return struct {
}
func (*Return) expression(){}
func (*Return) statement(){}
func (this *Return) Type () Type { return &TypeVoid { } }
func (this *Return) Type () Type { return nil }
func (this *Return) String () string {
if this.Value == nil {
return "[return]"

View File

@@ -11,15 +11,6 @@ type Type interface {
ty ()
}
// TypeVoid represents the absence of a type.
type TypeVoid struct { }
func (*TypeVoid) ty(){}
func (*TypeVoid) Equals (ty Type) bool {
_, equals := ty.(*TypeVoid)
return equals
}
func (*TypeVoid) String () string { return "Void" }
// TypeNamed refers to a user-defined or built in named type.
type TypeNamed struct {
Pos lexer.Position