Skip to content

Commit

Permalink
Removes changes to DustMite
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-tan committed Apr 16, 2015
1 parent f628b56 commit 0a8ddbf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
22 changes: 11 additions & 11 deletions DustMite/dustmite.d
Expand Up @@ -177,7 +177,7 @@ EOS");
return showHelp ? 0 : 64; // EX_USAGE
}

enforce(!(stripComments && coverageDir.length), "Sorry, --strip-comments is not compatible with --coverage");
enforce(!(stripComments && coverageDir), "Sorry, --strip-comments is not compatible with --coverage");

dir = args[1];
if (isDirSeparator(dir[$-1]))
Expand Down Expand Up @@ -216,7 +216,7 @@ EOS");

applyNoRemoveMagic();
applyNoRemoveRegex(noRemoveStr, reduceOnly);
if (coverageDir.length)
if (coverageDir)
loadCoverage(coverageDir);
if (!obfuscate && !noOptimize)
optimize(root);
Expand Down Expand Up @@ -662,10 +662,10 @@ void dump(Entity root, ref Reduction reduction, void delegate(string) handleFile
dumpEntity(c);
}
else
if (e.head.length || e.tail.length)
if (e.head || e.tail)
{
assert(e.children.length==0);
if (e.head.length)
if (e.head)
{
if (e.head == reduction.from)
handleText(reduction.to);
Expand Down Expand Up @@ -1030,7 +1030,7 @@ bool test(Reduction reduction)
{
tests++;

if (globalCache.length)
if (globalCache)
{
if (!exists(globalCache)) mkdirRecurse(globalCache);
string cacheBase = absolutePath(buildPath(globalCache, formatHash(digest))) ~ "-";
Expand Down Expand Up @@ -1312,20 +1312,20 @@ void dumpSet(string fn)
"[",
e.noRemove ? "!" : "",
" ",
e.isFile ? e.filename.length ? printableFN(e.filename) ~ " " : null : e.head.length ? printable(e.head) ~ " " : null,
e.tail.length ? printable(e.tail) ~ " " : null,
e.comment.length ? "/* " ~ e.comment ~ " */ " : null,
e.isFile ? e.filename ? printableFN(e.filename) ~ " " : null : e.head ? printable(e.head) ~ " " : null,
e.tail ? printable(e.tail) ~ " " : null,
e.comment ? "/* " ~ e.comment ~ " */ " : null,
"]"
);
}
else
{
f.writeln("[", e.noRemove ? "!" : "", e.comment.length ? " // " ~ e.comment : null);
f.writeln("[", e.noRemove ? "!" : "", e.comment ? " // " ~ e.comment : null);
if (e.isFile) f.writeln(prefix, " ", printableFN(e.filename));
if (e.head.length) f.writeln(prefix, " ", printable(e.head));
if (e.head) f.writeln(prefix, " ", printable(e.head));
foreach (c; e.children)
print(c, depth+1);
if (e.tail.length) f.writeln(prefix, " ", printable(e.tail));
if (e.tail) f.writeln(prefix, " ", printable(e.tail));
f.write(prefix, "]");
}
if (e.id in dependents || trace)
Expand Down
30 changes: 15 additions & 15 deletions DustMite/splitter.d
Expand Up @@ -440,7 +440,7 @@ struct DSplitter
advance();
break;
case 'r':
if (consume(`r"`).length)
if (consume(`r"`))
{
result = Token.other;
while (advance() != '"')
Expand All @@ -465,7 +465,7 @@ struct DSplitter
if (consume('*'))
{
result = Token.comment;
while (!consume("*/").length)
while (!consume("*/"))
advance();
}
else
Expand All @@ -475,10 +475,10 @@ struct DSplitter
int commentLevel = 1;
while (commentLevel)
{
if (consume("/+").length)
if (consume("/+"))
commentLevel++;
else
if (consume("+/").length)
if (consume("+/"))
commentLevel--;
else
advance();
Expand All @@ -488,11 +488,11 @@ struct DSplitter
goto default;
break;
case '@':
if (consume("disable").length
|| consume("property").length
|| consume("safe").length
|| consume("trusted").length
|| consume("system").length
if (consume("disable")
|| consume("property")
|| consume("safe")
|| consume("trusted")
|| consume("system")
)
return Token.other;
goto default;
Expand All @@ -514,7 +514,7 @@ struct DSplitter
foreach (Token t; Token.init..Token.max)
{
auto text = tokenText[t];
if (!text.length)
if (!text)
continue;
if (!s[i..$].startsWith(text))
continue;
Expand All @@ -528,7 +528,7 @@ struct DSplitter
if (bestLength)
{
auto consumed = consume(tokenText[best]);
assert(consumed.length);
assert(consumed);
return best;
}

Expand Down Expand Up @@ -703,7 +703,7 @@ struct DSplitter
reset(code);
auto entity = new Entity;
parseScope(entity, Token.none);
assert(!entity.head.length && !entity.tail.length);
assert(!entity.head && !entity.tail);
postProcess(entity.children);
return [entity];
}
Expand All @@ -724,7 +724,7 @@ struct DSplitter
{
if (!result.length)
result ~= new Entity();
if (!result[$-1].tail.length)
if (!result[$-1].tail)
result[$-1].tail = span;
else
{
Expand Down Expand Up @@ -793,7 +793,7 @@ struct DSplitter

size_t[] points;
foreach_reverse (i, e; entities[0..$-1])
if (getSeparatorType(e.token) == SeparatorType.binary && e.children.length)
if (getSeparatorType(e.token) == SeparatorType.binary && e.children)
points ~= i;

if (points.length)
Expand All @@ -814,7 +814,7 @@ struct DSplitter
static void postProcessDependencyBlock(ref Entity[] entities)
{
foreach (i, e; entities)
if (i && !e.token && e.children.length && getSeparatorType(e.children[0].token) == SeparatorType.binary && !e.children[0].children.length)
if (i && !e.token && e.children.length && getSeparatorType(e.children[0].token) == SeparatorType.binary && !e.children[0].children)
e.children[0].dependencies ~= entities[i-1];
}

Expand Down

0 comments on commit 0a8ddbf

Please sign in to comment.