Merge pull request #2858 from ethereum/SHdouble

use SourceHighlighters in StaticAnalisys and remove multiple highlight
pull/4/head
yann300 5 years ago committed by GitHub
commit 42fafe8563
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/app/editor/SourceHighlighters.js
  2. 6
      src/app/tabs/staticanalysis/staticAnalysisView.js

@ -14,8 +14,15 @@ class SourceHighlighters {
try {
if (!this.highlighters[from]) this.highlighters[from] = []
const sourceHighlight = new SourceHighlighter()
sourceHighlight.currentSourceLocationFromfileName(position, filePath, hexColor)
this.highlighters[from].push(sourceHighlight)
if (
!this.highlighters[from].length ||
(this.highlighters[from].length && !this.highlighters[from].find((el) => {
return el.source === filePath && el.position === position
}))
) {
sourceHighlight.currentSourceLocationFromfileName(position, filePath, hexColor)
this.highlighters[from].push(sourceHighlight)
}
} catch (e) {
throw e
}

@ -108,9 +108,9 @@ staticAnalysisView.prototype.run = function () {
if (!this.view) {
return
}
const highlightLocation = (location, fileName) => {
// await this.analysisModule.call('editor', 'highlight', location, fileName) @todo(#2834) use this after fixing the issue
this.sourceHighlighter.currentSourceLocationFromfileName(location, fileName)
const highlightLocation = async (location, fileName) => {
await this.analysisModule.call('editor', 'discardHighlight')
await this.analysisModule.call('editor', 'highlight', location, fileName)
}
const selected = this.selectedModules()
const warningContainer = $('#staticanalysisresult')

Loading…
Cancel
Save