diff --git a/src/core/modules/impl/normalize-source.ts b/src/core/modules/impl/normalize-source.ts index 67beb3c..f0aa4fb 100644 --- a/src/core/modules/impl/normalize-source.ts +++ b/src/core/modules/impl/normalize-source.ts @@ -9,19 +9,17 @@ export function normalizeContractSource(contractSrc: string): string { // We then use `new Function()` which we can call and get back the returned handle function // which has access to the per-instance globals. - const firstLastLineRegexp = /^(?:(?\s*{/g.test(search[0]) || /\s*\(\s*function\s*\(\)\s*{/g.test(search[0])) && - /}\s*\)\s*\(\)\s*;/g.test(search[1]) - ) { - const lines = contractSrc.split('\n'); - lines.shift(); - lines.pop(); - contractSrc = lines.join('\n'); - } + if ( + (/\(\s*\(\)\s*=>\s*{/g.test(first) || /\s*\(\s*function\s*\(\)\s*{/g.test(first)) && + /}\s*\)\s*\(\)\s*;/g.test(last) + ) { + lines.shift(); + lines.pop(); + contractSrc = lines.join('\n'); } contractSrc = contractSrc