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

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


  // 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


        printTypeReference(((ClassLiteralAccess) e).type);
        return output.append(".class");
      } else if (e instanceof StringLiteral) {
        return printStringLiteral((StringLiteral) e);
      } else if (e instanceof SingleNameReference) {
        SingleNameReference snr = (SingleNameReference) e;
        if (snr.binding instanceof ReferenceBinding) {
          output.append(CharOperation.concatWith(((ReferenceBinding) snr.binding).compoundName, '.'));
        } else if (snr.binding instanceof ParameterizedFieldBinding) {
          ParameterizedFieldBinding pfb = (ParameterizedFieldBinding) snr.binding;
          output.append(pfb.name);
View Full Code Here

        FieldBinding fieldBinding = null;
        if (defaultValue instanceof QualifiedNameReference) {
          QualifiedNameReference nameReference = (QualifiedNameReference) defaultValue;
          fieldBinding = (FieldBinding) nameReference.binding;
        } else if (defaultValue instanceof SingleNameReference) {
          SingleNameReference nameReference = (SingleNameReference) defaultValue;
          fieldBinding = (FieldBinding) nameReference.binding;
        } else {
          contentsOffset = attributeOffset;
        }
        if (fieldBinding != null) {
View Full Code Here

        FieldBinding fieldBinding = null;
        if (defaultValue instanceof QualifiedNameReference) {
          QualifiedNameReference nameReference = (QualifiedNameReference) defaultValue;
          fieldBinding = (FieldBinding) nameReference.binding;
        } else if (defaultValue instanceof SingleNameReference) {
          SingleNameReference nameReference = (SingleNameReference) defaultValue;
          fieldBinding = (FieldBinding) nameReference.binding;
        } else {
          throw new MissingImplementationException(
              "Please raise an AspectJ bug.  AspectJ does not know how to convert this annotation value ["
                  + defaultValue + "]");
View Full Code Here

        FieldBinding fieldBinding = null;
        if (defaultValue instanceof QualifiedNameReference) {
          QualifiedNameReference nameReference = (QualifiedNameReference) defaultValue;
          fieldBinding = (FieldBinding) nameReference.binding;
        } else if (defaultValue instanceof SingleNameReference) {
          SingleNameReference nameReference = (SingleNameReference) defaultValue;
          fieldBinding = (FieldBinding) nameReference.binding;
        } else {
          throw new MissingImplementationException(
              "Please raise an AspectJ bug.  AspectJ does not know how to convert this annotation value ["
                  + defaultValue + "]");
View Full Code Here

      LocalVariableBinding localVariable = (LocalVariableBinding)singleNameReference.binding;
      if (localVariable != null) {
        return this.getTypeBinding(localVariable.type);
      }
    } if (node instanceof SingleNameReference) {
      SingleNameReference singleNameReference = (SingleNameReference) node;
      return this.getTypeBinding(singleNameReference.resolvedType);
    } else if (node instanceof QualifiedSuperReference) {
      QualifiedSuperReference qualifiedSuperReference = (QualifiedSuperReference) node;
      return this.getTypeBinding(qualifiedSuperReference.qualification.resolvedType);
    } else if (node instanceof LocalDeclaration) {
View Full Code Here

      ITypeBinding typeBinding = this.getTypeBinding(typeDeclaration.binding);
      if (typeBinding != null) {
        return typeBinding;
      }
    } if (node instanceof SingleNameReference) {
      SingleNameReference singleNameReference = (SingleNameReference) node;
      if (singleNameReference.isTypeReference()) {
        return this.getTypeBinding(singleNameReference.resolvedType);
      } else {
        // this is a variable or a field
        Binding binding = singleNameReference.binding;
        if (binding != null) {
View Full Code Here

    ref.modifiers = 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 static void setStatements(MethodDeclaration ret, List statements) {
    ret.statements = (Statement[]) statements.toArray(new Statement[statements.size()]);
  }

  public static SingleNameReference makeLocalVariableReference(LocalVariableBinding binding) {
    SingleNameReference ret = new SingleNameReference(binding.name, 0);
    ret.binding = binding;
    ret.codegenBinding = binding;
    ret.constant = Constant.NotAConstant;
    ret.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits
    ret.bits |= Binding.VARIABLE;
View Full Code Here

    ret.bits |= Binding.VARIABLE;
    return ret;
  }

  public static SingleNameReference makeResolvedLocalVariableReference(LocalVariableBinding binding) {
    SingleNameReference ret = new SingleNameReference(binding.name, 0);
    ret.binding = binding;
    ret.codegenBinding = binding;
    ret.constant = Constant.NotAConstant;
    ret.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits
    ret.bits |= Binding.LOCAL;
View Full Code Here

TOP

Related Classes of org.aspectj.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.