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

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


      this.preferences.insert_space_after_opening_paren_in_enum_constant,
      this.preferences.insert_space_before_comma_in_enum_constant_arguments,
      this.preferences.insert_space_after_comma_in_enum_constant_arguments,
      this.preferences.alignment_for_arguments_in_enum_constant);     
   
    Expression initialization = enumConstant.initialization;
    if (initialization instanceof QualifiedAllocationExpression) {
      TypeDeclaration typeDeclaration = ((QualifiedAllocationExpression) initialization).anonymousType;
      int fieldsCount = typeDeclaration.fields == null ? 0 : typeDeclaration.fields.length;
      int methodsCount = typeDeclaration.methods == null ? 0 : typeDeclaration.methods.length;
      int membersCount = typeDeclaration.memberTypes == null ? 0 : typeDeclaration.memberTypes.length;
View Full Code Here


    BlockScope scope) {

    if (explicitConstructor.isImplicitSuper()) {
      return false;
    }
    final Expression qualification = explicitConstructor.qualification;
    if (qualification != null) {
      qualification.traverse(this, scope);
      this.scribe.printNextToken(TerminalTokens.TokenNameDOT);
    }

    TypeReference[] typeArguments = explicitConstructor.typeArguments;
    if (typeArguments != null) {
View Full Code Here

          }       
        }
      }
    }
    this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon_in_for);
    final Expression condition = forStatement.condition;
    if (condition != null) {
      if (this.preferences.insert_space_after_semicolon_in_for) {
        this.scribe.space();
      }
      condition.traverse(this, scope);
    }
    this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon_in_for);
    final Statement[] increments = forStatement.increments;
    if (increments != null) {
      if (this.preferences.insert_space_after_semicolon_in_for) {
View Full Code Here

     
    final int numberOfParens = (qualifiedAllocationExpression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
    if (numberOfParens > 0) {
      manageOpeningParenthesizedExpression(qualifiedAllocationExpression, numberOfParens);
    }
    final Expression enclosingInstance = qualifiedAllocationExpression.enclosingInstance;
    if (enclosingInstance != null) {
      enclosingInstance.traverse(this, scope);
      this.scribe.printNextToken(TerminalTokens.TokenNameDOT);
    }
   
    this.scribe.printNextToken(TerminalTokens.TokenNamenew);
    // used for the new line on wrap style of formatting
View Full Code Here

   * @see org.aspectj.org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.aspectj.org.eclipse.jdt.internal.compiler.ast.ReturnStatement, org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BlockScope)
   */
  public boolean visit(ReturnStatement returnStatement, BlockScope scope) {
   
    this.scribe.printNextToken(TerminalTokens.TokenNamereturn);
    final Expression expression = returnStatement.expression;
    if (expression != null) {
      final int numberOfParens = (expression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
      if ((numberOfParens != 0 && this.preferences.insert_space_before_parenthesized_expression_in_return)
          || numberOfParens == 0) {
        this.scribe.space();
      }
      expression.traverse(this, scope);
    }
    /*
     * Print the semi-colon
     */ 
    this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
View Full Code Here

   * @see org.aspectj.org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.aspectj.org.eclipse.jdt.internal.compiler.ast.ThrowStatement, org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BlockScope)
   */
  public boolean visit(ThrowStatement throwStatement, BlockScope scope) {

    this.scribe.printNextToken(TerminalTokens.TokenNamethrow);
    Expression expression = throwStatement.exception;
    final int numberOfParens = (expression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
    if ((numberOfParens > 0 && this.preferences.insert_space_before_parenthesized_expression_in_throw)
        || numberOfParens == 0) {
      this.scribe.space();
    }
    expression.traverse(this, scope);
    /*
     * Print the semi-colon
     */ 
    this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
    this.scribe.printTrailingComment();
View Full Code Here

    this.scribe.printNextToken(operator, this.preferences.insert_space_before_unary_operator);
    if (this.preferences.insert_space_after_unary_operator) {
      this.scribe.space();
    }
    Expression expression = unaryExpression.expression;

    if (expression instanceof PrefixExpression) {
      PrefixExpression prefixExpression = (PrefixExpression) expression;
      final int numberOfParensForExpression = (prefixExpression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
      if (numberOfParensForExpression == 0) {
        switch(operatorValue) {
          case OperatorIds.PLUS:
            if (prefixExpression.operator == OperatorIds.PLUS) {
              this.scribe.space();
            }           
            break;
          case OperatorIds.MINUS:
            if (prefixExpression.operator == OperatorIds.MINUS) {
              this.scribe.space();
            }           
            break;
        }
      }
      expression.traverse(this, scope);
    } else {
      expression.traverse(this, scope);
    }

    if (numberOfParens > 0) {
      manageClosingParenthesizedExpression(unaryExpression, numberOfParens);
    }
View Full Code Here

      char[] sig = ans[i].resolvedType.signature();
      if (CharOperation.equals(pointcutSig, sig)) {
        if (ans[i].memberValuePairs().length == 0) {
          return ""; // empty pointcut expression
        }
        Expression expr = ans[i].memberValuePairs()[0].value;
        if (expr instanceof StringLiteral) {
          StringLiteral sLit = ((StringLiteral) expr);
          return new String(sLit.source());
        } else if (expr instanceof NameReference && (((NameReference) expr).binding instanceof FieldBinding)) {
          Binding b = ((NameReference) expr).binding;
          Constant c = ((FieldBinding) b).constant;
          return c.stringValue();
        } else {
          throw new BCException("Do not know how to recover pointcut definition from " + expr + " (type "
              + expr.getClass().getName() + ")");
        }
      }
    }
    return "";
  }
View Full Code Here

  if (this.arguments != null) {
    boolean argHasError = false; // typeChecks all arguments
    int length = this.arguments.length;
    argumentTypes = new TypeBinding[length];
    for (int i = 0; i < length; i++) {
      Expression argument = arguments[i];
      if (argument instanceof CastExpression) {
        argument.bits |= DisableUnnecessaryCastCheck; // will check later on
        argsContainCast = true;
      }
      if ((argumentTypes[i] = this.arguments[i].resolveType(scope)) == null)
View Full Code Here

    // in it - see the other checks on BcelObjectType in this class.
    if (realBinding instanceof MethodBinding) {
      AbstractMethodDeclaration methodDecl = getTypeDeclaration().declarationOf((MethodBinding) realBinding);
      if (methodDecl instanceof AnnotationMethodDeclaration) {
        AnnotationMethodDeclaration annoMethodDecl = (AnnotationMethodDeclaration) methodDecl;
        Expression e = annoMethodDecl.defaultValue;
        if (e.resolvedType == null) {
          e.resolve(methodDecl.scope);
        }
        // TODO does not cope with many cases...
        if (e instanceof QualifiedNameReference) {

          QualifiedNameReference qnr = (QualifiedNameReference) e;
          if (qnr.binding instanceof FieldBinding) {
            FieldBinding fb = (FieldBinding) qnr.binding;
            StringBuffer sb = new StringBuffer();
            sb.append(fb.declaringClass.signature());
            sb.append(fb.name);
            return sb.toString();
          }
        } else if (e instanceof TrueLiteral) {
          return "true";
        } else if (e instanceof FalseLiteral) {
          return "false";
        } else if (e instanceof StringLiteral) {
          return new String(((StringLiteral) e).source());
        } else if (e instanceof IntLiteral) {
          return Integer.toString(((IntConstant) e.constant).intValue());
        } else {
          throw new BCException("EclipseResolvedMember.getAnnotationDefaultValue() not implemented for value of type '"
              + e.getClass() + "' - raise an AspectJ bug !");
        }
      }
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression

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.