code refactor

fixCompilationTargets
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) => { 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 {
} }
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 {
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) {
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) {
} }
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) {

Loading…
Cancel
Save