RemoveParameterSolver.java 文件源码

java
阅读 17 收藏 0 点赞 0 评论 0

项目:Purify 作者:
/**
 * Remove the separator (,) between arguments. 
 *  
 * @param file Source file to edit.
 * @param context ExpressionList context.
 * @param index Parameter index of the argument ("a", "b") "a" = 0, "b" = 1
 */
private void removeCallSeparator(SourceFile file, 
        ExpressionListContext context, int index) {
    ParseTree item = null;

    // Remove separator after argument.
    if (index == 0 && context.getChildCount() >= index + 1) {
        item = context.getChild(index + 1);
    } else if (context.getChildCount() >= index - 1) {
        item = context.getChild(index - 1);
    }

    if (item instanceof TerminalNodeImpl && 
            item.getText().equals(",")) {
        file.getRewriter().delete(((TerminalNodeImpl)item).getPayload());
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号