Class LambdaExpr

    • Constructor Detail

      • LambdaExpr

        public LambdaExpr()
      • LambdaExpr

        public LambdaExpr​(Parameter parameter,
                          BlockStmt body)
        Creates a single parameter lambda expression.
      • LambdaExpr

        public LambdaExpr​(NodeList<Parameter> parameters,
                          BlockStmt body)
        Creates a zero or multi-parameter lambda expression with its parameters wrapped in ( ).
      • LambdaExpr

        public LambdaExpr​(Parameter parameter,
                          Expression body)
        Creates a single parameter lambda expression.
      • LambdaExpr

        public LambdaExpr​(NodeList<Parameter> parameters,
                          Expression body)
        Creates a zero or multi-parameter lambda expression with its parameters wrapped in ( ).
      • LambdaExpr

        public LambdaExpr​(TokenRange tokenRange,
                          NodeList<Parameter> parameters,
                          Statement body,
                          boolean isEnclosingParameters)
        This constructor is used by the parser and is considered private.
    • Method Detail

      • getBody

        public Statement getBody()
        Returns:
        a BlockStatement or an ExpressionStatement. See class Javadoc.
      • accept

        public <R,​A> R accept​(GenericVisitor<R,​A> v,
                                    A arg)
        Description copied from interface: Visitable
        Accept method for visitor support.
        Specified by:
        accept in interface Visitable
        Type Parameters:
        R - the type of the return value of the visitor
        A - the type the user argument passed to the visitor
        Parameters:
        v - the visitor implementation
        arg - the argument passed to the visitor (of type A)
        Returns:
        the result of the visit (of type R)
      • accept

        public <A> void accept​(VoidVisitor<A> v,
                               A arg)
        Description copied from interface: Visitable
        Accept method for visitor support.
        Specified by:
        accept in interface Visitable
        Type Parameters:
        A - the type the argument passed for the visitor
        Parameters:
        v - the visitor implementation
        arg - any value relevant for the visitor (of type A)
      • isEnclosingParameters

        public boolean isEnclosingParameters()
      • setEnclosingParameters

        public LambdaExpr setEnclosingParameters​(boolean isEnclosingParameters)
      • remove

        public boolean remove​(Node node)
        Overrides:
        remove in class Node
      • getExpressionBody

        public Optional<Expression> getExpressionBody()
        Returns:
        if the body of this lambda is a simple expression, return that expression. Otherwise (when the body is a block) return Optional.empty().
      • replace

        public boolean replace​(Node node,
                               Node replacementNode)
        Overrides:
        replace in class Node
      • isPolyExpression

        public boolean isPolyExpression()
        Description copied from class: Expression
        See https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.2
        Overrides:
        isPolyExpression in class Expression
        Returns:
        true if the expression is a poly expression
      • isExplicitlyTyped

        public boolean isExplicitlyTyped()