Implement comparision operator overloads (#63)

This commit is contained in:
Max Graey 2018-04-04 01:01:59 +03:00 committed by Daniel Wirtz
parent 5823e35f37
commit 37825fc84d
5 changed files with 844 additions and 34 deletions

View File

@ -2400,7 +2400,16 @@ export class Compiler extends DiagnosticEmitter {
expr = module.createBinary(BinaryOp.LtU32, leftExpr, rightExpr);
break;
}
case TypeKind.USIZE: { // TODO: check operator overload
case TypeKind.USIZE: { // check operator overload
if (this.currentType.is(TypeFlags.REFERENCE)) {
let classInstance = assert(this.currentType.classReference);
let operatorName = classInstance.prototype.fnLessThan;
if (operatorName != null) {
expr = this.compileOperatorOverload(classInstance, operatorName, leftExpr, rightExpr);
break;
}
}
// fall-through
expr = module.createBinary(
this.options.isWasm64
? BinaryOp.LtU64
@ -2479,7 +2488,16 @@ export class Compiler extends DiagnosticEmitter {
expr = module.createBinary(BinaryOp.GtU32, leftExpr, rightExpr);
break;
}
case TypeKind.USIZE: { // TODO: check operator overload
case TypeKind.USIZE: { // check operator overload
if (this.currentType.is(TypeFlags.REFERENCE)) {
let classInstance = assert(this.currentType.classReference);
let operatorName = classInstance.prototype.fnGreaterThan;
if (operatorName != null) {
expr = this.compileOperatorOverload(classInstance, operatorName, leftExpr, rightExpr);
break;
}
}
// fall-through
expr = module.createBinary(
this.options.isWasm64
? BinaryOp.GtU64
@ -2558,7 +2576,16 @@ export class Compiler extends DiagnosticEmitter {
expr = module.createBinary(BinaryOp.LeU32, leftExpr, rightExpr);
break;
}
case TypeKind.USIZE: { // TODO: check operator overload
case TypeKind.USIZE: { // check operator overload
if (this.currentType.is(TypeFlags.REFERENCE)) {
let classInstance = assert(this.currentType.classReference);
let operatorName = classInstance.prototype.fnLessThanEquals;
if (operatorName != null) {
expr = this.compileOperatorOverload(classInstance, operatorName, leftExpr, rightExpr);
break;
}
}
// fall-through
expr = module.createBinary(
this.options.isWasm64
? BinaryOp.LeU64
@ -2637,7 +2664,16 @@ export class Compiler extends DiagnosticEmitter {
expr = module.createBinary(BinaryOp.GeU32, leftExpr, rightExpr);
break;
}
case TypeKind.USIZE: { // TODO: check operator overload
case TypeKind.USIZE: { // check operator overload
if (this.currentType.is(TypeFlags.REFERENCE)) {
let classInstance = assert(this.currentType.classReference);
let operatorName = classInstance.prototype.fnGreaterThanEquals;
if (operatorName != null) {
expr = this.compileOperatorOverload(classInstance, operatorName, leftExpr, rightExpr);
break;
}
}
// fall-through
expr = module.createBinary(
this.options.isWasm64
? BinaryOp.GeU64
@ -2784,7 +2820,17 @@ export class Compiler extends DiagnosticEmitter {
expr = module.createBinary(BinaryOp.NeI32, leftExpr, rightExpr);
break;
}
case TypeKind.USIZE: // TODO: check operator overload
case TypeKind.USIZE: {// check operator overload
if (this.currentType.is(TypeFlags.REFERENCE)) {
let classInstance = assert(this.currentType.classReference);
let operatorName = classInstance.prototype.fnNotEquals;
if (operatorName != null) {
expr = this.compileOperatorOverload(classInstance, operatorName, leftExpr, rightExpr);
break;
}
}
// fall-through
}
case TypeKind.ISIZE: {
expr = module.createBinary(
this.options.isWasm64

View File

@ -733,6 +733,26 @@ export class Program extends DiagnosticEmitter {
classPrototype.fnEquals = prototype.simpleName;
break;
}
case "!=": {
classPrototype.fnNotEquals = prototype.simpleName;
break;
}
case ">": {
classPrototype.fnGreaterThan = prototype.simpleName;
break;
}
case ">=": {
classPrototype.fnGreaterThanEquals = prototype.simpleName;
break;
}
case "<": {
classPrototype.fnLessThan = prototype.simpleName;
break;
}
case "<=": {
classPrototype.fnLessThanEquals = prototype.simpleName;
break;
}
default: {
this.error(
DiagnosticCode.Operation_not_supported,
@ -2944,6 +2964,16 @@ export class ClassPrototype extends Element {
fnBitwiseXor: string | null = null;
/** Overloaded equality comparison method, if any. */
fnEquals: string | null = null;
/** Overloaded non-equality comparison method, if any. */
fnNotEquals: string | null = null;
/** Overloaded greater comparison method, if any. */
fnGreaterThan: string | null = null;
/** Overloaded greater or equal comparison method, if any. */
fnGreaterThanEquals: string | null = null;
/** Overloaded less comparison method, if any. */
fnLessThan: string | null = null;
/** Overloaded less or equal comparison method, if any. */
fnLessThanEquals: string | null = null;
constructor(
program: Program,

View File

@ -37,6 +37,18 @@
(global $std/operator-overloading/eq3 (mut i32) (i32.const 0))
(global $std/operator-overloading/eq4 (mut i32) (i32.const 0))
(global $std/operator-overloading/eqf (mut i32) (i32.const 0))
(global $std/operator-overloading/gt1 (mut i32) (i32.const 0))
(global $std/operator-overloading/gt2 (mut i32) (i32.const 0))
(global $std/operator-overloading/gt (mut i32) (i32.const 0))
(global $std/operator-overloading/gte1 (mut i32) (i32.const 0))
(global $std/operator-overloading/gte2 (mut i32) (i32.const 0))
(global $std/operator-overloading/gte (mut i32) (i32.const 0))
(global $std/operator-overloading/le1 (mut i32) (i32.const 0))
(global $std/operator-overloading/le2 (mut i32) (i32.const 0))
(global $std/operator-overloading/le (mut i32) (i32.const 0))
(global $std/operator-overloading/leq1 (mut i32) (i32.const 0))
(global $std/operator-overloading/leq2 (mut i32) (i32.const 0))
(global $std/operator-overloading/leq (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 64))
(memory $0 1)
(data (i32.const 4) "\1b\00\00\00s\00t\00d\00/\00o\00p\00e\00r\00a\00t\00o\00r\00-\00o\00v\00e\00r\00l\00o\00a\00d\00i\00n\00g\00.\00t\00s")
@ -321,7 +333,7 @@
)
)
)
(func $std/operator-overloading/Tester.equal (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $std/operator-overloading/Tester.equals (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(i32.and
(if (result i32)
@ -348,7 +360,142 @@
(i32.const 1)
)
)
(func $start (; 12 ;) (type $v)
(func $std/operator-overloading/Tester.notEquals (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(i32.and
(if (result i32)
(tee_local $2
(i32.ne
(i32.load
(get_local $0)
)
(i32.load
(get_local $1)
)
)
)
(i32.ne
(i32.load offset=4
(get_local $0)
)
(i32.load offset=4
(get_local $1)
)
)
(get_local $2)
)
(i32.const 1)
)
)
(func $std/operator-overloading/Tester.greater (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(i32.and
(if (result i32)
(tee_local $2
(i32.gt_s
(i32.load
(get_local $0)
)
(i32.load
(get_local $1)
)
)
)
(i32.gt_s
(i32.load offset=4
(get_local $0)
)
(i32.load offset=4
(get_local $1)
)
)
(get_local $2)
)
(i32.const 1)
)
)
(func $std/operator-overloading/Tester.greaterEquals (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(i32.and
(if (result i32)
(tee_local $2
(i32.ge_s
(i32.load
(get_local $0)
)
(i32.load
(get_local $1)
)
)
)
(i32.ge_s
(i32.load offset=4
(get_local $0)
)
(i32.load offset=4
(get_local $1)
)
)
(get_local $2)
)
(i32.const 1)
)
)
(func $std/operator-overloading/Tester.less (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(i32.and
(if (result i32)
(tee_local $2
(i32.lt_s
(i32.load
(get_local $0)
)
(i32.load
(get_local $1)
)
)
)
(i32.lt_s
(i32.load offset=4
(get_local $0)
)
(i32.load offset=4
(get_local $1)
)
)
(get_local $2)
)
(i32.const 1)
)
)
(func $std/operator-overloading/Tester.lessEquals (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(i32.and
(if (result i32)
(tee_local $2
(i32.le_s
(i32.load
(get_local $0)
)
(i32.load
(get_local $1)
)
)
)
(i32.le_s
(i32.load offset=4
(get_local $0)
)
(i32.load offset=4
(get_local $1)
)
)
(get_local $2)
)
(i32.const 1)
)
)
(func $start (; 17 ;) (type $v)
(local $0 i32)
(set_global $~lib/allocator/arena/startOffset
(i32.and
@ -409,7 +556,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 57)
(i32.const 82)
(i32.const 0)
)
(unreachable)
@ -461,7 +608,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 63)
(i32.const 88)
(i32.const 0)
)
(unreachable)
@ -514,7 +661,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 69)
(i32.const 94)
(i32.const 0)
)
(unreachable)
@ -567,7 +714,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 75)
(i32.const 100)
(i32.const 0)
)
(unreachable)
@ -619,7 +766,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 81)
(i32.const 106)
(i32.const 0)
)
(unreachable)
@ -672,7 +819,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 87)
(i32.const 112)
(i32.const 0)
)
(unreachable)
@ -725,7 +872,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 93)
(i32.const 118)
(i32.const 0)
)
(unreachable)
@ -778,7 +925,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 99)
(i32.const 124)
(i32.const 0)
)
(unreachable)
@ -799,7 +946,7 @@
)
)
(set_global $std/operator-overloading/eq
(call $std/operator-overloading/Tester.equal
(call $std/operator-overloading/Tester.equals
(get_global $std/operator-overloading/eq1)
(get_global $std/operator-overloading/eq2)
)
@ -813,7 +960,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 105)
(i32.const 130)
(i32.const 0)
)
(unreachable)
@ -834,7 +981,7 @@
)
)
(set_global $std/operator-overloading/eqf
(call $std/operator-overloading/Tester.equal
(call $std/operator-overloading/Tester.equals
(get_global $std/operator-overloading/eq3)
(get_global $std/operator-overloading/eq4)
)
@ -845,7 +992,186 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 111)
(i32.const 136)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/eq
(call $std/operator-overloading/Tester.notEquals
(get_global $std/operator-overloading/eq1)
(get_global $std/operator-overloading/eq2)
)
)
(if
(get_global $std/operator-overloading/eq)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 140)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/eqf
(call $std/operator-overloading/Tester.notEquals
(get_global $std/operator-overloading/eq3)
(get_global $std/operator-overloading/eq4)
)
)
(if
(i32.ne
(get_global $std/operator-overloading/eqf)
(i32.const 1)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 144)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/gt1
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 2)
(i32.const 2147483647)
)
)
(set_global $std/operator-overloading/gt2
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 1)
(i32.const 0)
)
)
(set_global $std/operator-overloading/gt
(call $std/operator-overloading/Tester.greater
(get_global $std/operator-overloading/gt1)
(get_global $std/operator-overloading/gt2)
)
)
(if
(i32.ne
(get_global $std/operator-overloading/gt)
(i32.const 1)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 150)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/gte1
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 2)
(i32.const 2)
)
)
(set_global $std/operator-overloading/gte2
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 2)
(i32.const 2)
)
)
(set_global $std/operator-overloading/gte
(call $std/operator-overloading/Tester.greaterEquals
(get_global $std/operator-overloading/gte1)
(get_global $std/operator-overloading/gte2)
)
)
(if
(i32.ne
(get_global $std/operator-overloading/gte)
(i32.const 1)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 156)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/le1
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 5)
(i32.const -1)
)
)
(set_global $std/operator-overloading/le2
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 6)
(i32.const 6)
)
)
(set_global $std/operator-overloading/le
(call $std/operator-overloading/Tester.less
(get_global $std/operator-overloading/le1)
(get_global $std/operator-overloading/le2)
)
)
(if
(i32.ne
(get_global $std/operator-overloading/le)
(i32.const 1)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 162)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/leq1
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 4)
(i32.const 3)
)
)
(set_global $std/operator-overloading/leq2
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 4)
(i32.const 3)
)
)
(set_global $std/operator-overloading/leq
(call $std/operator-overloading/Tester.lessEquals
(get_global $std/operator-overloading/leq1)
(get_global $std/operator-overloading/leq2)
)
)
(if
(i32.ne
(get_global $std/operator-overloading/leq)
(i32.const 1)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 168)
(i32.const 0)
)
(unreachable)

