Skip to content

Commit

Permalink
fix #508
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghuan committed Apr 23, 2024
1 parent 006377b commit 30bfd4a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CSharp.lua/CoreSystem.Lua/CoreSystem/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,7 @@ ValueTuple.__call = tupleCreate
System.ValueTuple = ValueTupleFn

local function recordEquals(t, other)
if t == other then return true end
if getmetatable(t) == getmetatable(other) then
for k, v in pairs(t) do
if not equalsObj(v, other[k]) then
Expand All @@ -1441,6 +1442,10 @@ local function recordEquals(t, other)
return false
end

local function recordNotEquals(t, other)
return not recordEquals(t, other)
end

local function recordPrintMembers(this, builder)
local p = pack(this.__members__())
local n = p.n
Expand Down Expand Up @@ -1501,6 +1506,8 @@ end
defCls("System.RecordType", {
__eq = recordEquals,
__clone__ = ValueType.__clone__,
op_Equality = recordEquals,
op_Inequality = recordNotEquals,
GetHashCode = ValueType.GetHashCode,
Equals = recordEquals,
PrintMembers = recordPrintMembers,
Expand All @@ -1510,6 +1517,8 @@ defCls("System.RecordType", {

defStc("System.RecordValueType", {
__eq = recordEquals,
op_Equality = recordEquals,
op_Inequality = recordNotEquals,
Equals = recordEquals,
PrintMembers = recordPrintMembers,
ToString = recordToString,
Expand Down

0 comments on commit 30bfd4a

Please sign in to comment.