软件包  jdk.nashorn.api.tree

Interface TreeVisitor<R,​P>

  • 参数类型
    R - 此访问者方法的返回类型。 对于不需要返回结果的访问者,请使用Void
    P - 此访问者方法的附加参数的类型。 对于不需要其他参数的访问者,请使用Void
    所有已知实现类:
    SimpleTreeVisitorES5_1SimpleTreeVisitorES6

    @Deprecated(since="11",
                forRemoval=true)
    public interface TreeVisitor<R,​P>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Nashorn JavaScript script engine and APIs, and the jjs tool are deprecated with the intent to remove them in a future release.
    树木的访客,以访客设计模式的风格。 当编译时树的类型未知时,实现此接口的类用于在树上操作。 当访问者传递给树的accept方法时,将调用最适用于该树的visitXyz方法。

    实现此界面的类可以或可以不抛出NullPointerException如果附加参数pnull ; 有关详细信息,请参阅实现类的文档。

    警告:可能会将方法添加到此接口,以适应未来版本的ECMAScript编程语言中添加的新的,当前未知的语言结构。 当为新的Tree子类型添加新的访问方法时,将引入默认方法体,它将调用visitUnknown方法作为后备。

    从以下版本开始:
    9
    • 方法详细信息

      • visitAssignment

        R visitAssignment​(AssignmentTree node,
                          P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问分配树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitCompoundAssignment

        R visitCompoundAssignment​(CompoundAssignmentTree node,
                                  P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问复合赋值树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitBinary

        R visitBinary​(BinaryTree node,
                      P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问二进制表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitBlock

        R visitBlock​(BlockTree node,
                     P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问块语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitBreak

        R visitBreak​(BreakTree node,
                     P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问break语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitCase

        R visitCase​(CaseTree node,
                    P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问案例陈述树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitCatch

        R visitCatch​(CatchTree node,
                     P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问catch block语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitClassDeclaration

        R visitClassDeclaration​(ClassDeclarationTree node,
                                P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问类语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitClassExpression

        R visitClassExpression​(ClassExpressionTree node,
                               P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问类表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitConditionalExpression

        R visitConditionalExpression​(ConditionalExpressionTree node,
                                     P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问条件表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitContinue

        R visitContinue​(ContinueTree node,
                        P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问continue语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitDebugger

        R visitDebugger​(DebuggerTree node,
                        P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问调试器语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitDoWhileLoop

        R visitDoWhileLoop​(DoWhileLoopTree node,
                           P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问do-while语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitErroneous

        R visitErroneous​(ErroneousTree node,
                         P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问错误表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitExpressionStatement

        R visitExpressionStatement​(ExpressionStatementTree node,
                                   P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问表达式语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitForLoop

        R visitForLoop​(ForLoopTree node,
                       P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问'for'语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitForInLoop

        R visitForInLoop​(ForInLoopTree node,
                         P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问for..in语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitForOfLoop

        R visitForOfLoop​(ForOfLoopTree node,
                         P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问for语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitFunctionCall

        R visitFunctionCall​(FunctionCallTree node,
                            P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问函数调用表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitFunctionDeclaration

        R visitFunctionDeclaration​(FunctionDeclarationTree node,
                                   P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问函数声明树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitFunctionExpression

        R visitFunctionExpression​(FunctionExpressionTree node,
                                  P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问函数表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitIdentifier

        R visitIdentifier​(IdentifierTree node,
                          P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问标识符树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitIf

        R visitIf​(IfTree node,
                  P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问'if'语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitArrayAccess

        R visitArrayAccess​(ArrayAccessTree node,
                           P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问数组访问表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitArrayLiteral

        R visitArrayLiteral​(ArrayLiteralTree node,
                            P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问数组文字表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitLabeledStatement

        R visitLabeledStatement​(LabeledStatementTree node,
                                P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问带标签的语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitLiteral

        R visitLiteral​(LiteralTree node,
                       P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问文字表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitParenthesized

        R visitParenthesized​(ParenthesizedTree node,
                             P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问带括号的表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitReturn

        R visitReturn​(ReturnTree node,
                      P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问return语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitMemberSelect

        R visitMemberSelect​(MemberSelectTree node,
                            P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问成员选择表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitNew

        R visitNew​(NewTree node,
                   P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问“新”表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitObjectLiteral

        R visitObjectLiteral​(ObjectLiteralTree node,
                             P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问对象文字树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitProperty

        R visitProperty​(PropertyTree node,
                        P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问对象文字表达式树的属性。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitRegExpLiteral

        R visitRegExpLiteral​(RegExpLiteralTree node,
                             P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问正则表达式文字树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitTemplateLiteral

        R visitTemplateLiteral​(TemplateLiteralTree node,
                               P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问模板文字树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitEmptyStatement

        R visitEmptyStatement​(EmptyStatementTree node,
                              P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问一个空的语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitSpread

        R visitSpread​(SpreadTree node,
                      P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问'spread'表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitSwitch

        R visitSwitch​(SwitchTree node,
                      P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问“switch”语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitThrow

        R visitThrow​(ThrowTree node,
                     P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问'throw'表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitCompilationUnit

        R visitCompilationUnit​(CompilationUnitTree node,
                               P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问编译单元树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitModule

        R visitModule​(ModuleTree node,
                      P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问模块树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitExportEntry

        R visitExportEntry​(ExportEntryTree node,
                           P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问Module ExportEntry树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitImportEntry

        R visitImportEntry​(ImportEntryTree node,
                           P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问Module ImportEntry树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitTry

        R visitTry​(TryTree node,
                   P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问'try'语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitInstanceOf

        R visitInstanceOf​(InstanceOfTree node,
                          P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问'instanceof'表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitUnary

        R visitUnary​(UnaryTree node,
                     P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问一元表达树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitVariable

        R visitVariable​(VariableTree node,
                        P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问变量声明树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitWhileLoop

        R visitWhileLoop​(WhileLoopTree node,
                         P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问'while'语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitWith

        R visitWith​(WithTree node,
                    P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问'with'语句树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitYield

        R visitYield​(YieldTree node,
                     P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问'yield'表达式树。
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值
      • visitUnknown

        R visitUnknown​( node,
                       P p)
        Deprecated, for removal: This API element is subject to removal in a future version.
        访问未知表达式/语句树。 如果将来引入新的Tree子类型,将调用此回退。 如果访问者实现的是旧语言版本,则特定实现可能会抛出{ unknown tree exception
        参数
        node - 正在访问的节点
        p - 传递给访问者的额外参数
        结果
        来自访客的价值