summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Christiaens2010-09-28 10:13:36 (EDT)
committer Knut Wannheden2011-04-28 05:18:05 (EDT)
commit817dd5f803804cba93107a0df4812aeae3cee0c4 (patch)
tree0e50b72fb4178cadba512f2c8fa322f935c0dbde
parent707cb536df8c0085bdfc5b5045219de70f5b9897 (diff)
downloadorg.eclipse.xtext-817dd5f803804cba93107a0df4812aeae3cee0c4.zip
org.eclipse.xtext-817dd5f803804cba93107a0df4812aeae3cee0c4.tar.gz
org.eclipse.xtext-817dd5f803804cba93107a0df4812aeae3cee0c4.tar.bz2
Removed use of copy list.
-rw-r--r--plugins/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/FastDamagerRepairer.java22
1 files changed, 9 insertions, 13 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 801f07e..3f769fd 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
@@ -197,20 +197,18 @@ public class FastDamagerRepairer extends AbstractDamagerRepairer {
tokenStartsAt += lengthDiff;
nextTokenStartsAt += lengthDiff;
- LinkedList<TokenInfo> tokenInfosCopy = new LinkedList<TokenInfo>(tokenInfos);
- assert tokenInfosCopy.equals(tokenInfos);
- ListIterator<TokenInfo> tokenInfosCopyIt = tokenInfosCopy.listIterator(tokenInfoIdx);
+ tokenInfosIt = tokenInfos.listIterator(tokenInfoIdx);
// compute region length
while (true) {
boolean removed = false;
- if (token == Token.EOF_TOKEN || !tokenInfosCopyIt.hasNext())
+ if (token == Token.EOF_TOKEN || !tokenInfosIt.hasNext())
break;
while (true) {
- if (!tokenInfosCopyIt.hasNext())
+ if (!tokenInfosIt.hasNext())
break;
- tokenInfo = tokenInfosCopyIt.next();
+ tokenInfo = tokenInfosIt.next();
if (token.getStartIndex() >= afterRegion) {
if (tokenStartsAt == token.getStartIndex() && !tokenCorrespondsToTokenInfo(token, tokenInfo)) {
@@ -221,8 +219,7 @@ public class FastDamagerRepairer extends AbstractDamagerRepairer {
nextTokenStartsAt = tokenStartsAt + tokenInfo.length;
if (nextTokenStartsAt > token.getStopIndex() + 1)
break;
- tokenInfos.remove(tokenInfoIdx);
- tokenInfosCopyIt.remove();
+ tokenInfosIt.remove();
removed = true;
tokenStartsAt = nextTokenStartsAt;
@@ -230,14 +227,13 @@ public class FastDamagerRepairer extends AbstractDamagerRepairer {
break;
}
TokenInfo tokenInfoToAdd = createTokenInfo(token);
-
- tokenInfos.add(tokenInfoIdx++, tokenInfoToAdd);
+ tokenInfoIdx++;
if (removed) {
- tokenInfosCopyIt.add(tokenInfoToAdd);
+ tokenInfosIt.add(tokenInfoToAdd);
} else {
- tokenInfosCopyIt.previous();
- tokenInfosCopyIt.add(tokenInfoToAdd);
+ tokenInfosIt.previous();
+ tokenInfosIt.add(tokenInfoToAdd);
}
token = (CommonToken) source.nextToken();