Skip to content

Commit

Permalink
add backwards compatibility aliases (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
WebFreak001 authored Dec 30, 2022
1 parent 94cc2ef commit 592ef39
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion src/dparse/ast.d
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ template generateOpEquals(T)
{
enum opEqualsPart = opEqualsPart!(p[0 .. $/2]) ~ opEqualsPart!(p[$/2 .. $]);
}
else static if (p.length && !isSomeFunction!(typeof(__traits(getMember, T, p[0])))
else static if (p.length
&& !__traits(isDeprecated, __traits(getMember, T, p[0]))
&& !isSomeFunction!(typeof(__traits(getMember, T, p[0])))
&& !p[0].among("comment", "line", "column", "endLocation", "startLocation", "index", "dotLocation"))
{
static if (isDynamicArray!(typeof(__traits(getMember, T, p[0]))))
Expand Down Expand Up @@ -1971,6 +1973,34 @@ final class IfStatement : BaseNode
/** */ size_t line;
/** */ size_t column;
mixin OpEquals;

deprecated("use condition.typeCtors") inout(IdType[]) typeCtors() inout @property
{
if (!condition)
return null;
return condition.typeCtors;
}

deprecated("use condition.type") inout(Type) type() inout @property
{
if (!condition)
return null;
return condition.type;
}

deprecated("use condition.identifier") inout(Token) identifier() inout @property
{
if (!condition)
return Token.init;
return condition.identifier;
}

deprecated("use condition.expression") inout(Expression) expression() inout @property
{
if (!condition)
return null;
return condition.expression;
}
}

/**
Expand Down Expand Up @@ -3515,6 +3545,13 @@ final class WhileStatement : BaseNode
/** */ DeclarationOrStatement declarationOrStatement;
/** */ size_t startIndex;
mixin OpEquals;

deprecated("use condition.expression") inout(Expression) expression() inout @property
{
if (!condition)
return null;
return condition.expression;
}
}

///
Expand Down

0 comments on commit 592ef39

Please sign in to comment.