refactor codelist view, put conditional if to return early

pull/1/head
Iuri Matias 7 years ago committed by yann300
parent e207efbcfa
commit c0f655cd40
  1. 8
      src/app/debugger/debuggerUI/vmDebugger/CodeListView.js

@ -46,7 +46,7 @@ CodeListView.prototype.init = function () {
} }
CodeListView.prototype.indexChanged = function (index) { CodeListView.prototype.indexChanged = function (index) {
if (index >= 0) { if (index < 0) return
if (this.itemSelected) { if (this.itemSelected) {
this.itemSelected.removeAttribute('selected') this.itemSelected.removeAttribute('selected')
this.itemSelected.removeAttribute('style') this.itemSelected.removeAttribute('style')
@ -61,16 +61,16 @@ CodeListView.prototype.indexChanged = function (index) {
this.itemSelected.firstChild.setAttribute('style', 'margin-left: 2px') this.itemSelected.firstChild.setAttribute('style', 'margin-left: 2px')
} }
this.codeView.scrollTop = this.itemSelected.offsetTop - parseInt(this.codeView.offsetTop) this.codeView.scrollTop = this.itemSelected.offsetTop - parseInt(this.codeView.offsetTop)
}
} }
CodeListView.prototype.changed = function (code, address, index) { CodeListView.prototype.changed = function (code, address, index) {
if (this.address !== address) { if (this.address === address) {
return this.indexChanged(index)
}
this.code = code this.code = code
this.address = address this.address = address
this.codeView = this.renderAssemblyItems() this.codeView = this.renderAssemblyItems()
this.basicPanel.setContent(this.codeView) this.basicPanel.setContent(this.codeView)
}
this.indexChanged(index) this.indexChanged(index)
} }

Loading…
Cancel
Save