mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 16:49:31 +00:00
Change equality test to reference comparison for mutable values
This commit is contained in:
parent
b50d783928
commit
bac5cdde01
8 changed files with 315 additions and 87 deletions
|
|
@ -1,19 +1,29 @@
|
|||
:a = [1=2]
|
||||
::a = [1=2]
|
||||
|
||||
0 = {a == [5=2]}
|
||||
0 = {a == [5=2]!constant}
|
||||
|
||||
0 = {a == [1=3]}
|
||||
0 = {a == [1=3]!constant}
|
||||
|
||||
1 = {a == [1=2]}
|
||||
1 = {a == [1=2]!constant}
|
||||
|
||||
:b = [1,2,3]
|
||||
::b = [1,2,3]
|
||||
|
||||
0 = {b == a}
|
||||
|
||||
0 = {b == []}
|
||||
0 = {b == []!constant}
|
||||
|
||||
0 = {b == [3,1,2]}
|
||||
0 = {b == [3,1,2]!constant}
|
||||
|
||||
0 = {b == [1,2,3,4]}
|
||||
0 = {b == [1,2,3,4]!constant}
|
||||
|
||||
1 = {b == [1,2,3]}
|
||||
1 = {b == [1,2,3]!constant}
|
||||
|
||||
:c = [1,2,3]
|
||||
|
||||
0 = {c == b}
|
||||
|
||||
1 = {c!constant == b}
|
||||
|
||||
::d = [1,2,3]
|
||||
|
||||
1 = {d == b}
|
||||
|
|
|
|||
|
|
@ -1,101 +1,148 @@
|
|||
local _={}
|
||||
_[41]={}
|
||||
_[40]={}
|
||||
_[39]={}
|
||||
_[38]={}
|
||||
_[37]={}
|
||||
_[36]={}
|
||||
_[35]={}
|
||||
_[34]={}
|
||||
_[33]={tags=_[41],text="1"}
|
||||
_[32]={tags=_[41],text="1 = "}
|
||||
_[31]={tags=_[40],text="0"}
|
||||
_[30]={tags=_[40],text="0 = "}
|
||||
_[29]={tags=_[39],text="0"}
|
||||
_[28]={tags=_[39],text="0 = "}
|
||||
_[27]={tags=_[38],text="0"}
|
||||
_[26]={tags=_[38],text="0 = "}
|
||||
_[25]={tags=_[37],text="0"}
|
||||
_[24]={tags=_[37],text="0 = "}
|
||||
_[23]={tags=_[36],text="1"}
|
||||
_[22]={tags=_[36],text="1 = "}
|
||||
_[21]={tags=_[35],text="0"}
|
||||
_[20]={tags=_[35],text="0 = "}
|
||||
_[19]={tags=_[34],text="0"}
|
||||
_[18]={tags=_[34],text="0 = "}
|
||||
_[67]={}
|
||||
_[66]={}
|
||||
_[65]={}
|
||||
_[64]={}
|
||||
_[63]={}
|
||||
_[62]={}
|
||||
_[61]={}
|
||||
_[60]={}
|
||||
_[59]={}
|
||||
_[58]={}
|
||||
_[57]={}
|
||||
_[56]={}
|
||||
_[55]={}
|
||||
_[54]={}
|
||||
_[53]={}
|
||||
_[52]={}
|
||||
_[51]={}
|
||||
_[50]={}
|
||||
_[49]={}
|
||||
_[48]={}
|
||||
_[47]={}
|
||||
_[46]={}
|
||||
_[45]={tags=_[67],text="1"}
|
||||
_[44]={tags=_[66],text="1 = "}
|
||||
_[43]={tags=_[65],text="1"}
|
||||
_[42]={tags=_[64],text="1 = "}
|
||||
_[41]={tags=_[63],text="0"}
|
||||
_[40]={tags=_[62],text="0 = "}
|
||||
_[39]={tags=_[61],text="1"}
|
||||
_[38]={tags=_[60],text="1 = "}
|
||||
_[37]={tags=_[59],text="0"}
|
||||
_[36]={tags=_[58],text="0 = "}
|
||||
_[35]={tags=_[57],text="0"}
|
||||
_[34]={tags=_[56],text="0 = "}
|
||||
_[33]={tags=_[55],text="0"}
|
||||
_[32]={tags=_[54],text="0 = "}
|
||||
_[31]={tags=_[53],text="0"}
|
||||
_[30]={tags=_[52],text="0 = "}
|
||||
_[29]={tags=_[51],text="1"}
|
||||
_[28]={tags=_[50],text="1 = "}
|
||||
_[27]={tags=_[49],text="0"}
|
||||
_[26]={tags=_[48],text="0 = "}
|
||||
_[25]={tags=_[47],text="0"}
|
||||
_[24]={tags=_[46],text="0 = "}
|
||||
_[23]={_[44],_[45]}
|
||||
_[22]={_[42],_[43]}
|
||||
_[21]={_[40],_[41]}
|
||||
_[20]={_[38],_[39]}
|
||||
_[19]={_[36],_[37]}
|
||||
_[18]={_[34],_[35]}
|
||||
_[17]={_[32],_[33]}
|
||||
_[16]={_[30],_[31]}
|
||||
_[15]={_[28],_[29]}
|
||||
_[14]={_[26],_[27]}
|
||||
_[13]={_[24],_[25]}
|
||||
_[12]={_[22],_[23]}
|
||||
_[11]={_[20],_[21]}
|
||||
_[10]={_[18],_[19]}
|
||||
_[9]={"return"}
|
||||
_[8]={"text",_[17]}
|
||||
_[7]={"text",_[16]}
|
||||
_[6]={"text",_[15]}
|
||||
_[5]={"text",_[14]}
|
||||
_[4]={"text",_[13]}
|
||||
_[3]={"text",_[12]}
|
||||
_[2]={"text",_[11]}
|
||||
_[1]={"text",_[10]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9]}
|
||||
_[12]={"return"}
|
||||
_[11]={"text",_[23]}
|
||||
_[10]={"text",_[22]}
|
||||
_[9]={"text",_[21]}
|
||||
_[8]={"text",_[20]}
|
||||
_[7]={"text",_[19]}
|
||||
_[6]={"text",_[18]}
|
||||
_[5]={"text",_[17]}
|
||||
_[4]={"text",_[16]}
|
||||
_[3]={"text",_[15]}
|
||||
_[2]={"text",_[14]}
|
||||
_[1]={"text",_[13]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9],_[10],_[11],_[12]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
tags = {},
|
||||
text = "1 = "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
tags = {},
|
||||
text = "1 = "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "1 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "1 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "return" }
|
||||
|
|
|
|||
23
test/tests/object comparaison.ans
Normal file
23
test/tests/object comparaison.ans
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
% class
|
||||
:a:b = "foo"
|
||||
:c = "bar"
|
||||
|
||||
:o = class
|
||||
:a = class
|
||||
::b = class
|
||||
|
||||
0 = {o == a}
|
||||
0 = {o == b}
|
||||
1 = {o!constant == b}
|
||||
|
||||
~ o.b := "haha"
|
||||
|
||||
0 = {o!constant == b}
|
||||
|
||||
~ a.b := "haha"
|
||||
|
||||
1 = {o!constant == a!constant}
|
||||
|
||||
~ o.b := "foo"
|
||||
|
||||
0 = {o!constant == b}
|
||||
78
test/tests/object comparaison.lua
Normal file
78
test/tests/object comparaison.lua
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
local _={}
|
||||
_[33]={}
|
||||
_[32]={}
|
||||
_[31]={}
|
||||
_[30]={}
|
||||
_[29]={}
|
||||
_[28]={}
|
||||
_[27]={}
|
||||
_[26]={}
|
||||
_[25]={}
|
||||
_[24]={}
|
||||
_[23]={}
|
||||
_[22]={}
|
||||
_[21]={tags=_[33],text="0"}
|
||||
_[20]={tags=_[32],text="0 = "}
|
||||
_[19]={tags=_[31],text="1"}
|
||||
_[18]={tags=_[30],text="1 = "}
|
||||
_[17]={tags=_[29],text="0"}
|
||||
_[16]={tags=_[28],text="0 = "}
|
||||
_[15]={tags=_[27],text="1"}
|
||||
_[14]={tags=_[26],text="1 = "}
|
||||
_[13]={tags=_[25],text="0"}
|
||||
_[12]={tags=_[24],text="0 = "}
|
||||
_[11]={tags=_[23],text="0"}
|
||||
_[10]={tags=_[22],text="0 = "}
|
||||
_[9]={_[20],_[21]}
|
||||
_[8]={_[18],_[19]}
|
||||
_[7]={_[16],_[17]}
|
||||
_[6]={_[10],_[11],_[12],_[13],_[14],_[15]}
|
||||
_[5]={"return"}
|
||||
_[4]={"text",_[9]}
|
||||
_[3]={"text",_[8]}
|
||||
_[2]={"text",_[7]}
|
||||
_[1]={"text",_[6]}
|
||||
return {_[1],_[2],_[3],_[4],_[5]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "1 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "1 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -14,7 +14,7 @@ _[12]={tags=_[21],text="hoho"}
|
|||
_[11]={tags=_[20],text="bar"}
|
||||
_[10]={tags=_[19],text=" == "}
|
||||
_[9]={tags=_[18],text="bar"}
|
||||
_[8]={tags=_[17],text="%object constructor.class::&object constructor.class"}
|
||||
_[8]={tags=_[17],text="%object constructor.class(c=hoho)::&object constructor.class"}
|
||||
_[7]={tags=_[16],text=", "}
|
||||
_[6]={tags=_[15],text="%object constructor.class::&object constructor.class"}
|
||||
_[5]={_[9],_[10],_[11],_[12],_[13],_[14]}
|
||||
|
|
@ -32,7 +32,7 @@ return {_[1],_[2],_[3]}
|
|||
text = ", "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "%object constructor.class::&object constructor.class"
|
||||
text = "%object constructor.class(c=hoho)::&object constructor.class"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue