property access improved

pull/697/head
aniket-engg 4 years ago committed by Aniket
parent 399a57d883
commit b5d655d084
  1. 4
      libs/remix-debug/src/Ethdebugger.ts
  2. 4
      libs/remix-debug/src/cmdline/index.ts
  3. 6
      libs/remix-debug/src/code/codeUtils.ts
  4. 4
      libs/remix-debug/src/debugger/solidityLocals.ts
  5. 4
      libs/remix-debug/src/debugger/solidityState.ts
  6. 4
      libs/remix-debug/src/solidity-decoder/types/StringType.ts
  7. 4
      libs/remix-debug/src/source/sourceLocationTracker.ts
  8. 18
      libs/remix-debug/src/source/sourceMappingDecoder.ts
  9. 6
      libs/remix-debug/src/trace/traceManager.ts

@ -107,8 +107,8 @@ export class Ethdebugger {
try {
const storageViewer = new StorageViewer({ stepIndex: step, tx: this.tx, address: address }, this.storageResolver, this.traceManager)
const locals = await localDecoder.solidityLocals(step, this.callTree, stack, memory, storageViewer, sourceLocation, null)
if (locals.error) {
return callback(locals.error)
if (locals['error']) {
return callback(locals['error'])
}
return callback(null, locals)
} catch (e) {

@ -27,8 +27,8 @@ export class CmdLine {
loadCompilationData (inputJson, outputJson) {
const data = {}
data.data = outputJson
data.source = { sources: inputJson.sources }
data['data'] = outputJson
data['source'] = { sources: inputJson.sources }
this.loadCompilationResult(data)
}

@ -35,11 +35,11 @@ export function parseCode (raw) {
const opcode = opcodes(raw[i], true)
if (opcode.name.slice(0, 4) === 'PUSH') {
const length = raw[i] - 0x5f
opcode.pushData = raw.slice(i + 1, i + length + 1)
opcode['pushData'] = raw.slice(i + 1, i + length + 1)
// in case pushdata extends beyond code
if (i + 1 + length > raw.length) {
for (let j = opcode.pushData.length; j < length; j++) {
opcode.pushData.push(0)
for (let j = opcode['pushData'].length; j < length; j++) {
opcode['pushData'].push(0)
}
}
i += length

@ -74,14 +74,14 @@ export class DebuggerSolidityLocals {
var storageViewer = new StorageViewer({ stepIndex: this.stepManager.currentStepIndex, tx: this.tx, address: result[2].value }, this.storageResolver, this.traceManager)
solidityLocals(this.stepManager.currentStepIndex, this.internalTreeCall, stack, memory, storageViewer, sourceLocation, cursor).then((locals) => {
if (!cursor) {
if (!locals.error) {
if (!locals['error']) {
this.event.trigger('solidityLocals', [locals])
}
if (!Object.keys(locals).length) {
this.event.trigger('solidityLocalsMessage', ['no locals'])
}
} else {
if (!locals.error) {
if (!locals['error']) {
this.event.trigger('solidityLocalsLoadMoreCompleted', [locals])
}
}

@ -77,8 +77,8 @@ export class DebuggerSolidityState {
const storageViewer = new StorageViewer({ stepIndex: this.stepManager.currentStepIndex, tx: this.tx, address: address }, this.storageResolver, this.traceManager)
decodeState(stateVars, storageViewer).then((result) => {
this.event.trigger('solidityStateMessage', [''])
if (result.error) {
return this.event.trigger('solidityStateMessage', [result.error])
if (result['error']) {
return this.event.trigger('solidityStateMessage', [result['error']])
}
this.event.trigger('solidityState', [result])
})

@ -43,9 +43,9 @@ function format (decoded) {
value = value.replace('0x', '').replace(/(..)/g, '%$1')
const ret = { length: decoded.length, raw: decoded.value, type: 'string' }
try {
ret.value = decodeURIComponent(value)
ret['value'] = decodeURIComponent(value)
} catch (e) {
ret.error = 'Invalid UTF8 encoding'
ret['error'] = 'Invalid UTF8 encoding'
ret.raw = decoded.value
}
return ret

@ -31,7 +31,7 @@ export class SourceLocationTracker {
*/
async getSourceLocationFromInstructionIndex (address, index, contracts) {
const sourceMap = await this.extractSourceMap(this, this.codeManager, address, contracts)
return atIndex(index, sourceMap.map)
return atIndex(index, sourceMap['map'])
}
/**
@ -44,7 +44,7 @@ export class SourceLocationTracker {
async getSourceLocationFromVMTraceIndex (address, vmtraceStepIndex, contracts) {
const sourceMap = await this.extractSourceMap(this, this.codeManager, address, contracts)
const index = this.codeManager.getInstructionIndex(address, vmtraceStepIndex)
return atIndex(index, sourceMap.map)
return atIndex(index, sourceMap['map'])
}
/**

@ -183,19 +183,19 @@ export function atIndex (index, mapping) {
continue
}
current = current.split(':')
if (ret.start === undefined && current[0] && current[0] !== '-1' && current[0].length) {
ret.start = parseInt(current[0])
if (ret['start'] === undefined && current[0] && current[0] !== '-1' && current[0].length) {
ret['start'] = parseInt(current[0])
}
if (ret.length === undefined && current[1] && current[1] !== '-1' && current[1].length) {
ret.length = parseInt(current[1])
if (ret['length'] === undefined && current[1] && current[1] !== '-1' && current[1].length) {
ret['length'] = parseInt(current[1])
}
if (ret.file === undefined && current[2] && current[2].length) {
ret.file = parseInt(current[2])
if (ret['file'] === undefined && current[2] && current[2].length) {
ret['file'] = parseInt(current[2])
}
if (ret.jump === undefined && current[3] && current[3].length) {
ret.jump = current[3]
if (ret['jump'] === undefined && current[3] && current[3].length) {
ret['jump'] = current[3]
}
if (ret.start !== undefined && ret.length !== undefined && ret.file !== undefined && ret.jump !== undefined) {
if (ret['start'] !== undefined && ret['length'] !== undefined && ret['file'] !== undefined && ret['jump'] !== undefined) {
break
}
}

@ -32,10 +32,10 @@ export class TraceManager {
try {
const result = await this.getTrace(tx.hash)
if (result.structLogs.length > 0) {
this.trace = result.structLogs
if (result['structLogs'].length > 0) {
this.trace = result['structLogs']
this.traceAnalyser.analyse(result.structLogs, tx)
this.traceAnalyser.analyse(result['structLogs'], tx)
this.isLoading = false
return true
}

Loading…
Cancel
Save