Don't use _.pluck when building TokenizedLines

This commit is contained in:
Nathan Sobo
2014-05-19 22:20:57 -06:00
parent 353eb27d2e
commit 0ad26c337a

View File

@@ -7,11 +7,22 @@ class TokenizedLine
constructor: ({tokens, @lineEnding, @ruleStack, @startBufferColumn, @fold, @tabLength, @indentLevel}) ->
@tokens = @breakOutAtomicTokens(tokens)
@startBufferColumn ?= 0
@text = _.pluck(@tokens, 'value').join('')
@bufferDelta = _.sum(_.pluck(@tokens, 'bufferDelta'))
@text = @buildText()
@bufferDelta = @buildBufferDelta()
@id = idCounter++
@markLeadingAndTrailingWhitespaceTokens()
buildText: ->
text = ""
text += token.value for token in @tokens
text
buildBufferDelta: ->
delta = 0
delta += token.bufferDelta for token in @tokens
delta
copy: ->
new TokenizedLine({@tokens, @lineEnding, @ruleStack, @startBufferColumn, @fold})