code refactor

pull/694/head
yann300 4 years ago
parent 0ff6128f0c
commit 35a3152ba2
  1. 2
      apps/remix-ide/src/app/compiler/compiler-helpers.js
  2. 8
      apps/remix-ide/src/app/compiler/compiler-imports.js
  3. 4
      apps/remix-ide/src/app/tabs/debugger-tab.js
  4. 5
      libs/remix-debug/src/solidity-decoder/internalCallTree.ts
  5. 2
      libs/remix-debug/src/trace/traceHelper.ts

@ -6,7 +6,7 @@ import CompilerAbstract from './compiler-abstract'
export const compile = async (compilationTargets, settings, contentResolverCallback) => {
const res = await (() => {
return new Promise((resolve, reject) => {
const compiler = new Compiler(contentResolverCallback || (() => {}))
const compiler = new Compiler(contentResolverCallback)
compiler.set('evmVersion', settings.evmVersion)
compiler.set('optimize', settings.optimize)
compiler.set('language', settings.language)

@ -106,12 +106,8 @@ module.exports = class CompilerImports extends Plugin {
}
isExternalUrl (url) {
for (const handler of this.handlers()) {
if (handler.match.exec(url)) {
return true
}
}
return false
const handlers = this.handlers()
return handlers.some(handler => handler.match.exec(url))
}
/**

@ -140,8 +140,8 @@ class DebuggerTab extends ViewPlugin {
fetchContractAndCompile (address, receipt) {
const target = (address && remixDebug.traceHelper.isContractCreation(address)) ? receipt.contractAddress : address
return this.call('fetchAndCompile', 'resolve', target || receipt.contractAddress || receipt.to, 'browser/.debug', this.blockchain.web3())
const targetAddress = target || receipt.contractAddress || receipt.to
return this.call('fetchAndCompile', 'resolve', targetAddress, 'browser/.debug', this.blockchain.web3())
}
// debugger () {

@ -357,9 +357,8 @@ function extractVariableDeclarations (ast, astWalker) {
if (node.nodeType === 'VariableDeclaration' || node.nodeType === 'YulVariableDeclaration') {
ret[node.src] = [node]
}
if (node.initialValue && (node.nodeType === 'VariableDeclarationStatement' || node.nodeType === 'YulVariableDeclarationStatement')) {
ret[node.initialValue.src] = node.declarations
}
const hasChild = node.initialValue && (node.nodeType === 'VariableDeclarationStatement' || node.nodeType === 'YulVariableDeclarationStatement')
if (hasChild) ret[node.initialValue.src] = node.declarations
})
return ret
}

@ -15,7 +15,7 @@ export function resolveCalledAddress (vmTraceIndex, trace) {
}
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) {

Loading…
Cancel
Save