| author | Mark Christiaens | 2010-09-28 09:37:51 (EDT) |
|---|---|---|
| committer | Knut Wannheden | 2011-04-28 05:18:04 (EDT) |
| commit | 8ab4970de3f4fec080ae262ade64f09c74a0ba1a (patch) (side-by-side diff) | |
| tree | d7c27236d8fbae0a50fc13ce4de353bbd39dbff5 | |
| parent | 2a8fb588c2b7fce6f19f8183f07f313ab03de5e3 (diff) | |
| download | org.eclipse.xtext-8ab4970de3f4fec080ae262ade64f09c74a0ba1a.zip org.eclipse.xtext-8ab4970de3f4fec080ae262ade64f09c74a0ba1a.tar.gz org.eclipse.xtext-8ab4970de3f4fec080ae262ade64f09c74a0ba1a.tar.bz2 | |
Removed a test and an clear of the copied list.
| -rw-r--r-- | plugins/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/FastDamagerRepairer.java | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/plugins/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/FastDamagerRepairer.java b/plugins/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/FastDamagerRepairer.java index d71169c..9f36251 100644 --- a/plugins/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/FastDamagerRepairer.java +++ b/plugins/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/FastDamagerRepairer.java @@ -195,7 +195,7 @@ public class FastDamagerRepairer extends AbstractDamagerRepairer { int afterRegion = e.fOffset + e.fText.length(); tokenStartsAt += lengthDiff; - nextTokenStartsAt += lengthDiff; + nextTokenStartsAt += lengthDiff; LinkedList<TokenInfo> tokenInfosCopy = new LinkedList<TokenInfo>(tokenInfos); assert tokenInfosCopy.equals(tokenInfos); @@ -214,20 +214,19 @@ public class FastDamagerRepairer extends AbstractDamagerRepairer { TokenInfo tokenInfoCopy = tokenInfosCopyIt.next(); if (token.getStartIndex() >= afterRegion) { - if (tokenStartsAt == token.getStartIndex() - && !tokenCorrespondsToTokenInfo(token, tokenInfo)) { + if (tokenStartsAt == token.getStartIndex() && !tokenCorrespondsToTokenInfo(token, tokenInfo)) { return new Region(regionOffset, token.getStartIndex() - regionOffset); } } - - nextTokenStartsAt = tokenStartsAt + tokenInfo.length; + + nextTokenStartsAt = tokenStartsAt + tokenInfo.length; if (nextTokenStartsAt > token.getStopIndex() + 1) break; tokenInfos.remove(tokenInfoIdx); tokenInfosCopyIt.remove(); removed = true; - tokenStartsAt = nextTokenStartsAt; + tokenStartsAt = nextTokenStartsAt; if (tokenStartsAt > token.getStartIndex()) break; } @@ -235,8 +234,6 @@ public class FastDamagerRepairer extends AbstractDamagerRepairer { tokenInfos.add(tokenInfoIdx++, tokenInfoToAdd); - // assert tokenInfosCopyIt.hasPrevious(); - if (removed) { tokenInfosCopyIt.add(tokenInfoToAdd); } else { @@ -247,16 +244,13 @@ public class FastDamagerRepairer extends AbstractDamagerRepairer { token = (CommonToken) source.nextToken(); } tokenInfos.subList(tokenInfoIdx, tokenInfos.size()).clear(); - tokenInfosCopy.subList(tokenInfoIdx, tokenInfosCopy.size()).clear(); // add subsequent tokens - if (tokenInfoIdx >= tokenInfos.size()) { - while (token != Token.EOF_TOKEN) { - tokenInfos.add(createTokenInfo(token)); - tokenInfosCopy.add(createTokenInfo(token)); - token = (CommonToken) source.nextToken(); - } + while (token != Token.EOF_TOKEN) { + tokenInfos.add(createTokenInfo(token)); + tokenInfosCopy.add(createTokenInfo(token)); + token = (CommonToken) source.nextToken(); } return new Region(regionOffset, regionLength); |

