From 0d2287c67ec81341cd7acc6ff7d7a574c6b672bd Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 18 Dec 2018 13:48:07 +0100 Subject: [PATCH] fix standard --- src/app.js | 4 ++-- src/app/editor/contextView.js | 6 +++--- src/app/panels/file-panel.js | 2 +- src/app/panels/righthand-panel.js | 2 +- src/app/plugin/pluginManager.js | 2 +- src/app/staticanalysis/staticAnalysisView.js | 6 +++--- src/app/tabs/compile-tab.js | 9 ++++----- src/lib/cmdInterpreterAPI.js | 8 ++++---- src/lib/offsetToLineColumnConverter.js | 3 +-- 9 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/app.js b/src/app.js index 221026b589..a0bcec313e 100644 --- a/src/app.js +++ b/src/app.js @@ -229,7 +229,7 @@ class App { self._adjustLayout('left', self.data._layout.left.offset) self._adjustLayout('right', self.data._layout.right.offset) return self._view.el - } + } startdebugging (txHash) { const self = this self.event.trigger('debuggingRequested', []) @@ -303,7 +303,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org } registry.put({api: msg => self._components.editorpanel.logHtmlMessage(msg), name: 'logCallback'}) - + // helper for converting offset to line/column var offsetToLineColumnConverter = new OffsetToLineColumnConverter() registry.put({api: offsetToLineColumnConverter, name: 'offsettolinecolumnconverter'}) diff --git a/src/app/editor/contextView.js b/src/app/editor/contextView.js index e7b34bb9d5..671538a043 100644 --- a/src/app/editor/contextView.js +++ b/src/app/editor/contextView.js @@ -100,9 +100,9 @@ class ContextView { let lastCompilationResult = self._deps.compilersArtefacts['__last'] if (lastCompilationResult && lastCompilationResult.data) { var lineColumn = self._deps.offsetToLineColumnConverter.offsetToLineColumn( - position, - position.file, - lastCompilationResult.getSourceCode().sources, + position, + position.file, + lastCompilationResult.getSourceCode().sources, lastCompilationResult.getAsts()) var filename = lastCompilationResult.getSourceName(position.file) // TODO: refactor with rendererAPI.errorClick diff --git a/src/app/panels/file-panel.js b/src/app/panels/file-panel.js index f98aa94636..a1586dd56b 100644 --- a/src/app/panels/file-panel.js +++ b/src/app/panels/file-panel.js @@ -49,7 +49,7 @@ function filepanel (localRegistry) { fileProviders: self._components.registry.get('fileproviders').api, fileManager: self._components.registry.get('filemanager').api, config: self._components.registry.get('config').api, - pluginManager: self._components.registry.get('pluginmanager').api, + pluginManager: self._components.registry.get('pluginmanager').api } var fileExplorer = new FileExplorer(self._components.registry, self._deps.fileProviders['browser']) var fileSystemExplorer = new FileExplorer(self._components.registry, self._deps.fileProviders['localhost']) diff --git a/src/app/panels/righthand-panel.js b/src/app/panels/righthand-panel.js index 6a2f8091f2..b995c77d73 100644 --- a/src/app/panels/righthand-panel.js +++ b/src/app/panels/righthand-panel.js @@ -26,7 +26,7 @@ module.exports = class RighthandPanel { } var tabbedMenu = new TabbedMenu(self._components.registry) - + self._components = { tabbedMenu: tabbedMenu, tabs diff --git a/src/app/plugin/pluginManager.js b/src/app/plugin/pluginManager.js index e05a2f41d7..852c0e73b0 100644 --- a/src/app/plugin/pluginManager.js +++ b/src/app/plugin/pluginManager.js @@ -101,7 +101,7 @@ module.exports = class PluginManager { value: [ file ] })) }) - + txlistener.event.register('newTransaction', (tx) => { self.broadcast(JSON.stringify({ action: 'notification', diff --git a/src/app/staticanalysis/staticAnalysisView.js b/src/app/staticanalysis/staticAnalysisView.js index 64765ff009..8e5abef71a 100644 --- a/src/app/staticanalysis/staticAnalysisView.js +++ b/src/app/staticanalysis/staticAnalysisView.js @@ -111,9 +111,9 @@ staticAnalysisView.prototype.run = function () { start: parseInt(split[0]), length: parseInt(split[1]) } - location = self._deps.offsetToLineColumnConverter.offsetToLineColumn(location, - parseInt(file), - self.lastCompilationSource.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) + ':' } diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 61b92f1965..7d0de619d4 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -8,7 +8,6 @@ var minixhr = require('minixhr') var remixTests = require('remix-tests') var Compiler = require('remix-solidity').Compiler var CompilerImport = require('../compiler/compiler-imports') -var tooltip = require('../ui/tooltip') var QueryParams = require('../../lib/query-params') var globalRegistry = require('../../global/registry') const TreeView = require('../ui/TreeView') @@ -47,7 +46,7 @@ module.exports = class CompileTab { self._components.queryParams = new QueryParams() self._components.compilerImport = new CompilerImport() self._components.compiler = new Compiler((url, cb) => self.importFileCb(url, cb)) - + // dependencies self._deps = { editor: self._components.registry.get('editor').api, @@ -129,7 +128,7 @@ module.exports = class CompileTab { self._view.contractNames.innerHTML = '' if (success) { // TODO consider using compile tab as a proper module instead of just forwarding event - self._deps.pluginManager.receivedDataFrom('sendCompilationResult', 'solidity-compiler', [data.target, source, self.data.selectedVersion, data] ) + self._deps.pluginManager.receivedDataFrom('sendCompilationResult', 'solidity-compiler', [data.target, source, self.data.selectedVersion, data]) self._view.contractNames.removeAttribute('disabled') self._components.compiler.visitContracts(contract => { self.data.contractsDetails[contract.name] = parseContracts(contract.name, contract.object, self._components.compiler.getSource(contract.file)) @@ -462,7 +461,7 @@ module.exports = class CompileTab { selectedVersion = data.releases[data.latestRelease] if (self._components.queryParams.get().version) selectedVersion = self._components.queryParams.get().version } catch (e) { - tooltip('Cannot load compiler version list. It might have been blocked by an advertisement blocker. Please try deactivating any of them from this page and reload.') + addTooltip('Cannot load compiler version list. It might have been blocked by an advertisement blocker. Please try deactivating any of them from this page and reload.') } } else { allversions = [{ path: 'builtin', longVersion: 'latest local version' }] @@ -501,7 +500,7 @@ module.exports = class CompileTab { const self = this self._components.compilerImport.import(url, (loadingMsg) => { - toolTip(loadingMsg) + addTooltip(loadingMsg) }, (error, content, cleanUrl, type, url) => { if (!error) { diff --git a/src/lib/cmdInterpreterAPI.js b/src/lib/cmdInterpreterAPI.js index f990b48044..7f4e0716c9 100644 --- a/src/lib/cmdInterpreterAPI.js +++ b/src/lib/cmdInterpreterAPI.js @@ -47,8 +47,8 @@ class CmdInterpreterAPI { self._components.sourceHighlighter.currentSourceLocation(null) return } - var lineColumnPos = self._deps.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, - self._deps.compilersArtefacts['__last'].getSourceCode().sources, + var lineColumnPos = self._deps.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, + self._deps.compilersArtefacts['__last'].getSourceCode().sources, self._deps.compilersArtefacts['__last'].getAsts()) self._components.sourceHighlighter.currentSourceLocation(lineColumnPos, rawLocation) } @@ -110,8 +110,8 @@ class CmdInterpreterAPI { self.d.goTo = (row) => { if (self._deps.editor.current()) { var breakPoint = new remixLib.code.BreakpointManager(self.d, (sourceLocation) => { - return self._deps.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, - self._deps.compilersArtefacts['__last'].getSourceCode().sources, + return self._deps.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, + self._deps.compilersArtefacts['__last'].getSourceCode().sources, self._deps.compilersArtefacts['__last'].getAsts()) }) breakPoint.event.register('breakpointHit', (sourceLocation, currentStep) => { diff --git a/src/lib/offsetToLineColumnConverter.js b/src/lib/offsetToLineColumnConverter.js index 0216121684..115cb59aa3 100644 --- a/src/lib/offsetToLineColumnConverter.js +++ b/src/lib/offsetToLineColumnConverter.js @@ -4,10 +4,9 @@ var SourceMappingDecoder = require('remix-lib').SourceMappingDecoder function offsetToColumnConverter () { this.lineBreakPositionsByContent = {} this.sourceMappingDecoder = new SourceMappingDecoder() - var self = this // we don't listen anymore on compilation result for clearing the cache } - + offsetToColumnConverter.prototype.offsetToLineColumn = function (rawLocation, file, sources, asts) { if (!this.lineBreakPositionsByContent[file]) { for (var filename in asts) {