Search in sources :

Example 1 with BLangStatementLink

use of org.wso2.ballerinalang.compiler.tree.statements.BLangStatement.BLangStatementLink in project ballerina by ballerina-lang.

the class Desugar method rewrite.

@SuppressWarnings("unchecked")
private <E extends BLangStatement> E rewrite(E statement, SymbolEnv env) {
    if (statement == null) {
        return null;
    }
    BLangStatementLink link = new BLangStatementLink();
    link.parent = currentLink;
    currentLink = link;
    BLangStatement stmt = (BLangStatement) rewrite((BLangNode) statement, env);
    // Link Statements.
    link.statement = stmt;
    stmt.statementLink = link;
    currentLink = link.parent;
    return (E) stmt;
}
Also used : BLangStatement(org.wso2.ballerinalang.compiler.tree.statements.BLangStatement) BLangNode(org.wso2.ballerinalang.compiler.tree.BLangNode) BLangStatementLink(org.wso2.ballerinalang.compiler.tree.statements.BLangStatement.BLangStatementLink)

Aggregations

BLangNode (org.wso2.ballerinalang.compiler.tree.BLangNode)1 BLangStatement (org.wso2.ballerinalang.compiler.tree.statements.BLangStatement)1 BLangStatementLink (org.wso2.ballerinalang.compiler.tree.statements.BLangStatement.BLangStatementLink)1