Skip to content

Commit

Permalink
Merge pull request #385 from Eclalang/issue-#384-var-case-list
Browse files Browse the repository at this point in the history
added the var case where it was needed
  • Loading branch information
Sanegv authored May 25, 2024
2 parents 520f144 + c0a2ca3 commit 0ac930e
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion interpreter/eclaType/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ func (l *List) DivEc(other Type) (Type, error) {

// Eq returns true if two Type objects are equal
func (l *List) Eq(other Type) (Type, error) {
switch other.(type) {
case *Var:
other = other.(*Var).Value
}
switch other.(type) {
case *List:
if l.Typ != other.(*List).Typ {
Expand All @@ -185,6 +189,10 @@ func (l *List) Eq(other Type) (Type, error) {

// NotEq returns true if two Type objects are not equal
func (l *List) NotEq(other Type) (Type, error) {
switch other.(type) {
case *Var:
other = other.(*Var).Value
}
switch other.(type) {
case *List:
if l.Typ != other.(*List).Typ {
Expand All @@ -207,6 +215,10 @@ func (l *List) NotEq(other Type) (Type, error) {

// Gt returns true if the first Type object is greater than the second
func (l *List) Gt(other Type) (Type, error) {
switch other.(type) {
case *Var:
other = other.(*Var).Value
}
switch other.(type) {
case *List:
if l.Typ != other.(*List).Typ {
Expand All @@ -224,7 +236,10 @@ func (l *List) Gt(other Type) (Type, error) {

// GtEq returns true if the first Type object is greater than or equal the second
func (l *List) GtEq(other Type) (Type, error) {

switch other.(type) {
case *Var:
other = other.(*Var).Value
}
switch other.(type) {
case *List:
if l.Typ != other.(*List).Typ {
Expand All @@ -242,6 +257,10 @@ func (l *List) GtEq(other Type) (Type, error) {

// Lw returns true if the first Type object is lower than the second
func (l *List) Lw(other Type) (Type, error) {
switch other.(type) {
case *Var:
other = other.(*Var).Value
}
switch other.(type) {
case *List:
if l.Typ != other.(*List).Typ {
Expand All @@ -259,6 +278,10 @@ func (l *List) Lw(other Type) (Type, error) {

// LwEq returns true if the first Type object is lower than or equal the second
func (l *List) LwEq(other Type) (Type, error) {
switch other.(type) {
case *Var:
other = other.(*Var).Value
}
switch other.(type) {
case *List:
if l.Typ != other.(*List).Typ {
Expand Down Expand Up @@ -296,6 +319,10 @@ func (l *List) Xor(other Type) (Type, error) {

// Append to list
func (l *List) Append(other Type) (Type, error) {
switch other.(type) {
case *Var:
other = other.(*Var).Value
}
switch other.(type) {
case *List:
if other.(*List).Typ == l.GetValueType() {
Expand Down

0 comments on commit 0ac930e

Please sign in to comment.