Use guard clauses, instead of crappy ANDs

This commit is contained in:
Antonio Scandurra 2015-02-16 17:56:36 +01:00
parent e62e26a3c2
commit 88ca44d53b

View File

@ -125,10 +125,14 @@ class TokenizedLine
@lineEnding is null @lineEnding is null
isOutsidePhantomToken: (column) -> isOutsidePhantomToken: (column) ->
!@tokens[0].isPhantom || column > @tokens[0].screenDelta return true unless @tokens[0].isPhantom
column > @tokens[0].screenDelta
isInsidePhantomToken: (column) -> isInsidePhantomToken: (column) ->
@tokens[0].isPhantom && column < @tokens[0].screenDelta return false unless @tokens[0].isPhantom
column < @tokens[0].screenDelta
hasOnlyPhantomTokens: -> hasOnlyPhantomTokens: ->
@tokens.length == 1 && @tokens[0].isPhantom @tokens.length == 1 && @tokens[0].isPhantom