-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fixes for the debugger #694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| const res = await (() => { | ||
| return new Promise((resolve, reject) => { | ||
| const compiler = new Compiler(() => {}) | ||
| const compiler = new Compiler(contentResolverCallback || (() => {})) |
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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))) |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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')) { |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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)0625ddb to
35a3152
Compare
This fixes some issues with the debugger: