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

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


    nullityMismatchIsNull(expression, requiredType, annotationName);
    return;
  }
  if ((nullStatus & FlowInfo.POTENTIALLY_NULL) != 0) {
    if (expression instanceof SingleNameReference) {
      SingleNameReference snr = (SingleNameReference) expression;
      if (snr.binding instanceof LocalVariableBinding) {
        if (((LocalVariableBinding)snr.binding).isNullable()) {
          nullityMismatchSpecdNullable(expression, requiredType, annotationName);
          return;
        }
View Full Code Here


    ref.modifiers = this.modifiers;
    return ref;
  }

  protected SingleNameReference newSingleNameReference(char[] source, long positions) {
    SingleNameReference ref = this.singleNameReference;
    ref.token = source;
    ref.sourceStart = (int) (positions >>> 32);
    ref.sourceEnd = (int) positions;
    return ref;
  }
View Full Code Here

public void invalidField(NameReference nameRef, FieldBinding field) {
  if (nameRef instanceof QualifiedNameReference) {
    QualifiedNameReference ref = (QualifiedNameReference) nameRef;
    if (isRecoveredName(ref.tokens)) return;
  } else {
    SingleNameReference ref = (SingleNameReference) nameRef;
    if (isRecoveredName(ref.token)) return;
  }
  int id = IProblem.UndefinedField;
  switch (field.problemId()) {
    case ProblemReasons.NotFound :
View Full Code Here

    QualifiedNameReference ref = (QualifiedNameReference) nameRef;
    if (isRecoveredName(ref.tokens)) return;
    if (ref.indexOfFirstFieldBinding >= 1)
      end = (int) ref.sourcePositions[ref.indexOfFirstFieldBinding - 1];
  } else {
    SingleNameReference ref = (SingleNameReference) nameRef;
    if (isRecoveredName(ref.token)) return;
    int numberOfParens = (ref.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
    if (numberOfParens != 0) {
      sourceStart = retrieveStartingPositionAfterOpeningParenthesis(sourceStart, end, numberOfParens);
      end = retrieveEndingPositionAfterOpeningParenthesis(sourceStart, end, numberOfParens);
View Full Code Here

  int length;
  NameReference ref;
  if ((length = this.identifierLengthStack[this.identifierLengthPtr--]) == 1)
    // single variable reference
    ref =
      new SingleNameReference(
        this.identifierStack[this.identifierPtr],
        this.identifierPositionStack[this.identifierPtr--]);
  else
    //Qualified variable reference
    {
View Full Code Here

  int length;
  NameReference ref;
  if ((length = this.identifierLengthStack[this.identifierLengthPtr--]) == 1) {
    // single variable reference
    ref =
      new SingleNameReference(
        this.identifierStack[this.identifierPtr],
        this.identifierPositionStack[this.identifierPtr--]);
    ref.bits &= ~ASTNode.RestrictiveFlagMASK;
    ref.bits |= Binding.LOCAL | Binding.FIELD;
    return ref;
View Full Code Here

        long pos = parser.identifierPositionStack[this.identifierPtr + 1];
        int start = (int) (pos >>> 32);
        int end = (int)pos;
        int valueEnd = this.memberValuPairEqualEnd > -1 ? this.memberValuPairEqualEnd : end;

        SingleNameReference fakeExpression = new SingleNameReference(RecoveryScanner.FAKE_IDENTIFIER, (((long) valueEnd + 1) << 32) + (valueEnd));
        pendingMemberValueName = new MemberValuePair(memberValueName, start, end, fakeExpression);
      }
      parser.identifierPtr = this.identifierPtr;
      parser.identifierLengthPtr = this.identifierLengthPtr;
      TypeReference typeReference = parser.getAnnotationType();
View Full Code Here

    if (!this.diet || this.dietInt != 0){
      this.restartRecovery  = true// force to restart in recovery mode
      this.lastIgnoredToken = -1;
    }
    this.isOrphanCompletionNode = true;
    return new SingleNameReference(CharOperation.NO_CHAR, 0); // dummy reference
  }
  NameReference nameReference;
  /* retrieve identifiers subset and whole positions, the completion node positions
    should include the entire replaced source. */
  char[][] subset = identifierSubSet(completionIndex);
View Full Code Here

public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
  // optimizing assignment like: i = i + 1 or i = 1 + i
  if (assignment.expression.isCompactableOperation()) {
    BinaryExpression operation = (BinaryExpression) assignment.expression;
    int operator = (operation.bits & OperatorMASK) >> OperatorSHIFT;
    SingleNameReference variableReference;
    if ((operation.left instanceof SingleNameReference) && ((variableReference = (SingleNameReference) operation.left).binding == this.binding)) {
      // i = i + value, then use the variable on the right hand side, since it has the correct implicit conversion
      variableReference.generateCompoundAssignment(currentScope, codeStream, this.syntheticAccessors == null ? null : this.syntheticAccessors[WRITE], operation.right, operator, operation.implicitConversion, valueRequired);
      if (valueRequired) {
        codeStream.generateImplicitConversion(assignment.implicitConversion);
      }
      return;
    }
    if ((operation.right instanceof SingleNameReference)
        && ((operator == PLUS) || (operator == MULTIPLY)) // only commutative operations
        && ((variableReference = (SingleNameReference) operation.right).binding == this.binding)
        && (operation.left.constant != Constant.NotAConstant) // exclude non constant expressions, since could have side-effect
        && (((operation.left.implicitConversion & IMPLICIT_CONVERSION_MASK) >> 4) != T_JavaLangString) // exclude string concatenation which would occur backwards
        && (((operation.right.implicitConversion & IMPLICIT_CONVERSION_MASK) >> 4) != T_JavaLangString)) { // exclude string concatenation which would occur backwards
      // i = value + i, then use the variable on the right hand side, since it has the correct implicit conversion
      variableReference.generateCompoundAssignment(currentScope, codeStream, this.syntheticAccessors == null ? null : this.syntheticAccessors[WRITE], operation.left, operator, operation.implicitConversion, valueRequired);
      if (valueRequired) {
        codeStream.generateImplicitConversion(assignment.implicitConversion);
      }
      return;
    }
View Full Code Here

TOP

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

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.