Skip to content

Conversation

@yann300
Copy link
Contributor

@yann300 yann300 commented Dec 23, 2020

This fixes some issues with the debugger:

  • Use sourcify with github import (for the moment the content resolved is not from ipfs but from github)
  • Handle staticall opcode
  • The way we are resolving locals is not really accurate sometimes. this is an improvement.

@yann300 yann300 added the fix label Dec 23, 2020
const res = await (() => {
return new Promise((resolve, reject) => {
const compiler = new Compiler(() => {})
const compiler = new Compiler(contentResolverCallback || (() => {}))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to make the callback optional or set the default callback in the Compiler ?

class Compiler {
  constructor(callback = () => {})
}

}

isExternalUrl (url) {
for (const handler of this.handlers()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want there is a built-in method of that :

const handlers = this.handlers();
return handlers.some(handler => handler.match.exec(url));

const compData = await compile(
compilationTargets,
settings,
(url, cb) => this.call('contentImport', 'resolveAndSave', url).then((result) => cb(null, result)).catch((error) => cb(error.message)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like callback hell here ^^.
When you've to a callback in a promise in a callback, you start loosing people XD

const target = (address && remixDebug.traceHelper.isContractCreation(address)) ? receipt.contractAddress : address

return this.call('fetchAndCompile', 'resolve', target || receipt.contractAddress || receipt.to, '.debug', this.blockchain.web3())
return this.call('fetchAndCompile', 'resolve', target || receipt.contractAddress || receipt.to, 'browser/.debug', this.blockchain.web3())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a variable before with a good naming to make it easier to follow :

const goodName = target || receipt.contractAddress || receipt.to, 'browser/.debug'
...

ret[node.src] = node
ret[node.src] = [node]
}
if (node.initialValue && (node.nodeType === 'VariableDeclarationStatement' || node.nodeType === 'YulVariableDeclarationStatement')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe create a variable with the right name also to explain this statement


export function isCallInstruction (step) {
return step.op === 'CALL' || step.op === 'CALLCODE' || step.op === 'CREATE' || step.op === 'DELEGATECALL'
return step.op === 'CALL' || step.op === 'STATICCALL' || step.op === 'CALLCODE' || step.op === 'CREATE' || step.op === 'DELEGATECALL'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to transform it into an array :

return ['CALL', 'CALLCODE', ...].include(step.op)

@yann300 yann300 force-pushed the fixCompilationTargets branch from 0625ddb to 35a3152 Compare January 4, 2021 12:50
@yann300 yann300 merged commit e3f2947 into master Jan 4, 2021
yann300 pushed a commit that referenced this pull request Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants