mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 16:29:21 +00:00
correct type for word array initialization value
This commit is contained in:
parent
6edd5f9b30
commit
314e5ca9e2
@ -56,11 +56,17 @@ class ConstantFolding(private val namespace: INameScope, private val heap: HeapV
|
||||
val litval = decl.value as? LiteralValue
|
||||
val size = decl.arrayspec!!.size()
|
||||
if(litval!=null && litval.isArray) {
|
||||
// array initializer value is an array already, keep as-is
|
||||
// array initializer value is an array already, keep as-is (or convert to WORDs if needed)
|
||||
if(litval.heapId!=null) {
|
||||
if (decl.datatype == DataType.MATRIX && litval.type != DataType.MATRIX) {
|
||||
val array = heap.get(litval.heapId).copy(type = DataType.MATRIX)
|
||||
heap.update(litval.heapId, array)
|
||||
} else if(decl.datatype==DataType.ARRAY_W && litval.type == DataType.ARRAY) {
|
||||
val array = heap.get(litval.heapId)
|
||||
if(array.array!=null) {
|
||||
heap.update(litval.heapId, HeapValues.HeapValue(DataType.ARRAY_W, null, array.array, null))
|
||||
decl.value = LiteralValue(decl.datatype, heapId = litval.heapId, position = litval.position)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (size != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user