From 2f783cce246afc72271cdeab67229e7b05c3cbc2 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 18 Dec 2018 13:33:07 +0100 Subject: [PATCH] use pluginmanager for listenning on new compilation result --- src/app/staticanalysis/staticAnalysisView.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/app/staticanalysis/staticAnalysisView.js b/src/app/staticanalysis/staticAnalysisView.js index 6e9eb28d23..64765ff009 100644 --- a/src/app/staticanalysis/staticAnalysisView.js +++ b/src/app/staticanalysis/staticAnalysisView.js @@ -25,21 +25,19 @@ function staticAnalysisView (localRegistry) { self._components.registry = localRegistry || globlalRegistry // dependencies self._deps = { - compiler: self._components.registry.get('compiler').api, + pluginManager: self._components.registry.get('pluginmanager').api, renderer: self._components.registry.get('renderer').api, offsetToLineColumnConverter: self._components.registry.get('offsettolinecolumnconverter').api } - self._deps.compiler.event.register('compilationFinished', function (success, data, source) { + self._deps.pluginManager.event.register('sendCompilationResult', (file, source, languageVersion, data) => { self.lastCompilationResult = null self.lastCompilationSource = null $('#staticanalysisresult').empty() - if (success) { - self.lastCompilationResult = data - self.lastCompilationSource = source - if (self.view.querySelector('#autorunstaticanalysis').checked) { - self.run() - } + self.lastCompilationResult = data + self.lastCompilationSource = source + if (self.view.querySelector('#autorunstaticanalysis').checked) { + self.run() } }) } @@ -113,7 +111,10 @@ staticAnalysisView.prototype.run = function () { start: parseInt(split[0]), length: parseInt(split[1]) } - location = self._deps.offsetToLineColumnConverter.offsetToLineColumn(location, parseInt(file), self._deps.compiler.lastCompilationResult.source.sources, self._deps.compiler.lastCompilationResult.data.sources) + location = self._deps.offsetToLineColumnConverter.offsetToLineColumn(location, + parseInt(file), + self.lastCompilationSource.sources, + self.lastCompilationResult.sources) location = Object.keys(self.lastCompilationResult.contracts)[file] + ':' + (location.start.line + 1) + ':' + (location.start.column + 1) + ':' } warningCount++