Commit 35a3152b authored by yann300's avatar yann300

code refactor

parent 0ff6128f
...@@ -6,7 +6,7 @@ import CompilerAbstract from './compiler-abstract' ...@@ -6,7 +6,7 @@ import CompilerAbstract from './compiler-abstract'
export const compile = async (compilationTargets, settings, contentResolverCallback) => { export const compile = async (compilationTargets, settings, contentResolverCallback) => {
const res = await (() => { const res = await (() => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const compiler = new Compiler(contentResolverCallback || (() => {})) const compiler = new Compiler(contentResolverCallback)
compiler.set('evmVersion', settings.evmVersion) compiler.set('evmVersion', settings.evmVersion)
compiler.set('optimize', settings.optimize) compiler.set('optimize', settings.optimize)
compiler.set('language', settings.language) compiler.set('language', settings.language)
......
...@@ -106,12 +106,8 @@ module.exports = class CompilerImports extends Plugin { ...@@ -106,12 +106,8 @@ module.exports = class CompilerImports extends Plugin {
} }
isExternalUrl (url) { isExternalUrl (url) {
for (const handler of this.handlers()) { const handlers = this.handlers()
if (handler.match.exec(url)) { return handlers.some(handler => handler.match.exec(url))
return true
}
}
return false
} }
/** /**
......
...@@ -140,8 +140,8 @@ class DebuggerTab extends ViewPlugin { ...@@ -140,8 +140,8 @@ class DebuggerTab extends ViewPlugin {
fetchContractAndCompile (address, receipt) { fetchContractAndCompile (address, receipt) {
const target = (address && remixDebug.traceHelper.isContractCreation(address)) ? receipt.contractAddress : address const target = (address && remixDebug.traceHelper.isContractCreation(address)) ? receipt.contractAddress : address
const targetAddress = target || receipt.contractAddress || receipt.to
return this.call('fetchAndCompile', 'resolve', target || receipt.contractAddress || receipt.to, 'browser/.debug', this.blockchain.web3()) return this.call('fetchAndCompile', 'resolve', targetAddress, 'browser/.debug', this.blockchain.web3())
} }
// debugger () { // debugger () {
......
...@@ -357,9 +357,8 @@ function extractVariableDeclarations (ast, astWalker) { ...@@ -357,9 +357,8 @@ function extractVariableDeclarations (ast, astWalker) {
if (node.nodeType === 'VariableDeclaration' || node.nodeType === 'YulVariableDeclaration') { if (node.nodeType === 'VariableDeclaration' || node.nodeType === 'YulVariableDeclaration') {
ret[node.src] = [node] ret[node.src] = [node]
} }
if (node.initialValue && (node.nodeType === 'VariableDeclarationStatement' || node.nodeType === 'YulVariableDeclarationStatement')) { const hasChild = node.initialValue && (node.nodeType === 'VariableDeclarationStatement' || node.nodeType === 'YulVariableDeclarationStatement')
ret[node.initialValue.src] = node.declarations if (hasChild) ret[node.initialValue.src] = node.declarations
}
}) })
return ret return ret
} }
......
...@@ -15,7 +15,7 @@ export function resolveCalledAddress (vmTraceIndex, trace) { ...@@ -15,7 +15,7 @@ export function resolveCalledAddress (vmTraceIndex, trace) {
} }
export function isCallInstruction (step) { export function isCallInstruction (step) {
return step.op === 'CALL' || step.op === 'STATICCALL' || step.op === 'CALLCODE' || step.op === 'CREATE' || step.op === 'DELEGATECALL' return ['CALL', 'STATICCALL', 'CALLCODE', 'CREATE', 'DELEGATECALL'].includes(step.op)
} }
export function isCreateInstruction (step) { export function isCreateInstruction (step) {
......
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