Skip to content

Commit

Permalink
Fix issues 101 and 205 (#262)
Browse files Browse the repository at this point in the history
Clear console earlier than before on recompiling
  • Loading branch information
bashlund authored Dec 4, 2018
1 parent 0d0ed66 commit cc0cffb
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/components/projecteditor/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export default class Compiler extends Component {
if (this.state.isRunning) return;

this.setState({
isRunning: true
isRunning: true,
consoleRows: []
});

const contracts = this.props.item
Expand Down Expand Up @@ -100,7 +101,6 @@ export default class Compiler extends Component {
});
return;
}
this.state.consoleRows.length = 0;
// This timeout can be removed.
setTimeout(() => {
var contractbody;
Expand Down Expand Up @@ -239,10 +239,26 @@ export default class Compiler extends Component {
' references library contracts. Superblocks Lab does not yet support library contract linking, only contract imports.',
});
delFiles();
} else if (contractObj) {
const metadata = JSON.parse(
contractObj.metadata
);
} else if (contractObj && contractObj.metadata) {
var metadata;
try {
metadata = JSON.parse(
contractObj.metadata
);
}
catch(e) {
console.error("Could not parse compiler output", contractObj);
this._updateConsole({
channel: 2,
msg:
'[ERROR] The contract ' +
srcfilename +
' could not be compiled.',
});
this.callback(1);
return;
}

// Save ABI and BIN
// First load, then save and close.
const cb = (
Expand Down

0 comments on commit cc0cffb

Please sign in to comment.