Clear offsetToLineColumn cache when new compilation arrives

pull/1/head
yann300 6 years ago
parent 10395b85fe
commit 7955dbee3c
  1. 10
      src/app.js
  2. 6
      src/lib/offsetToLineColumnConverter.js

@ -263,10 +263,14 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
return 'Are you sure you want to leave?'
}
let appStore = new EntityStore('module', 'name')
const appManager = new RemixAppManager(appStore)
registry.put({api: appManager, name: 'appmanager'})
registry.put({api: msg => self._components.mainview.logHtmlMessage(msg), name: 'logCallback'})
// helper for converting offset to line/column
var offsetToLineColumnConverter = new OffsetToLineColumnConverter()
var offsetToLineColumnConverter = new OffsetToLineColumnConverter(appManager)
registry.put({api: offsetToLineColumnConverter, name: 'offsettolinecolumnconverter'})
// json structure for hosting the last compilattion result
@ -318,10 +322,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
// TODO: There are still a lot of dep between mainview and filemanager
let appStore = new EntityStore('module', 'name')
const appManager = new RemixAppManager(appStore)
registry.put({api: appManager, name: 'appmanager'})
// ----------------- file manager ----------------------------
self._components.fileManager = new FileManager()
const fileManager = self._components.fileManager

@ -1,10 +1,12 @@
'use strict'
var SourceMappingDecoder = require('remix-lib').SourceMappingDecoder
function offsetToColumnConverter () {
function offsetToColumnConverter (appManager) {
this.lineBreakPositionsByContent = {}
this.sourceMappingDecoder = new SourceMappingDecoder()
// we don't listen anymore on compilation result for clearing the cache
appManager.data.proxy.event.register('sendCompilationResult', () => {
this.clear()
})
}
offsetToColumnConverter.prototype.offsetToLineColumn = function (rawLocation, file, sources, asts) {

Loading…
Cancel
Save