use lineColumnPos from the cache

pull/3068/head
yann300 2 years ago
parent 2f4bff3d5e
commit fa3c4f0981
  1. 2
      libs/remix-debug/src/debugger/debugger.ts
  2. 8
      libs/remix-debug/src/solidity-decoder/internalCallTree.ts

@ -95,7 +95,7 @@ export class Debugger {
sources[genSource.name] = { content: genSource.contents } sources[genSource.name] = { content: genSource.contents }
} }
} }
const lineColumnPos = await this.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, sources, astSources) const lineColumnPos = rawLocationAndOpcode.lineColumnPos
let lineGasCostObj = null let lineGasCostObj = null
try { try {

@ -250,13 +250,12 @@ async function buildTree (tree, step, scopeId, isExternalCall, isCreation, funct
if (stepDetail && nextStepDetail) { if (stepDetail && nextStepDetail) {
stepDetail.gasCost = parseInt(stepDetail.gas as string) - parseInt(nextStepDetail.gas as string) stepDetail.gasCost = parseInt(stepDetail.gas as string) - parseInt(nextStepDetail.gas as string)
} }
tree.locationAndOpcodePerVMTraceIndex[step] = { sourceLocation, stepDetail }
tree.scopes[scopeId].gasCost += stepDetail.gasCost
// gas per line // gas per line
let lineColumnPos
if (tree.offsetToLineColumnConverter) { if (tree.offsetToLineColumnConverter) {
try { try {
const lineColumnPos = await tree.offsetToLineColumnConverter.offsetToLineColumn(validSourceLocation, validSourceLocation.file, tree.solidityProxy.sourcesCode, tree.solidityProxy.sources) lineColumnPos = await tree.offsetToLineColumnConverter.offsetToLineColumn(validSourceLocation, validSourceLocation.file, tree.solidityProxy.sourcesCode, tree.solidityProxy.sources)
if (!tree.gasCostPerLine[validSourceLocation.file]) tree.gasCostPerLine[validSourceLocation.file] = {} if (!tree.gasCostPerLine[validSourceLocation.file]) tree.gasCostPerLine[validSourceLocation.file] = {}
if (!tree.gasCostPerLine[validSourceLocation.file][lineColumnPos.start.line]) { if (!tree.gasCostPerLine[validSourceLocation.file][lineColumnPos.start.line]) {
tree.gasCostPerLine[validSourceLocation.file][lineColumnPos.start.line] = { tree.gasCostPerLine[validSourceLocation.file][lineColumnPos.start.line] = {
@ -271,6 +270,9 @@ async function buildTree (tree, step, scopeId, isExternalCall, isCreation, funct
} }
} }
tree.locationAndOpcodePerVMTraceIndex[step] = { sourceLocation, stepDetail, lineColumnPos }
tree.scopes[scopeId].gasCost += stepDetail.gasCost
const contractObj = await tree.solidityProxy.contractObjectAtAddress(address) const contractObj = await tree.solidityProxy.contractObjectAtAddress(address)
const generatedSources = getGeneratedSources(tree, scopeId, contractObj) const generatedSources = getGeneratedSources(tree, scopeId, contractObj)
const functionDefinition = resolveFunctionDefinition(tree, sourceLocation, generatedSources) const functionDefinition = resolveFunctionDefinition(tree, sourceLocation, generatedSources)

Loading…
Cancel
Save