Merge pull request #220 from ethereum/optimize-checkbox

Fix optimize flag handling
pull/1/head
Alex Beregszaszi 8 years ago committed by GitHub
commit 21953d8bcf
  1. 7
      src/app.js
  2. 9
      src/app/compiler.js

@ -407,7 +407,7 @@ var run = function () {
}
var executionContext = new ExecutionContext();
var compiler = new Compiler(editor, queryParams, handleGithubCall, updateFiles);
var compiler = new Compiler(editor, handleGithubCall);
var formalVerification = new FormalVerification($('#verificationView'), compiler.event);
var transactionDebugger = new Debugger('#debugger', editor, compiler, executionContext.event, swicthToFile);
@ -521,9 +521,12 @@ var run = function () {
// set default
$('#optimize').attr('checked', (queryParams.get().optimize === 'true'));
compiler.setOptimize(document.querySelector('#optimize').checked);
document.querySelector('#optimize').addEventListener('change', function () {
queryParams.update({ optimize: document.querySelector('#optimize').checked });
var optimize = document.querySelector('#optimize').checked;
queryParams.update({ optimize: optimize });
compiler.setOptimize(optimize);
compiler.compile();
});

@ -10,7 +10,7 @@ var EventManager = require('../lib/eventManager');
/*
trigger compilationFinished, compilerLoaded, compilationStarted
*/
function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
function Compiler (editor, handleGithubCall) {
var self = this;
this.event = new EventManager();
@ -20,6 +20,12 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
var cachedRemoteFiles = {};
var worker = null;
var optimize = false;
this.setOptimize = function (_optimize) {
optimize = _optimize;
};
var compile = function (missingInputs) {
editor.clearAnnotations();
self.event.trigger('compilationStarted', []);
@ -33,7 +39,6 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
self.lastCompilationResult = null;
self.event.trigger('compilationFinished', [false, { 'error': error }, files]);
} else {
var optimize = queryParams.get().optimize;
compileJSON(input, optimize ? 1 : 0);
}
});

Loading…
Cancel
Save