Fix AST equality checks
This commit is contained in:
parent
db84119e33
commit
88f6d8d7ac
|
@ -578,7 +578,9 @@ class XMLPrinter : ASTVisitor
|
|||
override void visit(const FunctionLiteralExpression functionLiteralExpression)
|
||||
{
|
||||
output.writeln("<functionLiteralExpression type=\"",
|
||||
str(functionLiteralExpression.functionOrDelegate), "\">");
|
||||
functionLiteralExpression.functionOrDelegate != tok!""
|
||||
? str(functionLiteralExpression.functionOrDelegate)
|
||||
: "auto", "\">");
|
||||
functionLiteralExpression.accept(this);
|
||||
output.writeln("</functionLiteralExpression>");
|
||||
}
|
||||
|
|
|
@ -311,10 +311,12 @@ template visitIfNotNull(fields ...)
|
|||
}
|
||||
}
|
||||
|
||||
mixin template OpEquals()
|
||||
mixin template OpEquals(bool print = false)
|
||||
{
|
||||
override bool opEquals(Object other) const
|
||||
{
|
||||
static if (print)
|
||||
pragma(msg, generateOpEquals!(typeof(this)));
|
||||
mixin (generateOpEquals!(typeof(this)));
|
||||
}
|
||||
}
|
||||
|
@ -334,7 +336,7 @@ template generateOpEquals(T)
|
|||
{
|
||||
enum opEqualsPart = "\nif (obj." ~ p[0] ~ ".length != this." ~ p[0] ~ ".length) return false;\n"
|
||||
~ "foreach (i; 0 .. this." ~ p[0] ~ ".length)\n"
|
||||
~ "\tif (this." ~ p[0] ~ "[i] != obj." ~ p[0] ~ "[i]) return false;";
|
||||
~ "\tif (this." ~ p[0] ~ "[i] != obj." ~ p[0] ~ "[i]) return false;" ~ opEqualsPart!(p[1 .. $]);
|
||||
}
|
||||
else
|
||||
enum opEqualsPart = "\nif (obj." ~ p[0] ~ " != this." ~ p[0] ~ ") return false;" ~ opEqualsPart!(p[1 .. $]);
|
||||
|
|
Loading…
Reference in New Issue