mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-01-01 13:30:50 +00:00
Fixed problem with size calculation of arrays inside structs. Closes #458
This commit is contained in:
parent
c33d140628
commit
a99256645a
@ -63,10 +63,11 @@ public class SymbolTypeStruct implements SymbolType {
|
||||
|
||||
public static int getMemberSizeBytes(SymbolType memberType, ConstantValue arraySize, ProgramScope programScope) {
|
||||
if(arraySize!=null) {
|
||||
final SymbolType elementType = ((SymbolTypePointer) memberType).getElementType();
|
||||
if(programScope != null) {
|
||||
ConstantLiteral sizeLiteral = arraySize.calculateLiteral(programScope);
|
||||
if(sizeLiteral instanceof ConstantInteger) {
|
||||
return memberType.getSizeBytes() * ((ConstantInteger) sizeLiteral).getInteger().intValue();
|
||||
return elementType.getSizeBytes() * ((ConstantInteger) sizeLiteral).getInteger().intValue();
|
||||
}
|
||||
} else {
|
||||
return 5; // Add a token size
|
||||
|
Loading…
Reference in New Issue
Block a user