View File

@ -45,9 +45,34 @@ class Tester {
}
@operator('==')
static equal(a: Tester, b: Tester): bool {
static equals(a: Tester, b: Tester): bool {
return a.x == b.x && a.y == b.y;
}
@operator('!=')
static notEquals(a: Tester, b: Tester): bool {
return a.x != b.x && a.y != b.y;
}
@operator('>')
static greater(a: Tester, b: Tester): bool {
return a.x > b.x && a.y > b.y;
}
@operator('>=')
static greaterEquals(a: Tester, b: Tester): bool {
return a.x >= b.x && a.y >= b.y;
}
@operator('<')
static less(a: Tester, b: Tester): bool {
return a.x < b.x && a.y < b.y;
}
@operator('<=')
static lessEquals(a: Tester, b: Tester): bool {
return a.x <= b.x && a.y <= b.y;
}
}
// check additional
@ -109,3 +134,35 @@ var eq3 = new Tester(1, 0);
var eq4 = new Tester(0, 1);
var eqf = eq3 == eq4;
assert(eqf == false);
// check falsely non-equal
eq = eq1 != eq2;
assert(eq == false);
// check truthfully non-equal
eqf = eq3 != eq4;
assert(eqf == true);
// check greater
var gt1 = new Tester(2, i32.MAX_VALUE);
var gt2 = new Tester(1, 0);
var gt = gt1 > gt2;
assert(gt == true);
// check greater or equal
var gte1 = new Tester(2, 2);
var gte2 = new Tester(2, 2);
var gte = gte1 >= gte2;
assert(gte == true);
// check less
var le1 = new Tester(5,-1);
var le2 = new Tester(6, 6);
var le = le1 < le2;
assert(le == true);
// check less or equal
var leq1 = new Tester(4, 3);
var leq2 = new Tester(4, 3);
var leq = leq1 <= leq2;
assert(leq == true);

