Pass3Listener.java 文件源码

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

项目:trygve 作者:
private <ExprType> Declaration findProperMethodScopeAround(final ExprType ctxExpr, final RuleContext ctxParent, final Token ctxGetStart) {
    Declaration retval = null;
    RuleContext executionContext = ctxParent;
    while ((executionContext instanceof ProgramContext) == false) {
        if (executionContext instanceof Method_declContext) {
            final Method_declContext mdeclContext = (Method_declContext)executionContext;
            final Method_decl_hookContext hookContext = mdeclContext.method_decl_hook();
            final Method_signatureContext signatureCtx = hookContext.method_signature();
            final String methodName = signatureCtx.method_name().getText();
            final MethodDeclaration methodDecl = currentScope_.lookupMethodDeclarationRecursive(methodName, null, true);
            retval = methodDecl;
            break;
        } else if (executionContext instanceof Role_bodyContext) {
            break;
        } else if (executionContext instanceof Role_declContext) {
            break;
        } else if (executionContext instanceof Class_bodyContext) {
            break;
        } else if (executionContext instanceof Type_declarationContext) {
            break;
        }
        executionContext = executionContext.parent;
    }
    return retval;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号