fix: allow to debug instanceOf contracts

This commit is contained in:
Anthony Laibe 2019-01-11 10:54:00 +00:00 committed by Pascal Precht
parent 518d319917
commit 1e4eaa5fb6
3 changed files with 8 additions and 4 deletions

View File

@ -35,6 +35,7 @@ class EditorContainer extends React.Component {
this.state = { this.state = {
currentAsideTab: {}, currentAsideTab: {},
debuggingContract: null,
showHiddenFiles: false, showHiddenFiles: false,
currentFile: this.props.currentFile, currentFile: this.props.currentFile,
editorHeight: this.DEFAULT_HEIGHT, editorHeight: this.DEFAULT_HEIGHT,
@ -78,11 +79,11 @@ class EditorContainer extends React.Component {
this.setState({currentFile: this.props.currentFile}); this.setState({currentFile: this.props.currentFile});
} }
if(this.props.contracts && this.props.transaction !== prevProps.transaction && this.props.transaction) { if(this.props.contracts.length && this.props.transaction) {
const debuggingContract = this.props.contracts.find(contract => contract.address === this.props.transaction.to) const debuggingContract = this.props.contracts.find(contract => contract.address === this.props.transaction.to)
if (debuggingContract) { if (this.state.debuggingContract !== debuggingContract) {
const editorWidth = this.getNewEditorWidth(OPERATIONS.LESS) const editorWidth = this.getNewEditorWidth(OPERATIONS.LESS)
this.setState({currentAsideTab: TextEditorToolbarTabs.Debugger, editorWidth}) this.setState({currentAsideTab: TextEditorToolbarTabs.Debugger, editorWidth, debuggingContract})
this.props.fetchFile({path: debuggingContract.path}); this.props.fetchFile({path: debuggingContract.path});
} }
} }

View File

@ -234,7 +234,7 @@ export function getDebuggerInfo(state) {
} }
export function getDebuggerLine(state) { export function getDebuggerLine(state) {
if (!state.debuggerInfo.sources) return; if (!state.debuggerInfo.sources || !state.debuggerInfo.sources.lineColumnPos[0]) return;
return state.debuggerInfo.sources.lineColumnPos[0].start.line + 1; return state.debuggerInfo.sources.lineColumnPos[0].start.line + 1;
} }

View File

@ -423,6 +423,9 @@ class ContractsManager {
})); }));
} }
contract.path = parentContract.path;
contract.originalFilename = parentContract.originalFilename;
contract.filename = parentContract.filename;
contract.code = parentContract.code; contract.code = parentContract.code;
contract.runtimeBytecode = parentContract.runtimeBytecode; contract.runtimeBytecode = parentContract.runtimeBytecode;
contract.realRuntimeBytecode = (parentContract.realRuntimeBytecode || parentContract.runtimeBytecode); contract.realRuntimeBytecode = (parentContract.realRuntimeBytecode || parentContract.runtimeBytecode);