bcc
bcc copied to clipboard
More struct issues.
Might be related to #532
SuperStrict
Framework Brl.StandardIO
Local k:TKeyWrapper = New TKeyWrapper
Type TKeyWrapper
Field keyHoldInformation:SKeyHoldInformation[5]
Field key100:SKeyHoldInformation
Method New()
For Local i:Int = 0 To 4
Print "Init("+i+")"
keyHoldInformation[i].Init(i)
Print " keyHoldInformation["+i+"].key = " + keyHoldInformation[i].key + " id="+keyHoldInformation[i].id
Next
Print "Init(100)"
key100.Init(100)
Print " key100.key = " + key100.key + " id="+key100.id
End Method
End Type
Struct SKeyHoldInformation
Field key:Int
Field id:Int
Global _lastID:Int = 0
Method New()
_lastID :+ 1
id = _lastID
End Method
Method Init(key:Int)
Self.key = key
Print " called init with : " + key +" self.key="+Self.key
End Method
End Struct
Output:
Executing:untitled1.debug
Init(0)
called init with : 0 self.key=0
keyHoldInformation[0].key = 0 id=1
Init(1)
called init with : 1 self.key=1
keyHoldInformation[1].key = 0 id=2
Init(2)
called init with : 2 self.key=2
keyHoldInformation[2].key = 0 id=3
Init(3)
called init with : 3 self.key=3
keyHoldInformation[3].key = 0 id=4
Init(4)
called init with : 4 self.key=4
keyHoldInformation[4].key = 0 id=5
Init(100)
called init with : 100 self.key=100
key100.key = 100 id=6
As you can see, only the struct which is "not in the array" get's their key assigned. I assume all of them should get their keys assigned.