Skip to content

Commit

Permalink
fix: allow to debug instanceOf contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
alaibe authored and 0x-r4bbit committed Jan 14, 2019
1 parent 518d319 commit 1e4eaa5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions embark-ui/src/containers/EditorContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class EditorContainer extends React.Component {

this.state = {
currentAsideTab: {},
debuggingContract: null,
showHiddenFiles: false,
currentFile: this.props.currentFile,
editorHeight: this.DEFAULT_HEIGHT,
Expand Down Expand Up @@ -78,11 +79,11 @@ class EditorContainer extends React.Component {
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)
if (debuggingContract) {
if (this.state.debuggingContract !== debuggingContract) {
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});
}
}
Expand Down
2 changes: 1 addition & 1 deletion embark-ui/src/reducers/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export function getDebuggerInfo(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;
}

Expand Down
3 changes: 3 additions & 0 deletions src/lib/modules/contracts_manager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@ class ContractsManager {
}));
}

contract.path = parentContract.path;
contract.originalFilename = parentContract.originalFilename;
contract.filename = parentContract.filename;
contract.code = parentContract.code;
contract.runtimeBytecode = parentContract.runtimeBytecode;
contract.realRuntimeBytecode = (parentContract.realRuntimeBytecode || parentContract.runtimeBytecode);
Expand Down

0 comments on commit 1e4eaa5

Please sign in to comment.