Package org.eclipse.jdt.internal.compiler.ast

Examples of org.eclipse.jdt.internal.compiler.ast.LambdaExpression


  statementStart = statement.sourceStart;
  statementEnd = statement instanceof AbstractVariableDeclaration ? ((AbstractVariableDeclaration)statement).declarationSourceEnd : statement.sourceEnd;
  for (int i = this.elementPtr; i >= 0; --i) {
    if (this.elementKindStack[i] != K_LAMBDA_EXPRESSION_DELIMITER)
      continue;
    LambdaExpression expression = (LambdaExpression) this.elementObjectInfoStack[i];
    if (expression.sourceStart >= statementStart && expression.sourceEnd <= statementEnd) {
      this.elementPtr = i - 1;
      lambdaClosed = true;
    } else {
      if (shouldCommit) {
View Full Code Here


  pushOnElementStack(K_TYPE_DELIMITER);
}
@Override
protected void consumeNestedLambda() {
  super.consumeNestedLambda();
  LambdaExpression lexp = (LambdaExpression) this.astStack[this.astPtr];
  pushOnElementStack(K_LAMBDA_EXPRESSION_DELIMITER, EXPRESSION_BODY, lexp);
}
View Full Code Here

        }
        break;
      case Scope.METHOD_SCOPE :
        if (scope.isLambdaScope()) {
          parentElement = createElement(scope.parent, elementPosition, unit, existingElements, knownScopes);
          LambdaExpression expression = (LambdaExpression) scope.originalReferenceContext();
          if (expression.resolvedType != null && expression.resolvedType.isValidBinding() &&
              !(expression.descriptor instanceof ProblemMethodBinding)) { // chain in lambda element only if resolved properly.
            //newElement = new org.eclipse.jdt.internal.core.SourceLambdaExpression((JavaElement) parentElement, expression).getMethod();
            newElement = LambdaFactory.createLambdaExpression((JavaElement) parentElement, expression).getMethod();
            knownScopes.put(scope, newElement);
View Full Code Here

    try {
      if (DEBUG) System.out.println(new String(this.cud.compilationResult.fileName) + ':');
      for (int i = 0, length = this.cud.functionalExpressionsCount; i < length; i++) {
        FunctionalExpression expression = this.cud.functionalExpressions[i];
        if (expression instanceof LambdaExpression) {
          LambdaExpression lambdaExpression = (LambdaExpression) expression;
          if (lambdaExpression.binding != null && lambdaExpression.binding.isValidBinding()) {
            final char[] superinterface = lambdaExpression.resolvedType.sourceName();
            if (DEBUG) {
              System.out.println('\t' + new String(superinterface) + '.' +
                  new String(lambdaExpression.descriptor.selector) + "-> {}"); //$NON-NLS-1$
View Full Code Here

    if (n == 0)
      return TRUE;
   
    TypeBinding[] ePrime = null;
    if (this.left instanceof LambdaExpression) {
      LambdaExpression lambda = ((LambdaExpression) this.left).getResolvedCopyForInferenceTargeting(this.right);
      if (lambda == null)
        return TRUE; // cannot make use of this buggy constraint
      Set<TypeBinding> ePrimeSet = lambda.getThrownExceptions();
      ePrime = ePrimeSet.toArray(new TypeBinding[ePrimeSet.size()]);
    } else {
      ReferenceExpression referenceExpression = (ReferenceExpression)this.left;
      MethodBinding method = referenceExpression.findCompileTimeMethodTargeting(this.right, scope);
      if (method != null)
View Full Code Here

    if (this.left instanceof LambdaExpression) {
      if (this.right instanceof InferenceVariable) {
        return Collections.singletonList((InferenceVariable)this.right);
      }
      if (this.right.isFunctionalInterface(context.scope)) {
        LambdaExpression lambda = (LambdaExpression) this.left;
        MethodBinding sam = this.right.getSingleAbstractMethod(context.scope, true); // TODO derive with target type?
        final Set<InferenceVariable> variables = new HashSet<InferenceVariable>();
        if (lambda.argumentsTypeElided()) {
          // i)
          int len = sam.parameters.length;
          for (int i = 0; i < len; i++) {
            sam.parameters[i].collectInferenceVariables(variables);
          }
View Full Code Here

}
protected void consumeNestedLambda() {
  // NestedLambda ::= $empty - we get here just after the type+parenthesis elided singleton parameter or just before the '(' of the parameter list.
  consumeNestedType();
  this.nestedMethod[this.nestedType] ++;
  LambdaExpression lambda = new LambdaExpression(this.compilationUnit.compilationResult, isAssistParser());
  pushOnAstStack(lambda);
  this.processingLambdaParameterList = true
}
View Full Code Here

      problemReporter().illegalThis(argument);
    }
    if (argument.name.length == 1 && argument.name[0] == '_')
      problemReporter().illegalUseOfUnderscoreAsAnIdentifier(argument.sourceStart, argument.sourceEnd, true); // true == lambdaParameter
  }
  LambdaExpression lexp = (LambdaExpression) this.astStack[this.astPtr];
  lexp.setArguments(arguments);
  lexp.setArrowPosition(arrowPosition);
  lexp.sourceEnd = this.intStack[this.intPtr--];   // ')' position or identifier position.
  lexp.sourceStart = this.intStack[this.intPtr--]; // '(' position or identifier position.
  lexp.hasParentheses = (this.scanner.getSource()[lexp.sourceStart] == '(');
  this.listLength -= arguments == null ? 0 : arguments.length;  // not necessary really.
  this.processingLambdaParameterList = false;
View Full Code Here

      body = new Block(0);
    }
    ((Block) body).lambdaBody = true; // for consistency's sakes.
  }

  LambdaExpression lexp = (LambdaExpression) this.astStack[this.astPtr--];
  this.astLengthPtr--;
  lexp.setBody(body);
  lexp.sourceEnd = body.sourceEnd;
 
  if (body instanceof Expression) {
    Expression expression = (Expression) body;
    expression.statementEnd = body.sourceEnd;
View Full Code Here

  }
}
@Override
protected void consumeLambdaExpression() {
  super.consumeLambdaExpression();
  LambdaExpression expression = (LambdaExpression) this.expressionStack[this.expressionPtr];
  int arrowEnd = expression.arrowPosition();
  int arrowStart = arrowEnd - 1;
  if (this.selectionStart == arrowStart || this.selectionStart == arrowEnd) {
    if (this.selectionEnd == arrowStart || this.selectionEnd == arrowEnd) {
      this.expressionStack[this.expressionPtr] = new SelectionOnLambdaExpression(expression);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ast.LambdaExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.