kill foreach opApply iteration (too slow)

This commit is contained in:
Dmitry Olshansky 2013-03-05 23:17:40 +04:00
parent c1fcef1873
commit 431dd3c3d2
2 changed files with 12 additions and 45 deletions

View File

@ -163,19 +163,19 @@ class AssignExpression
{ {
assert ( assert (
operator == TokenType.assign operator == TokenType.assign
|| operator == TokenType.plusEqual || operator == TokenType.plusEquals
|| operator == TokenType.minusEqual || operator == TokenType.minusEquals
|| operator == TokenType.mulEqual || operator == TokenType.mulEquals
|| operator == TokenType.divEqual || operator == TokenType.divEquals
|| operator == TokenType.modEqual || operator == TokenType.modEquals
|| operator == TokenType.bitAndEqual || operator == TokenType.bitAndEquals
|| operator == TokenType.bitOrEqual || operator == TokenType.bitOrEquals
|| operator == TokenType.xorEqual || operator == TokenType.xorEquals
|| operator == TokenType.catEqual || operator == TokenType.catEquals
|| operator == TokenType.shiftLeftEqual || operator == TokenType.shiftLeftEqual
|| operator == TokenType.shiftRightEqual || operator == TokenType.shiftRightEqual
|| operator == TokenType.unsignedShiftRightEqual || operator == TokenType.unsignedShiftRightEqual
|| operator == TokenType.powEqual || operator == TokenType.powEquals
); );
} }
} }

View File

@ -102,7 +102,7 @@
* *
* Copyright: Brian Schott 2013 * Copyright: Brian Schott 2013
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt Boost, License 1.0) * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt Boost, License 1.0)
* Authors: Brian Schott, Dmitry Olshansky * Authors: Brian Schott, Dmitry Olshansky
* Source: $(PHOBOSSRC std/d/_lexer.d) * Source: $(PHOBOSSRC std/d/_lexer.d)
*/ */
@ -358,39 +358,6 @@ struct TokenRange(LexSrc)
return r; return r;
} }
/**
* Foreach operation
*/
int opApply(int delegate(Token) dg)
{
int result = 0;
while (!empty)
{
result = dg(front);
if (result)
break;
popFront();
}
return result;
}
/**
* Foreach operation
*/
int opApply(int delegate(size_t, Token) dg)
{
int result = 0;
int i = 0;
while (!empty)
{
result = dg(i, front);
if (result)
break;
popFront();
}
return result;
}
/** /**
* Removes the current token from the range * Removes the current token from the range
*/ */