Commit 70a880a8 authored by yann300's avatar yann300

no need to test the length

parent 0524a7d7
...@@ -119,7 +119,7 @@ function stringType (type) { ...@@ -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) { ...@@ -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())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment