Reduced the number of IR methods
All checks were successful
/ test (push) Successful in 15s

This commit is contained in:
Eduard Urbach 2025-07-03 19:25:07 +02:00
parent 72ace483e4
commit 0eaeb726b9
Signed by: akyoto
GPG key ID: 49226B848C78F6C8
8 changed files with 112 additions and 101 deletions

View file

@ -11,12 +11,12 @@ import (
func TestBinaryOp(t *testing.T) {
fn := ssa.IR{}
a := fn.AppendInt(1)
b := fn.AppendInt(2)
a := fn.Append(&ssa.Int{Int: 1})
b := fn.Append(&ssa.Int{Int: 2})
c := fn.Append(&ssa.BinaryOp{Op: token.Add, Left: a, Right: b})
fn.AddBlock()
d := fn.AppendInt(3)
e := fn.AppendInt(4)
d := fn.Append(&ssa.Int{Int: 3})
e := fn.Append(&ssa.Int{Int: 4})
f := fn.Append(&ssa.BinaryOp{Op: token.Add, Left: d, Right: e})
assert.Equal(t, c.String(), "1 + 2")
@ -26,11 +26,11 @@ func TestBinaryOp(t *testing.T) {
func TestBinaryOpEquals(t *testing.T) {
fn := ssa.IR{}
one := fn.AppendInt(1)
two := fn.AppendInt(2)
one := fn.Append(&ssa.Int{Int: 1})
two := fn.Append(&ssa.Int{Int: 2})
binOp := fn.Append(&ssa.BinaryOp{Op: token.Add, Left: one, Right: two})
oneDup := fn.AppendInt(1)
twoDup := fn.AppendInt(2)
oneDup := fn.Append(&ssa.Int{Int: 1})
twoDup := fn.Append(&ssa.Int{Int: 2})
binOpDup := fn.Append(&ssa.BinaryOp{Op: token.Add, Left: oneDup, Right: twoDup})
binOpDiff := fn.Append(&ssa.BinaryOp{Op: token.Add, Left: oneDup, Right: oneDup})