Thanks for doing this, Vinay. By the way, it later dawned on me that I could have resolved the test failure by simply having the injection only apply when generating Java code, i.e.
#if __java__
INJECT IfStatement :
{
public Node getElseBlock() {
Node result = getLastChild();
Token tok = (Token) result.previousSibling();
if (tok.getType() == TokenType.ELSE) return result;
return null;
}
}
#endif
That said, it is better if the various API that is generated for Java also works in the other languages -- at least to the extent possible. I had originally written the above injection as:
And it was failing to translate firstChildOfType into C#. Actually, I suspect that the only reason the Python tests did not also fail was because Python leaves a lot of resolution to run-time, and the method was never being called. But in C# it was a compile-time failure.
Thanks for doing this, Vinay. By the way, it later dawned on me that I could have resolved the test failure by simply having the injection only apply when generating Java code, i.e.
That said, it is better if the various API that is generated for Java also works in the other languages -- at least to the extent possible. I had originally written the above injection as:
And it was failing to translate
firstChildOfType
into C#. Actually, I suspect that the only reason the Python tests did not also fail was because Python leaves a lot of resolution to run-time, and the method was never being called. But in C# it was a compile-time failure.