Commit f111d4d4 authored by yann300's avatar yann300

use API

parent f88ba6a0
...@@ -3,14 +3,13 @@ var StaticAnalysisRunner = require('./staticAnalysisRunner.js') ...@@ -3,14 +3,13 @@ var StaticAnalysisRunner = require('./staticAnalysisRunner.js')
var yo = require('yo-yo') var yo = require('yo-yo')
var $ = require('jquery') var $ = require('jquery')
function staticAnalysisView (compilerEvent, renderer, editor, offsetToColumnConverter) { function staticAnalysisView (compilerEvent, rendererAPI, contentToolAPI) {
this.view = null this.view = null
this.renderer = renderer this.rendererAPI = rendererAPI
this.editor = editor
this.runner = new StaticAnalysisRunner() this.runner = new StaticAnalysisRunner()
this.offsetToColumnConverter = offsetToColumnConverter
this.modulesView = renderModules(this.runner.modules()) this.modulesView = renderModules(this.runner.modules())
this.lastCompilationResult = null this.lastCompilationResult = null
this.contentToolAPI = contentToolAPI
var self = this var self = this
compilerEvent.register('compilationFinished', function (success, data, source) { compilerEvent.register('compilationFinished', function (success, data, source) {
self.lastCompilationResult = null self.lastCompilationResult = null
...@@ -75,10 +74,10 @@ staticAnalysisView.prototype.run = function () { ...@@ -75,10 +74,10 @@ staticAnalysisView.prototype.run = function () {
start: parseInt(split[0]), start: parseInt(split[0]),
length: parseInt(split[1]) length: parseInt(split[1])
} }
location = self.offsetToColumnConverter.offsetToLineColumn(location, file, self.editor, self.lastCompilationResult) location = self.contentToolAPI.offsetToLineColumn(location, file)
location = self.lastCompilationResult.sourceList[file] + ':' + (location.start.line + 1) + ':' + (location.start.column + 1) + ':' location = self.lastCompilationResult.sourceList[file] + ':' + (location.start.line + 1) + ':' + (location.start.column + 1) + ':'
} }
self.renderer.error(location + ' ' + item.warning, warningContainer, {type: 'warning', useSpan: true, isHTML: true}) self.rendererAPI.renderItem(location + ' ' + item.warning, warningContainer, {type: 'warning', useSpan: true, isHTML: true})
}) })
}) })
if (warningContainer.html() === '') { if (warningContainer.html() === '') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment