no need to test the length

pull/7/head
yann300 8 years ago
parent 0524a7d703
commit 70a880a89c
  1. 4
      src/solidity/decodeInfo.js

@ -119,7 +119,7 @@ function stringType (type) {
function array (type, stateDefinitions, contractName) { function array (type, stateDefinitions, contractName) {
var arraySize var arraySize
var match = type.match(/(.*)\[(.*?)\]( storage ref| storage pointer| memory| calldata)?$/) var match = type.match(/(.*)\[(.*?)\]( storage ref| storage pointer| memory| calldata)?$/)
if (!match || match.length < 3) { if (!match) {
console.log('unable to parse type ' + type) console.log('unable to parse type ' + type)
return null return null
} }
@ -161,7 +161,7 @@ function enumType (type, stateDefinitions, contractName) {
*/ */
function struct (type, stateDefinitions, contractName) { function struct (type, stateDefinitions, contractName) {
var match = type.match(/struct (\S*?)( storage ref| storage pointer| memory| calldata)?$/) var match = type.match(/struct (\S*?)( storage ref| storage pointer| memory| calldata)?$/)
if (match && match.length > 2) { if (match) {
var memberDetails = getStructMembers(match[1], stateDefinitions, contractName) // type is used to extract the ast struct definition var memberDetails = getStructMembers(match[1], stateDefinitions, contractName) // type is used to extract the ast struct definition
if (!memberDetails) return null if (!memberDetails) return null
return new StructType(memberDetails, match[2].trim()) return new StructType(memberDetails, match[2].trim())

Loading…
Cancel
Save