From 1297bac19acc60e6c9c4baf46f659c72fe13b342 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 7 Sep 2016 20:01:43 +0100 Subject: [PATCH 1/2] Fix optimize checkbox --- src/app.js | 7 +++++-- src/app/compiler.js | 9 +++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/app.js b/src/app.js index 1d29dd766e..07c94b837f 100644 --- a/src/app.js +++ b/src/app.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, updateFiles); 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(); }); diff --git a/src/app/compiler.js b/src/app/compiler.js index 5ad6c71fc8..b7796c6475 100644 --- a/src/app/compiler.js +++ b/src/app/compiler.js @@ -10,7 +10,7 @@ var EventManager = require('../lib/eventManager'); /* trigger compilationFinished, compilerLoaded, compilationStarted */ -function Compiler (editor, queryParams, handleGithubCall, updateFiles) { +function Compiler (editor, handleGithubCall, updateFiles) { 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); } }); From fc2e5b1432100a9a4f38f8f106c93bb41091245d Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 7 Sep 2016 20:15:35 +0100 Subject: [PATCH 2/2] Remove dead parameter --- src/app.js | 2 +- src/app/compiler.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app.js b/src/app.js index 07c94b837f..db45eeb292 100644 --- a/src/app.js +++ b/src/app.js @@ -407,7 +407,7 @@ var run = function () { } var executionContext = new ExecutionContext(); - var compiler = new Compiler(editor, 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); diff --git a/src/app/compiler.js b/src/app/compiler.js index b7796c6475..357d534797 100644 --- a/src/app/compiler.js +++ b/src/app/compiler.js @@ -10,7 +10,7 @@ var EventManager = require('../lib/eventManager'); /* trigger compilationFinished, compilerLoaded, compilationStarted */ -function Compiler (editor, handleGithubCall, updateFiles) { +function Compiler (editor, handleGithubCall) { var self = this; this.event = new EventManager();