From c1d4f3f1a002f975d882adca60ce9397b2dae9c9 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 8 Sep 2015 10:33:22 -0600 Subject: [PATCH] :art: Only pop from scopeStarts if top of stack matches ending scope --- src/token-iterator.coffee | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/token-iterator.coffee b/src/token-iterator.coffee index 1d940945d..c0aed798a 100644 --- a/src/token-iterator.coffee +++ b/src/token-iterator.coffee @@ -33,13 +33,10 @@ class TokenIterator if tag < 0 if tag % 2 is 0 scopeName = atom.grammars.scopeForId(tag + 1) - if @scopeStarts.length is 0 - @scopeEnds.push(scopeName) + if @scopeStarts[@scopeStarts.length - 1] is scopeName + @scopeStarts.pop() else - startsTop = this.scopeStarts.pop() - if startsTop isnt scopeName - @scopeStarts.push(startsTop) - @scopeEnds.push(scopeName) + @scopeEnds.push() @scopes.pop() else scope = atom.grammars.scopeForId(tag)