mirror of https://gitlab.com/basile.b/dexed.git
#104, xor-pow + detect a libdparse issue
This commit is contained in:
parent
cc7aad9bd5
commit
f581c0642d
|
@ -155,6 +155,8 @@ private final class HalsteadMetric: ASTVisitor
|
||||||
expr.accept(this);
|
expr.accept(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO-crefactor: function-dtor-ctor-... should use a common template
|
||||||
|
|
||||||
override void visit(const(FunctionDeclaration) decl)
|
override void visit(const(FunctionDeclaration) decl)
|
||||||
{
|
{
|
||||||
beginFunction;
|
beginFunction;
|
||||||
|
@ -206,6 +208,14 @@ private final class HalsteadMetric: ASTVisitor
|
||||||
endFunction("dtorL" ~ to!string(sc.line), sc.line);
|
endFunction("dtorL" ~ to!string(sc.line), sc.line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO-clibdparse: Postblit needs position and line and column
|
||||||
|
/*override void visit(const(Postblit) pb)
|
||||||
|
{
|
||||||
|
beginFunction;
|
||||||
|
pb.accept(this);
|
||||||
|
endFunction("postblit" ~ to!string(pb.line), pb.line);
|
||||||
|
}*/
|
||||||
|
|
||||||
override void visit(const(PrimaryExpression) primary)
|
override void visit(const(PrimaryExpression) primary)
|
||||||
{
|
{
|
||||||
if (primary.identifierOrTemplateInstance !is null
|
if (primary.identifierOrTemplateInstance !is null
|
||||||
|
@ -442,8 +452,8 @@ private final class HalsteadMetric: ASTVisitor
|
||||||
else static if (is(T == InExpression)) op = expr.negated ? "!in" : "in";
|
else static if (is(T == InExpression)) op = expr.negated ? "!in" : "in";
|
||||||
else static if (is(T == OrExpression)) op = `|`;
|
else static if (is(T == OrExpression)) op = `|`;
|
||||||
else static if (is(T == OrOrExpression)) op = `||`;
|
else static if (is(T == OrOrExpression)) op = `||`;
|
||||||
else static if (is(T == PowExpression)) op = `^`;
|
else static if (is(T == PowExpression)) op = `^^`;
|
||||||
else static if (is(T == XorExpression)) op = `^^`;
|
else static if (is(T == XorExpression)) op = `^`;
|
||||||
else static assert(0, T.stringof);
|
else static assert(0, T.stringof);
|
||||||
}
|
}
|
||||||
++operators[op];
|
++operators[op];
|
||||||
|
@ -937,7 +947,7 @@ unittest
|
||||||
}
|
}
|
||||||
}.test;
|
}.test;
|
||||||
// would be 3 by considering bar as an operand
|
// would be 3 by considering bar as an operand
|
||||||
// but this is actually invalid code.
|
// but this is actually (almost always) invalid code.
|
||||||
assert(r.operandsKinds == 2);
|
assert(r.operandsKinds == 2);
|
||||||
assert(r.operatorsKinds == 3);
|
assert(r.operatorsKinds == 3);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue