|
|
@ -170,7 +170,7 @@ function getStructMembers (typeName, stateDefinitions) { |
|
|
|
var offsets = computeOffsets(dec.children, stateDefinitions) |
|
|
|
var offsets = computeOffsets(dec.children, stateDefinitions) |
|
|
|
return { |
|
|
|
return { |
|
|
|
members: offsets.typesOffsets, |
|
|
|
members: offsets.typesOffsets, |
|
|
|
storageBytes: offsets.endLocation.slot |
|
|
|
storageSlots: offsets.endLocation.slot |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -238,14 +238,14 @@ function computeOffsets (types, stateItems, cb) { |
|
|
|
for (var i in types) { |
|
|
|
for (var i in types) { |
|
|
|
var variable = types[i] |
|
|
|
var variable = types[i] |
|
|
|
var type = parseType(variable.attributes.type, stateItems) |
|
|
|
var type = parseType(variable.attributes.type, stateItems) |
|
|
|
if (location.offset + type.storageBytes > 32) { |
|
|
|
|
|
|
|
location.slot++ |
|
|
|
|
|
|
|
location.offset = 0 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!type) { |
|
|
|
if (!type) { |
|
|
|
console.log('unable to retrieve decode info of ' + variable.attributes.type) |
|
|
|
console.log('unable to retrieve decode info of ' + variable.attributes.type) |
|
|
|
return null |
|
|
|
return null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (location.offset + type.storageBytes > 32) { |
|
|
|
|
|
|
|
location.slot++ |
|
|
|
|
|
|
|
location.offset = 0 |
|
|
|
|
|
|
|
} |
|
|
|
ret.push({ |
|
|
|
ret.push({ |
|
|
|
name: variable.attributes.name, |
|
|
|
name: variable.attributes.name, |
|
|
|
type: type, |
|
|
|
type: type, |
|
|
|