Don't recompute pair boolean when building token

Pass in hasPairedCharacter to the Token constructor when it is
being broken out from the parent token instead of recomputing it.
This commit is contained in:
Kevin Sawicki 2014-10-28 18:02:57 -07:00
parent 54260230c6
commit 9abc4580f4

View File

@ -21,10 +21,10 @@ class Token
firstTrailingWhitespaceIndex: null
hasInvisibleCharacters: false
constructor: ({@value, @scopes, @isAtomic, @bufferDelta, @isHardTab}) ->
constructor: ({@value, @scopes, @isAtomic, @bufferDelta, @isHardTab, @hasPairedCharacter}) ->
@screenDelta = @value.length
@bufferDelta ?= @screenDelta
@hasPairedCharacter = textUtils.hasPairedCharacter(@value)
@hasPairedCharacter ?= textUtils.hasPairedCharacter(@value)
isEqual: (other) ->
# TODO: scopes is deprecated. This is here for the sake of lang package tests
@ -125,6 +125,7 @@ class Token
value: value[index..index + 1]
scopes: @scopes
isAtomic: true
hasPairedCharacter: true
)
buildHardTabToken: (tabLength, column) ->