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

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


        return true;
      }
      return reduceAndIncorporate(ConstraintTypeFormula.create(r1, r2, ReductionResult.SUBTYPE));
    } else if (expri instanceof ReferenceExpression && ((ReferenceExpression)expri).isExactMethodReference()) {
      for (int i = 0; i < u.length; i++) {
        ReferenceExpression reference = (ReferenceExpression) expri;
        if (!reduceAndIncorporate(ConstraintTypeFormula.create(u[i], v[i], ReductionResult.SAME)))
          return false;
        if (r2.id == TypeIds.T_void)
          return true;
        MethodBinding method = reference.findCompileTimeMethodTargeting(null, this.scope); // TODO directly access exactMethodBinding!
        TypeBinding returnType = method.isConstructor() ? method.declaringClass : method.returnType;
        if (r1.isPrimitiveType() && !r2.isPrimitiveType() && returnType.isPrimitiveType())
          return true;
        if (r2.isPrimitiveType() && !r1.isPrimitiveType() && !returnType.isPrimitiveType())
          return true;
View Full Code Here


          } else {
            if (DEBUG) System.out.println("\tnull/bad binding in lambda"); //$NON-NLS-1$
          }
        } else {
          ReferenceExpression referenceExpression = (ReferenceExpression) expression;
          if (referenceExpression.isArrayConstructorReference())
            continue;
          MethodBinding binding = referenceExpression.getMethodBinding();
          if (binding != null && binding.isValidBinding()) {
            if (DEBUG) {
              System.out.println('\t' + new String(referenceExpression.resolvedType.sourceName()) + "::"  //$NON-NLS-1$
                  + new String(referenceExpression.descriptor.selector) + " == " + new String(binding.declaringClass.sourceName()) + '.' + //$NON-NLS-1$
                  new String(binding.selector));
            }
            if (referenceExpression.isMethodReference())
              SourceIndexer.this.addMethodReference(binding.selector, binding.parameters.length);
            else
              SourceIndexer.this.addConstructorReference(binding.declaringClass.sourceName(), binding.parameters.length);
          } else {
            if (DEBUG) System.out.println("\tnull/bad binding in reference expression"); //$NON-NLS-1$
View Full Code Here

      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)
        ePrime = method.thrownExceptions;
    }
    if (ePrime == null)
      return TRUE;
View Full Code Here

  // NonWildTypeArgumentsopt ::= $empty
  pushOnGenericsLengthStack(0); // signal absence of type arguments.
}

public ReferenceExpression newReferenceExpression() {
  return new ReferenceExpression();
}
View Full Code Here

