fix standard

pull/1/head
yann300 6 years ago
parent 6afbdaab5c
commit 0d2287c67e
  1. 4
      src/app.js
  2. 6
      src/app/editor/contextView.js
  3. 2
      src/app/panels/file-panel.js
  4. 2
      src/app/panels/righthand-panel.js
  5. 2
      src/app/plugin/pluginManager.js
  6. 6
      src/app/staticanalysis/staticAnalysisView.js
  7. 9
      src/app/tabs/compile-tab.js
  8. 8
      src/lib/cmdInterpreterAPI.js
  9. 3
      src/lib/offsetToLineColumnConverter.js

@ -229,7 +229,7 @@ class App {
self._adjustLayout('left', self.data._layout.left.offset) self._adjustLayout('left', self.data._layout.left.offset)
self._adjustLayout('right', self.data._layout.right.offset) self._adjustLayout('right', self.data._layout.right.offset)
return self._view.el return self._view.el
} }
startdebugging (txHash) { startdebugging (txHash) {
const self = this const self = this
self.event.trigger('debuggingRequested', []) 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'}) registry.put({api: msg => self._components.editorpanel.logHtmlMessage(msg), name: 'logCallback'})
// helper for converting offset to line/column // helper for converting offset to line/column
var offsetToLineColumnConverter = new OffsetToLineColumnConverter() var offsetToLineColumnConverter = new OffsetToLineColumnConverter()
registry.put({api: offsetToLineColumnConverter, name: 'offsettolinecolumnconverter'}) registry.put({api: offsetToLineColumnConverter, name: 'offsettolinecolumnconverter'})

@ -100,9 +100,9 @@ class ContextView {
let lastCompilationResult = self._deps.compilersArtefacts['__last'] let lastCompilationResult = self._deps.compilersArtefacts['__last']
if (lastCompilationResult && lastCompilationResult.data) { if (lastCompilationResult && lastCompilationResult.data) {
var lineColumn = self._deps.offsetToLineColumnConverter.offsetToLineColumn( var lineColumn = self._deps.offsetToLineColumnConverter.offsetToLineColumn(
position, position,
position.file, position.file,
lastCompilationResult.getSourceCode().sources, lastCompilationResult.getSourceCode().sources,
lastCompilationResult.getAsts()) lastCompilationResult.getAsts())
var filename = lastCompilationResult.getSourceName(position.file) var filename = lastCompilationResult.getSourceName(position.file)
// TODO: refactor with rendererAPI.errorClick // TODO: refactor with rendererAPI.errorClick

@ -49,7 +49,7 @@ function filepanel (localRegistry) {
fileProviders: self._components.registry.get('fileproviders').api, fileProviders: self._components.registry.get('fileproviders').api,
fileManager: self._components.registry.get('filemanager').api, fileManager: self._components.registry.get('filemanager').api,
config: self._components.registry.get('config').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 fileExplorer = new FileExplorer(self._components.registry, self._deps.fileProviders['browser'])
var fileSystemExplorer = new FileExplorer(self._components.registry, self._deps.fileProviders['localhost']) var fileSystemExplorer = new FileExplorer(self._components.registry, self._deps.fileProviders['localhost'])

@ -26,7 +26,7 @@ module.exports = class RighthandPanel {
} }
var tabbedMenu = new TabbedMenu(self._components.registry) var tabbedMenu = new TabbedMenu(self._components.registry)
self._components = { self._components = {
tabbedMenu: tabbedMenu, tabbedMenu: tabbedMenu,
tabs tabs

@ -101,7 +101,7 @@ module.exports = class PluginManager {
value: [ file ] value: [ file ]
})) }))
}) })
txlistener.event.register('newTransaction', (tx) => { txlistener.event.register('newTransaction', (tx) => {
self.broadcast(JSON.stringify({ self.broadcast(JSON.stringify({
action: 'notification', action: 'notification',

@ -111,9 +111,9 @@ staticAnalysisView.prototype.run = function () {
start: parseInt(split[0]), start: parseInt(split[0]),
length: parseInt(split[1]) length: parseInt(split[1])
} }
location = self._deps.offsetToLineColumnConverter.offsetToLineColumn(location, location = self._deps.offsetToLineColumnConverter.offsetToLineColumn(location,
parseInt(file), parseInt(file),
self.lastCompilationSource.sources, self.lastCompilationSource.sources,
self.lastCompilationResult.sources) self.lastCompilationResult.sources)
location = Object.keys(self.lastCompilationResult.contracts)[file] + ':' + (location.start.line + 1) + ':' + (location.start.column + 1) + ':' location = Object.keys(self.lastCompilationResult.contracts)[file] + ':' + (location.start.line + 1) + ':' + (location.start.column + 1) + ':'
} }

@ -8,7 +8,6 @@ var minixhr = require('minixhr')
var remixTests = require('remix-tests') var remixTests = require('remix-tests')
var Compiler = require('remix-solidity').Compiler var Compiler = require('remix-solidity').Compiler
var CompilerImport = require('../compiler/compiler-imports') var CompilerImport = require('../compiler/compiler-imports')
var tooltip = require('../ui/tooltip')
var QueryParams = require('../../lib/query-params') var QueryParams = require('../../lib/query-params')
var globalRegistry = require('../../global/registry') var globalRegistry = require('../../global/registry')
const TreeView = require('../ui/TreeView') const TreeView = require('../ui/TreeView')
@ -47,7 +46,7 @@ module.exports = class CompileTab {
self._components.queryParams = new QueryParams() self._components.queryParams = new QueryParams()
self._components.compilerImport = new CompilerImport() self._components.compilerImport = new CompilerImport()
self._components.compiler = new Compiler((url, cb) => self.importFileCb(url, cb)) self._components.compiler = new Compiler((url, cb) => self.importFileCb(url, cb))
// dependencies // dependencies
self._deps = { self._deps = {
editor: self._components.registry.get('editor').api, editor: self._components.registry.get('editor').api,
@ -129,7 +128,7 @@ module.exports = class CompileTab {
self._view.contractNames.innerHTML = '' self._view.contractNames.innerHTML = ''
if (success) { if (success) {
// TODO consider using compile tab as a proper module instead of just forwarding event // 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._view.contractNames.removeAttribute('disabled')
self._components.compiler.visitContracts(contract => { self._components.compiler.visitContracts(contract => {
self.data.contractsDetails[contract.name] = parseContracts(contract.name, contract.object, self._components.compiler.getSource(contract.file)) 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] selectedVersion = data.releases[data.latestRelease]
if (self._components.queryParams.get().version) selectedVersion = self._components.queryParams.get().version if (self._components.queryParams.get().version) selectedVersion = self._components.queryParams.get().version
} catch (e) { } 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 { } else {
allversions = [{ path: 'builtin', longVersion: 'latest local version' }] allversions = [{ path: 'builtin', longVersion: 'latest local version' }]
@ -501,7 +500,7 @@ module.exports = class CompileTab {
const self = this const self = this
self._components.compilerImport.import(url, self._components.compilerImport.import(url,
(loadingMsg) => { (loadingMsg) => {
toolTip(loadingMsg) addTooltip(loadingMsg)
}, },
(error, content, cleanUrl, type, url) => { (error, content, cleanUrl, type, url) => {
if (!error) { if (!error) {

@ -47,8 +47,8 @@ class CmdInterpreterAPI {
self._components.sourceHighlighter.currentSourceLocation(null) self._components.sourceHighlighter.currentSourceLocation(null)
return return
} }
var lineColumnPos = self._deps.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, var lineColumnPos = self._deps.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file,
self._deps.compilersArtefacts['__last'].getSourceCode().sources, self._deps.compilersArtefacts['__last'].getSourceCode().sources,
self._deps.compilersArtefacts['__last'].getAsts()) self._deps.compilersArtefacts['__last'].getAsts())
self._components.sourceHighlighter.currentSourceLocation(lineColumnPos, rawLocation) self._components.sourceHighlighter.currentSourceLocation(lineColumnPos, rawLocation)
} }
@ -110,8 +110,8 @@ class CmdInterpreterAPI {
self.d.goTo = (row) => { self.d.goTo = (row) => {
if (self._deps.editor.current()) { if (self._deps.editor.current()) {
var breakPoint = new remixLib.code.BreakpointManager(self.d, (sourceLocation) => { var breakPoint = new remixLib.code.BreakpointManager(self.d, (sourceLocation) => {
return self._deps.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, return self._deps.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file,
self._deps.compilersArtefacts['__last'].getSourceCode().sources, self._deps.compilersArtefacts['__last'].getSourceCode().sources,
self._deps.compilersArtefacts['__last'].getAsts()) self._deps.compilersArtefacts['__last'].getAsts())
}) })
breakPoint.event.register('breakpointHit', (sourceLocation, currentStep) => { breakPoint.event.register('breakpointHit', (sourceLocation, currentStep) => {

@ -4,10 +4,9 @@ var SourceMappingDecoder = require('remix-lib').SourceMappingDecoder
function offsetToColumnConverter () { function offsetToColumnConverter () {
this.lineBreakPositionsByContent = {} this.lineBreakPositionsByContent = {}
this.sourceMappingDecoder = new SourceMappingDecoder() this.sourceMappingDecoder = new SourceMappingDecoder()
var self = this
// we don't listen anymore on compilation result for clearing the cache // we don't listen anymore on compilation result for clearing the cache
} }
offsetToColumnConverter.prototype.offsetToLineColumn = function (rawLocation, file, sources, asts) { offsetToColumnConverter.prototype.offsetToLineColumn = function (rawLocation, file, sources, asts) {
if (!this.lineBreakPositionsByContent[file]) { if (!this.lineBreakPositionsByContent[file]) {
for (var filename in asts) { for (var filename in asts) {

Loading…
Cancel
Save