View File

@ -42,6 +42,18 @@
(global $std/operator-overloading/eq3 (mut i32) (i32.const 0))
(global $std/operator-overloading/eq4 (mut i32) (i32.const 0))
(global $std/operator-overloading/eqf (mut i32) (i32.const 0))
(global $std/operator-overloading/gt1 (mut i32) (i32.const 0))
(global $std/operator-overloading/gt2 (mut i32) (i32.const 0))
(global $std/operator-overloading/gt (mut i32) (i32.const 0))
(global $std/operator-overloading/gte1 (mut i32) (i32.const 0))
(global $std/operator-overloading/gte2 (mut i32) (i32.const 0))
(global $std/operator-overloading/gte (mut i32) (i32.const 0))
(global $std/operator-overloading/le1 (mut i32) (i32.const 0))
(global $std/operator-overloading/le2 (mut i32) (i32.const 0))
(global $std/operator-overloading/le (mut i32) (i32.const 0))
(global $std/operator-overloading/leq1 (mut i32) (i32.const 0))
(global $std/operator-overloading/leq2 (mut i32) (i32.const 0))
(global $std/operator-overloading/leq (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 64))
(memory $0 1)
(data (i32.const 4) "\1b\00\00\00s\00t\00d\00/\00o\00p\00e\00r\00a\00t\00o\00r\00-\00o\00v\00e\00r\00l\00o\00a\00d\00i\00n\00g\00.\00t\00s\00")
@ -371,7 +383,7 @@
)
)
)
(func $std/operator-overloading/Tester.equal (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $std/operator-overloading/Tester.equals (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(return
(i32.and
@ -400,7 +412,152 @@
)
)
)
(func $start (; 12 ;) (type $v)
(func $std/operator-overloading/Tester.notEquals (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(return
(i32.and
(if (result i32)
(tee_local $2
(i32.ne
(i32.load
(get_local $0)
)
(i32.load
(get_local $1)
)
)
)
(i32.ne
(i32.load offset=4
(get_local $0)
)
(i32.load offset=4
(get_local $1)
)
)
(get_local $2)
)
(i32.const 1)
)
)
)
(func $std/operator-overloading/Tester.greater (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(return
(i32.and
(if (result i32)
(tee_local $2
(i32.gt_s
(i32.load
(get_local $0)
)
(i32.load
(get_local $1)
)
)
)
(i32.gt_s
(i32.load offset=4
(get_local $0)
)
(i32.load offset=4
(get_local $1)
)
)
(get_local $2)
)
(i32.const 1)
)
)
)
(func $std/operator-overloading/Tester.greaterEquals (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(return
(i32.and
(if (result i32)
(tee_local $2
(i32.ge_s
(i32.load
(get_local $0)
)
(i32.load
(get_local $1)
)
)
)
(i32.ge_s
(i32.load offset=4
(get_local $0)
)
(i32.load offset=4
(get_local $1)
)
)
(get_local $2)
)
(i32.const 1)
)
)
)
(func $std/operator-overloading/Tester.less (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(return
(i32.and
(if (result i32)
(tee_local $2
(i32.lt_s
(i32.load
(get_local $0)
)
(i32.load
(get_local $1)
)
)
)
(i32.lt_s
(i32.load offset=4
(get_local $0)
)
(i32.load offset=4
(get_local $1)
)
)
(get_local $2)
)
(i32.const 1)
)
)
)
(func $std/operator-overloading/Tester.lessEquals (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(return
(i32.and
(if (result i32)
(tee_local $2
(i32.le_s
(i32.load
(get_local $0)
)
(i32.load
(get_local $1)
)
)
)
(i32.le_s
(i32.load offset=4
(get_local $0)
)
(i32.load offset=4
(get_local $1)
)
)
(get_local $2)
)
(i32.const 1)
)
)
)
(func $start (; 17 ;) (type $v)
(local $0 i32)
(set_global $~lib/allocator/arena/startOffset
(i32.and
@ -464,7 +621,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 57)
(i32.const 82)
(i32.const 0)
)
(unreachable)
@ -517,7 +674,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 63)
(i32.const 88)
(i32.const 0)
)
(unreachable)
@ -570,7 +727,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 69)
(i32.const 94)
(i32.const 0)
)
(unreachable)
@ -623,7 +780,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 75)
(i32.const 100)
(i32.const 0)
)
(unreachable)
@ -676,7 +833,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 81)
(i32.const 106)
(i32.const 0)
)
(unreachable)
@ -729,7 +886,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 87)
(i32.const 112)
(i32.const 0)
)
(unreachable)
@ -782,7 +939,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 93)
(i32.const 118)
(i32.const 0)
)
(unreachable)
@ -835,7 +992,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 99)
(i32.const 124)
(i32.const 0)
)
(unreachable)
@ -856,7 +1013,7 @@
)
)
(set_global $std/operator-overloading/eq
(call $std/operator-overloading/Tester.equal
(call $std/operator-overloading/Tester.equals
(get_global $std/operator-overloading/eq1)
(get_global $std/operator-overloading/eq2)
)
@ -872,7 +1029,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 105)
(i32.const 130)
(i32.const 0)
)
(unreachable)
@ -893,7 +1050,7 @@
)
)
(set_global $std/operator-overloading/eqf
(call $std/operator-overloading/Tester.equal
(call $std/operator-overloading/Tester.equals
(get_global $std/operator-overloading/eq3)
(get_global $std/operator-overloading/eq4)
)
@ -909,7 +1066,201 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 111)
(i32.const 136)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/eq
(call $std/operator-overloading/Tester.notEquals
(get_global $std/operator-overloading/eq1)
(get_global $std/operator-overloading/eq2)
)
)
(if
(i32.eqz
(i32.eq
(get_global $std/operator-overloading/eq)
(i32.const 0)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 140)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/eqf
(call $std/operator-overloading/Tester.notEquals
(get_global $std/operator-overloading/eq3)
(get_global $std/operator-overloading/eq4)
)
)
(if
(i32.eqz
(i32.eq
(get_global $std/operator-overloading/eqf)
(i32.const 1)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 144)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/gt1
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 2)
(i32.const 2147483647)
)
)
(set_global $std/operator-overloading/gt2
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 1)
(i32.const 0)
)
)
(set_global $std/operator-overloading/gt
(call $std/operator-overloading/Tester.greater
(get_global $std/operator-overloading/gt1)
(get_global $std/operator-overloading/gt2)
)
)
(if
(i32.eqz
(i32.eq
(get_global $std/operator-overloading/gt)
(i32.const 1)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 150)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/gte1
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 2)
(i32.const 2)
)
)
(set_global $std/operator-overloading/gte2
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 2)
(i32.const 2)
)
)
(set_global $std/operator-overloading/gte
(call $std/operator-overloading/Tester.greaterEquals
(get_global $std/operator-overloading/gte1)
(get_global $std/operator-overloading/gte2)
)
)
(if
(i32.eqz
(i32.eq
(get_global $std/operator-overloading/gte)
(i32.const 1)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 156)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/le1
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 5)
(i32.const -1)
)
)
(set_global $std/operator-overloading/le2
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 6)
(i32.const 6)
)
)
(set_global $std/operator-overloading/le
(call $std/operator-overloading/Tester.less
(get_global $std/operator-overloading/le1)
(get_global $std/operator-overloading/le2)
)
)
(if
(i32.eqz
(i32.eq
(get_global $std/operator-overloading/le)
(i32.const 1)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 162)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/leq1
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 4)
(i32.const 3)
)
)
(set_global $std/operator-overloading/leq2
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 4)
(i32.const 3)
)
)
(set_global $std/operator-overloading/leq
(call $std/operator-overloading/Tester.lessEquals
(get_global $std/operator-overloading/leq1)
(get_global $std/operator-overloading/leq2)
)
)
(if
(i32.eqz
(i32.eq
(get_global $std/operator-overloading/leq)
(i32.const 1)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 168)
(i32.const 0)
)
(unreachable)