remix-debug/src/solidity-decoder/astHelper.js
function extractStateDefinitions (contractName, sourcesList, contracts) {
  if (!contracts) {
    contracts = extractContractDefinitions(sourcesList)
  }
  var node = contracts.contractsByName[contractName]
  if (node) {
    var stateItems = []
    var stateVar = []
    var baseContracts = getLinearizedBaseContracts(node.id, contracts.contractsById)
    baseContracts.reverse()
    for (var k in baseContracts) {
      var ctr = baseContracts[k]
      for (var i in ctr.children) {
        var item = ctr.children[i]
        stateItems.push(item)
        if (item.name === 'VariableDeclaration') {
          stateVar.push(item)
        }
      }
    }
    return {
      stateDefinitions: stateItems,
      stateVariables: stateVar
    }
  }
  return null
}
function extractStateDefinitions (contractName, sourcesList, contracts) {
  if (!contracts) {
    contracts = extractContractDefinitions(sourcesList)
  }
  var node = contracts.contractsByName[contractName]
  if (node) {
    var stateItems = []
    var stateVar = []
    var baseContracts = getLinearizedBaseContracts(node.id, contracts.contractsById)
    baseContracts.reverse()
    for (var k in baseContracts) {
      var ctr = baseContracts[k]
      for (var i in ctr.children) {
        var item = ctr.children[i]
        stateItems.push(item)
        if (item.name === 'VariableDeclaration') {
          stateVar.push(item)
        }
      }
    }
    return {
      stateDefinitions: stateItems,
      stateVariables: stateVar
    }
  }
  return null
}
function extractStateDefinitions ( contractName , sourcesList , contracts ) { if ( ! contracts ) { contracts = extractContractDefinitions ( sourcesList ) } var node = contracts . contractsByName [ contractName ] if ( node ) { var stateItems = [ ] var stateVar = [ ] var baseContracts = getLinearizedBaseContracts ( node . id , contracts . contractsById ) baseContracts . reverse ( ) for ( var k in baseContracts ) { var ctr = baseContracts [ k ] for ( var i in ctr . children ) { var item = ctr . children [ i ] stateItems . push ( item ) if ( item . name === 'VariableDeclaration' ) { stateVar . push ( item ) } } } return { stateDefinitions : stateItems , stateVariables : stateVar } } return null }
return state var and type definition of the given contract

@param {String} contractName - contract for which state var should be resolved
@param {Object} sourcesList - sources list (containing root AST node)
@param {Object} [contracts] - map of contract definitions (contains contractsById, contractsByName)
@return {Object} - return an object containing: stateItems - list of all the children node of the @arg contractName
stateVariables - list of all the variable declaration of the @arg contractName
return state var and type definition of the given contract