Skip to content

Commit fa210fc

Browse files
committed
fix nullable type Operator & some libs class add funll namespace name
1 parent d77c506 commit fa210fc

23 files changed

Lines changed: 371 additions & 105 deletions

‎CSharp.lua/CoreSystem.Lua/All.lua‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ return function(dir, conf)
4747
load("Console")
4848
load("IO.File")
4949
load("Reflection.Assembly")
50-
load("Threads.Timer")
51-
load("Threads.Thread")
52-
load("Threads.Task")
50+
load("Threading.Timer")
51+
load("Threading.Thread")
52+
load("Threading.Task")
5353
load("Utilities")
5454
load("Globalization.Globalization")
5555
load("Numerics.HashCodeHelper")

‎CSharp.lua/CoreSystem.Lua/CoreSystem/Collections/Dictionary.lua‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,20 @@ local KeyValuePair = {
121121
end
122122
}
123123

124-
KeyValuePairFn = System.defStc("System.KeyValuePair", function(TKey, TValue)
124+
KeyValuePairFn = System.defStc("System.Collections.Generic.KeyValuePair", function(TKey, TValue)
125125
local cls = {
126126
__genericTKey__ = TKey,
127127
__genericTValue__ = TValue,
128128
}
129129
return cls
130130
end, KeyValuePair)
131+
System.KeyValuePair = KeyValuePairFn
131132

132133
local function isKeyValuePair(t)
133134
return getmetatable(getmetatable(t)) == KeyValuePair
134135
end
135136

136-
local DictionaryEnumerator = define("System.DictionaryEnumerator", {
137+
local DictionaryEnumerator = define("System.Collections.Generic.DictionaryEnumerator", {
137138
getCurrent = System.getCurrent,
138139
Dispose = System.emptyFn,
139140
MoveNext = function (this)
@@ -194,7 +195,7 @@ local function dictionaryEnumerator(t, kind)
194195
return setmetatable(en, DictionaryEnumerator)
195196
end
196197

197-
local DictionaryCollection = define("System.DictionaryCollection", function (T)
198+
local DictionaryCollection = define("System.Collections.Generic.DictionaryCollection", function (T)
198199
return {
199200
__inherits__ = { System.ICollection_1(T), System.IReadOnlyCollection_1(T), System.ICollection },
200201
__genericT__ = T
@@ -397,7 +398,7 @@ function System.dictionaryFromTable(t, TKey, TValue)
397398
return setmetatable(t, Dictionary(TKey, TValue))
398399
end
399400

400-
define("System.Dictionary", function(TKey, TValue)
401+
System.Dictionary = define("System.Collections.Generic.Dictionary", function(TKey, TValue)
401402
return {
402403
__inherits__ = { System.IDictionary_2(TKey, TValue), System.IDictionary, System.IReadOnlyDictionary_2(TKey, TValue) },
403404
__genericT__ = KeyValuePairFn(TKey, TValue),

‎CSharp.lua/CoreSystem.Lua/CoreSystem/Collections/HashSet.lua‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ function System.hashSetFromTable(t, T)
306306
return setmetatable(t, HashSet(T))
307307
end
308308

309-
System.define("System.HashSet", function(T)
309+
System.HashSet = System.define("System.Collections.Generic.HashSet", function(T)
310310
return {
311311
__inherits__ = { System.ICollection_1(T), System.ISet_1(T) },
312312
__genericT__ = T,

‎CSharp.lua/CoreSystem.Lua/CoreSystem/Collections/LinkedList.lua‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ local EqualityComparer = System.EqualityComparer
2626
local setmetatable = setmetatable
2727
local select = select
2828

29-
local LinkedListNode = define("System.LinkedListNode", {
29+
local LinkedListNode = define("System.Collections.Generic.LinkedListNode", {
3030
__ctor__ = function (this, value)
3131
this.Value = value
3232
end,
@@ -45,6 +45,7 @@ local LinkedListNode = define("System.LinkedListNode", {
4545
return prev
4646
end
4747
})
48+
System.LinkedListNode = LinkedListNode
4849

4950
local function newLinkedListNode(list, value)
5051
return setmetatable({ List = assert(list), Value = value }, LinkedListNode)
@@ -336,7 +337,7 @@ function System.linkedListFromTable(t, T)
336337
return setmetatable(t, LinkedList(T))
337338
end
338339

339-
define("System.LinkedList", function(T)
340+
System.LinkedList = define("System.Collections.Generic.LinkedList", function(T)
340341
return {
341342
__inherits__ = { System.ICollection_1(T), System.ICollection },
342343
__genericT__ = T,

‎CSharp.lua/CoreSystem.Lua/CoreSystem/Collections/List.lua‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ function System.listFromTable(t, T)
6363
return setmetatable(t, List(T))
6464
end
6565

66-
System.define("System.List", function(T)
66+
System.List = System.define("System.Collections.Generic.List", function(T)
6767
return {
6868
__inherits__ = { System.IList_1(T), System.IReadOnlyList_1(T), System.IList },
6969
__genericT__ = T,
7070
}
71-
end, List)
71+
end, List)

‎CSharp.lua/CoreSystem.Lua/CoreSystem/Collections/Queue.lua‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ function System.queueFromTable(t, T)
3535
return setmetatable(t, Queue(T))
3636
end
3737

38-
System.define("System.Queue", function(T)
38+
System.Queue = System.define("System.Collections.Generic.Queue", function(T)
3939
return {
4040
__inherits__ = { System.IEnumerable_1(T), System.ICollection },
4141
__genericT__ = T,
4242
}
43-
end, Queue)
43+
end, Queue)

‎CSharp.lua/CoreSystem.Lua/CoreSystem/Collections/Stack.lua‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ function System.stackFromTable(t, T)
3434
return setmetatable(t, Stack(T))
3535
end
3636

37-
System.define("System.Stack", function(T)
37+
System.Stack = System.define("System.Collections.Generic.Stack", function(T)
3838
return {
3939
__inherits__ = { System.IEnumerable_1(T), System.ICollection },
4040
__genericT__ = T,
4141
}
42-
end, Stack)
42+
end, Stack)

‎CSharp.lua/CoreSystem.Lua/CoreSystem/Core.lua‎

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -884,27 +884,6 @@ function System.ToSingle(v, checked)
884884
end
885885
end
886886

887-
function System.orOfNull(x, y)
888-
if x == nil or y == nil then
889-
return nil
890-
end
891-
return x or y
892-
end
893-
894-
function System.andOfNull(x, y)
895-
if x == nil or y == nil then
896-
return nil
897-
end
898-
return x and y
899-
end
900-
901-
function System.xorOfBoolNull(x, y)
902-
if x == nil or y == nil then
903-
return nil
904-
end
905-
return x ~= y
906-
end
907-
908887
function System.using(t, f)
909888
local dispose = t and t.Dispose
910889
if dispose ~= nil then
@@ -1188,7 +1167,18 @@ ValueType = {
11881167

11891168
defCls("System.ValueType", ValueType)
11901169

1191-
local AnonymousType = defCls("System.AnonymousType", {})
1170+
local AnonymousType
1171+
AnonymousType = defCls("System.AnonymousType", {
1172+
EqualsObj = function (this, obj)
1173+
if getmetatable(obj) ~= AnonymousType then return false end
1174+
for k, v in pairs(this) do
1175+
if not equalsObj(v, obj[k]) then
1176+
return false
1177+
end
1178+
end
1179+
return true
1180+
end
1181+
})
11921182

11931183
function System.anonymousType(t)
11941184
return setmetatable(t, AnonymousType)

CSharp.lua/CoreSystem.Lua/CoreSystem/Threads/Task.lua renamed to CSharp.lua/CoreSystem.Lua/CoreSystem/Threading/Task.lua

File renamed without changes.

CSharp.lua/CoreSystem.Lua/CoreSystem/Threads/Thread.lua renamed to CSharp.lua/CoreSystem.Lua/CoreSystem/Threading/Thread.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ local cyield = coroutine.yield
3636

3737
local mainThread
3838

39-
local ThreadStateException = define("System.ThreadStateException", {
39+
local ThreadStateException = define("System.Threading.ThreadStateException", {
4040
__tostring = Exception.ToString,
4141
__inherits__ = { Exception },
4242

@@ -45,7 +45,7 @@ local ThreadStateException = define("System.ThreadStateException", {
4545
end
4646
})
4747

48-
local ThreadAbortException = define("System.ThreadAbortException", {
48+
local ThreadAbortException = define("System.Threading.ThreadAbortException", {
4949
__tostring = Exception.ToString,
5050
__inherits__ = { Exception },
5151
__ctor__ = function(this, message, innerException)
@@ -99,7 +99,7 @@ local function run(t, obj)
9999
end)
100100
end
101101

102-
local Thread = define("System.Thread", {
102+
local Thread = define("System.Threading.Thread", {
103103
IsBackground = false,
104104
IsThreadPoolThread = false,
105105
Priority = 2,
@@ -193,3 +193,7 @@ local Thread = define("System.Thread", {
193193

194194
mainThread = setmetatable({ id = getThreadId() }, Thread)
195195
currentThread = mainThread
196+
197+
System.ThreadStateException = ThreadStateException
198+
System.ThreadAbortException = ThreadAbortException
199+
System.Thread = Thread

0 commit comments

Comments
 (0)