Skip to content

Commit 592ef39

Browse files
authored
add backwards compatibility aliases (#478)
1 parent 94cc2ef commit 592ef39

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

src/dparse/ast.d

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,9 @@ template generateOpEquals(T)
418418
{
419419
enum opEqualsPart = opEqualsPart!(p[0 .. $/2]) ~ opEqualsPart!(p[$/2 .. $]);
420420
}
421-
else static if (p.length && !isSomeFunction!(typeof(__traits(getMember, T, p[0])))
421+
else static if (p.length
422+
&& !__traits(isDeprecated, __traits(getMember, T, p[0]))
423+
&& !isSomeFunction!(typeof(__traits(getMember, T, p[0])))
422424
&& !p[0].among("comment", "line", "column", "endLocation", "startLocation", "index", "dotLocation"))
423425
{
424426
static if (isDynamicArray!(typeof(__traits(getMember, T, p[0]))))
@@ -1971,6 +1973,34 @@ final class IfStatement : BaseNode
19711973
/** */ size_t line;
19721974
/** */ size_t column;
19731975
mixin OpEquals;
1976+
1977+
deprecated("use condition.typeCtors") inout(IdType[]) typeCtors() inout @property
1978+
{
1979+
if (!condition)
1980+
return null;
1981+
return condition.typeCtors;
1982+
}
1983+
1984+
deprecated("use condition.type") inout(Type) type() inout @property
1985+
{
1986+
if (!condition)
1987+
return null;
1988+
return condition.type;
1989+
}
1990+
1991+
deprecated("use condition.identifier") inout(Token) identifier() inout @property
1992+
{
1993+
if (!condition)
1994+
return Token.init;
1995+
return condition.identifier;
1996+
}
1997+
1998+
deprecated("use condition.expression") inout(Expression) expression() inout @property
1999+
{
2000+
if (!condition)
2001+
return null;
2002+
return condition.expression;
2003+
}
19742004
}
19752005

19762006
/**
@@ -3515,6 +3545,13 @@ final class WhileStatement : BaseNode
35153545
/** */ DeclarationOrStatement declarationOrStatement;
35163546
/** */ size_t startIndex;
35173547
mixin OpEquals;
3548+
3549+
deprecated("use condition.expression") inout(Expression) expression() inout @property
3550+
{
3551+
if (!condition)
3552+
return null;
3553+
return condition.expression;
3554+
}
35183555
}
35193556

35203557
///

0 commit comments

Comments
 (0)