manage immutable

pull/5370/head
yann300 3 years ago committed by joseph izang
parent 7f2db4d36a
commit d6a32e373f
  1. 11
      libs/remix-debug/src/solidity-decoder/decodeInfo.ts
  2. 4
      libs/remix-debug/src/solidity-decoder/stateDecoder.ts

@ -336,7 +336,9 @@ function computeOffsets (types, stateDefinitions, contractName, location) {
console.log('unable to retrieve decode info of ' + variable.typeDescriptions.typeString)
return null
}
if (!variable.constant && storagelocation.offset + type.storageBytes > 32) {
const immutable = variable.mutability === 'immutable'
const hasStorageSlots = !immutable && !variable.constant
if (hasStorageSlots && storagelocation.offset + type.storageBytes > 32) {
storagelocation.slot++
storagelocation.offset = 0
}
@ -344,12 +346,13 @@ function computeOffsets (types, stateDefinitions, contractName, location) {
name: variable.name,
type: type,
constant: variable.constant,
immutable,
storagelocation: {
offset: variable.constant ? 0 : storagelocation.offset,
slot: variable.constant ? 0 : storagelocation.slot
offset: !hasStorageSlots ? 0 : storagelocation.offset,
slot: !hasStorageSlots ? 0 : storagelocation.slot
}
})
if (!variable.constant) {
if (hasStorageSlots) {
if (type.storageSlots === 1 && storagelocation.offset + type.storageBytes <= 32) {
storagelocation.offset += type.storageBytes
} else {

@ -15,9 +15,13 @@ export async function decodeState (stateVars, storageResolver) {
try {
const decoded = await stateVar.type.decodeFromStorage(stateVar.storagelocation, storageResolver)
decoded.constant = stateVar.constant
decoded.immutable = stateVar.immutable
if (decoded.constant) {
decoded.value = '<constant>'
}
if (decoded.immutable) {
decoded.value = '<immutable>'
}
ret[stateVar.name] = decoded
} catch (e) {
console.log(e)

Loading…
Cancel
Save