Add explicit return after for loop

This commit is contained in:
Kevin Sawicki
2015-03-18 15:34:50 -07:00
parent 590a4b0fd5
commit d9a5aff919
4 changed files with 33 additions and 3 deletions

View File

@@ -842,7 +842,9 @@ class TextEditor extends Model
# {Number} index of that selection.
mutateSelectedText: (fn) ->
@mergeIntersectingSelections =>
@transact => fn(selection, index) for selection, index in @getSelections()
@transact =>
fn(selection, index) for selection, index in @getSelections()
return
# Move lines intersection the most recent selection up by one row in screen
# coordinates.
@@ -978,6 +980,7 @@ class TextEditor extends Model
selection.setBufferRange(selectedBufferRange.translate([delta, 0]))
for [foldStartRow, foldEndRow] in foldedRowRanges
@createFold(foldStartRow + delta, foldEndRow + delta)
return
# Deprecated: Use {::duplicateLines} instead.
duplicateLine: ->
@@ -1013,6 +1016,7 @@ class TextEditor extends Model
while ++row < end.row
@addSelectionForBufferRange([[row, 0], [row, Infinity]])
@addSelectionForBufferRange([[end.row, 0], [end.row, end.column]]) unless end.column is 0
return
# Extended: For each selection, transpose the selected text.
#
@@ -1779,7 +1783,7 @@ class TextEditor extends Model
# Extended: Get an Array of all {Cursor}s.
getCursors: ->
cursor for cursor in @cursors
@cursors.slice()
# Extended: Get all {Cursors}s, ordered by their position in the buffer
# instead of the order in which they were added.
@@ -1822,6 +1826,7 @@ class TextEditor extends Model
cursor.destroy()
else
positions[position] = true
return
preserveCursorPositionOnBufferReload: ->
cursorPosition = null
@@ -1886,6 +1891,7 @@ class TextEditor extends Model
selections[i].setBufferRange(bufferRange, options)
else
@addSelectionForBufferRange(bufferRange, options)
return
# Essential: Get the {Range} of the most recently added selection in screen
# coordinates.
@@ -1932,6 +1938,7 @@ class TextEditor extends Model
selections[i].setScreenRange(screenRange, options)
else
@addSelectionForScreenRange(screenRange, options)
return
# Essential: Add a selection for the given range in buffer coordinates.
#
@@ -2159,7 +2166,7 @@ class TextEditor extends Model
#
# Returns: An {Array} of {Selection}s.
getSelections: ->
selection for selection in @selections
@selections.slice()
# Extended: Get all {Selection}s, ordered by their position in the buffer
# instead of the order in which they were added.
@@ -2206,15 +2213,18 @@ class TextEditor extends Model
expandSelectionsForward: (fn) ->
@mergeIntersectingSelections =>
fn(selection) for selection in @getSelections()
return
# Calls the given function with each selection, then merges selections in the
# reversed orientation
expandSelectionsBackward: (fn) ->
@mergeIntersectingSelections reversed: true, =>
fn(selection) for selection in @getSelections()
return
finalizeSelections: ->
selection.finalize() for selection in @getSelections()
return
selectionsForScreenRows: (startRow, endRow) ->
@getSelections().filter (selection) -> selection.intersectsScreenRowRange(startRow, endRow)
@@ -2620,6 +2630,7 @@ class TextEditor extends Model
else
selection.copy(maintainClipboard, false)
maintainClipboard = true
return
# Essential: For each selection, cut the selected text.
cutSelectedText: ->
@@ -2714,6 +2725,7 @@ class TextEditor extends Model
# Extended: For each selection, fold the rows it intersects.
foldSelectedLines: ->
selection.fold() for selection in @getSelections()
return
# Extended: Fold all foldable lines.
foldAll: ->
@@ -2796,6 +2808,8 @@ class TextEditor extends Model
for row in [bufferRange.end.row..bufferRange.start.row]
fold.destroy() for fold in @displayBuffer.foldsStartingAtBufferRow(row)
return
# Remove any {Fold}s found that contain the given buffer range.
destroyFoldsContainingBufferRange: (bufferRange) ->
@unfoldBufferRow(bufferRange.start.row)