protected void consumeReferenceExpressionTypeForm(boolean isPrimitive) { // actually Name or Type form.
 
  // ReferenceExpression ::= PrimitiveType Dims '::' NonWildTypeArgumentsopt IdentifierOrNew
  // ReferenceExpression ::= Name Dimsopt '::' NonWildTypeArgumentsopt IdentifierOrNew

  ReferenceExpression referenceExpression = newReferenceExpression();
  TypeReference [] typeArguments = null;
  char [] selector;
  int sourceEnd;

  sourceEnd = (int) this.identifierPositionStack[this.identifierPtr];
  referenceExpression.nameSourceStart = (int) (this.identifierPositionStack[this.identifierPtr] >>> 32);
  selector = this.identifierStack[this.identifierPtr--];
  this.identifierLengthPtr--;
 
  int length = this.genericsLengthStack[this.genericsLengthPtr--];
  if (length > 0) {
    this.genericsPtr -= length;
    System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeArguments = new TypeReference[length], 0, length);
    this.intPtr--;  // pop type arguments source start.
  }
 
  int dimension = this.intStack[this.intPtr--];
  boolean typeAnnotatedName = false;
  for (int i = this.identifierLengthStack[this.identifierLengthPtr], j = 0; i > 0 && this.typeAnnotationLengthPtr >= 0; --i, j++) {
    length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr - j];
    if (length != 0) {
      typeAnnotatedName = true;
      break;
    }
  }
 
  if (dimension > 0 || typeAnnotatedName) {
    if (!isPrimitive) {
      pushOnGenericsLengthStack(0);
      pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
    }
    referenceExpression.initialize(this.compilationUnit.compilationResult, getTypeReference(dimension), typeArguments, selector, sourceEnd);
  } else {
    referenceExpression.initialize(this.compilationUnit.compilationResult, getUnspecifiedReference(), typeArguments, selector, sourceEnd);
  }
  consumeReferenceExpression(referenceExpression);
}
View Full Code Here

  consumeReferenceExpression(referenceExpression);
}
protected void consumeReferenceExpressionPrimaryForm() {
  // ReferenceExpression ::= Primary '::' NonWildTypeArgumentsopt Identifier

  ReferenceExpression referenceExpression = newReferenceExpression();
  TypeReference [] typeArguments = null;
  char [] selector;
  int sourceEnd;

  sourceEnd = (int) this.identifierPositionStack[this.identifierPtr];
  referenceExpression.nameSourceStart = (int) (this.identifierPositionStack[this.identifierPtr] >>> 32);
  selector = this.identifierStack[this.identifierPtr--];
  this.identifierLengthPtr--;

  int length = this.genericsLengthStack[this.genericsLengthPtr--];
  if (length > 0) {
    this.genericsPtr -= length;
    System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeArguments = new TypeReference[length], 0, length);
    this.intPtr--;  // pop type arguments source start.
  }
 
  Expression primary = this.expressionStack[this.expressionPtr--];
  this.expressionLengthPtr--;
  referenceExpression.initialize(this.compilationUnit.compilationResult, primary, typeArguments, selector, sourceEnd);
  consumeReferenceExpression(referenceExpression);
}
View Full Code Here

  consumeReferenceExpression(referenceExpression);
}
protected void consumeReferenceExpressionSuperForm() {
  // ReferenceExpression ::= 'super' '::' NonWildTypeArgumentsopt Identifier

  ReferenceExpression referenceExpression = newReferenceExpression();
  TypeReference [] typeArguments = null;
  char [] selector;
  int sourceEnd;

  sourceEnd = (int) this.identifierPositionStack[this.identifierPtr];
  referenceExpression.nameSourceStart = (int) (this.identifierPositionStack[this.identifierPtr] >>> 32);
  selector = this.identifierStack[this.identifierPtr--];
  this.identifierLengthPtr--;

  int length = this.genericsLengthStack[this.genericsLengthPtr--];
  if (length > 0) {
    this.genericsPtr -= length;
    System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeArguments = new TypeReference[length], 0, length);
    this.intPtr--;  // pop type arguments source start.
  }
 
  SuperReference superReference = new SuperReference(this.intStack[this.intPtr--], this.endPosition);
  referenceExpression.initialize(this.compilationUnit.compilationResult, superReference, typeArguments, selector, sourceEnd);
  consumeReferenceExpression(referenceExpression);
}
View Full Code Here

}
protected void consumeReferenceExpressionGenericTypeForm() {

  // ReferenceExpression ::= Name BeginTypeArguments ReferenceExpressionTypeArgumentsAndTrunk '::' NonWildTypeArgumentsopt IdentifierOrNew
 
  ReferenceExpression referenceExpression = newReferenceExpression();
  TypeReference type;
  TypeReference [] typeArguments = null;
  char [] selector;
  int sourceEnd;

  sourceEnd = (int) this.identifierPositionStack[this.identifierPtr];
  referenceExpression.nameSourceStart = (int) (this.identifierPositionStack[this.identifierPtr] >>> 32);
  selector = this.identifierStack[this.identifierPtr--];
  this.identifierLengthPtr--;

  int length = this.genericsLengthStack[this.genericsLengthPtr--];
  if (length > 0) {
    this.genericsPtr -= length;
    System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeArguments = new TypeReference[length], 0, length);
    this.intPtr--;  // pop type arguments source start.
  }
 
  int typeSourceEnd = this.intStack[this.intPtr--];
  boolean qualified = this.intStack[this.intPtr--] != 0;
  int dims = this.intStack[this.intPtr--];
  if (qualified) {
    Annotation [][] annotationsOnDimensions = dims == 0 ? null : getAnnotationsOnDimensions(dims);
    TypeReference rightSide = getTypeReference(0);
    type = computeQualifiedGenericsFromRightSide(rightSide, dims, annotationsOnDimensions);
  } else {   
    pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
    type = getTypeReference(dims);
  }
  this.intPtr--; // pop '<' position
  type.sourceEnd = typeSourceEnd;
 
  referenceExpression.initialize(this.compilationUnit.compilationResult, type, typeArguments, selector, sourceEnd);

  consumeReferenceExpression(referenceExpression);
}
View Full Code Here

public ReferenceExpression newReferenceExpression() {
  char[] selector = this.identifierStack[this.identifierPtr];
  if (selector != assistIdentifier()){
    return super.newReferenceExpression();
  }
  ReferenceExpression referenceExpression = new SelectionOnReferenceExpressionName();
  this.assistNode = referenceExpression;
  return referenceExpression;
}
View Full Code Here

TOP

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

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.