-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
164 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
type Foo | ||
Bar as Number | ||
end type | ||
|
||
sub Main() | ||
dim a as Foo | ||
dim b as Foo | ||
if a = b then print "ok" | ||
end sub | ||
|
||
--output-- | ||
ok |
16 changes: 16 additions & 0 deletions
16
src/test/programs/records/record_comparison_greater_than.bas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
type Foo | ||
Bar as Number | ||
end type | ||
|
||
sub Main() | ||
dim a as Foo | ||
dim b as Foo | ||
if a > b then print "wrong" | ||
end sub | ||
|
||
--output-- | ||
Compiler error | ||
kTypeMismatch | ||
Main | ||
4:10 | ||
The ">" operator does not support the type "Foo". |
16 changes: 16 additions & 0 deletions
16
src/test/programs/records/record_comparison_greater_than_equals.bas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
type Foo | ||
Bar as Number | ||
end type | ||
|
||
sub Main() | ||
dim a as Foo | ||
dim b as Foo | ||
if a >= b then print "wrong" | ||
end sub | ||
|
||
--output-- | ||
Compiler error | ||
kTypeMismatch | ||
Main | ||
4:10 | ||
The ">=" operator does not support the type "Foo". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
type Foo | ||
Bar as Number | ||
end type | ||
|
||
sub Main() | ||
dim a as Foo | ||
dim b as Foo | ||
if a < b then print "wrong" | ||
end sub | ||
|
||
--output-- | ||
Compiler error | ||
kTypeMismatch | ||
Main | ||
4:10 | ||
The "<" operator does not support the type "Foo". |
16 changes: 16 additions & 0 deletions
16
src/test/programs/records/record_comparison_less_than_equals.bas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
type Foo | ||
Bar as Number | ||
end type | ||
|
||
sub Main() | ||
dim a as Foo | ||
dim b as Foo | ||
if a <= b then print "wrong" | ||
end sub | ||
|
||
--output-- | ||
Compiler error | ||
kTypeMismatch | ||
Main | ||
4:10 | ||
The "<=" operator does not support the type "Foo". |
16 changes: 16 additions & 0 deletions
16
src/test/programs/records/record_comparison_not_equals.bas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
type Foo | ||
Bar as Number | ||
end type | ||
|
||
sub Main() | ||
dim a as Foo | ||
dim b as Foo | ||
if a <> b then | ||
print "wrong" | ||
else | ||
print "ok" | ||
end if | ||
end sub | ||
|
||
--output-- | ||
ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "vm/systemCall.h" | ||
#include "vm/castObject.h" | ||
#include "vm/Record.h" | ||
|
||
namespace vm { | ||
|
||
// (lhs as Record, rhs as Record) as Boolean | ||
void systemCallRecordEquals(const SystemCallInput& input, SystemCallResult* result) { | ||
const auto& lhs = *castRecord(input.getObject(-2)); | ||
const auto& rhs = *castRecord(input.getObject(-1)); | ||
result->returnedValue = Value{ lhs.equals(rhs) }; | ||
} | ||
|
||
// (lhs as Record, rhs as Record) as Boolean | ||
void systemCallRecordNotEquals(const SystemCallInput& input, SystemCallResult* result) { | ||
const auto& lhs = *castRecord(input.getObject(-2)); | ||
const auto& rhs = *castRecord(input.getObject(-1)); | ||
result->returnedValue = Value{ !lhs.equals(rhs) }; | ||
} | ||
|
||
} // namespace vm |