Add some types to make code more readable

Change-Id: I5b4ba39ad4226e83d6524ccffc3caf8f942384f1
This commit is contained in:
Ole Rehmsen
2019-07-02 13:16:14 +02:00
parent 724f6f53fb
commit 0b087cb9d5
2 changed files with 15 additions and 2 deletions

View File

@@ -204,6 +204,7 @@
*
* @param {!Object} state
* @param {!Array<!Object>} sections
* @return {{lineDelta: {left: number, right: number}, groups: !Array<!Object>, newSectionIndex: number}}
*/
_processNext(state, sections) {
const firstUncollapsibleSectionIndex =
@@ -259,7 +260,7 @@
* @param {!Object} state
* @param {!Array<Object>} sections
* @param {number} firstUncollapsibleSectionIndex
* @return {!Object}
* @return {{lineDelta: {left: number, right: number}, groups: !Array<!Object>, newSectionIndex: number}}
*/
_processCollapsibleSections(
state, sections, firstUncollapsibleSectionIndex) {
@@ -300,6 +301,12 @@
return this._linesLeft(section).length;
},
/**
* @param {!Array<!Object>} sections
* @param {number} offsetLeft
* @param {number} offsetRight
* @return {!Array<!Object>} (GrDiffGroup)
*/
_sectionsToGroups(sections, offsetLeft, offsetRight) {
return sections.map(section => {
const group = this._sectionToGroup(section, offsetLeft, offsetRight);
@@ -310,6 +317,12 @@
});
},
/**
* @param {!Object} section
* @param {number} offsetLeft
* @param {number} offsetRight
* @return {!Object} (GrDiffGroup)
*/
_sectionToGroup(section, offsetLeft, offsetRight) {
const type = section.ab ? GrDiffGroup.Type.BOTH : GrDiffGroup.Type.DELTA;
const lines = this._linesFromSection(section, offsetLeft, offsetRight);

View File

@@ -218,7 +218,7 @@
},
/**
* Start processing symtax for the loaded diff and notify layer listeners
* Start processing syntax for the loaded diff and notify layer listeners
* as syntax info comes online.
* @return {Promise}
*/