Package org.eclipse.cdt.core.dom.ast

Examples of org.eclipse.cdt.core.dom.ast.IASTExpression


  private IASTExpression convertSuperMethodInvocation(final SuperMethodInvocation superMethodInvocation) {
    final IMethodBinding methodBinding = superMethodInvocation.resolveMethodBinding();
    final ICPPASTQualifiedName qualifiedName = f.newQualifiedName();
    qualifiedName.addName(f.newName(methodBinding.getDeclaringClass().getName().toCharArray()));
    qualifiedName.addName(new NameInfo(superMethodInvocation.getName()).getName());
    final IASTExpression call = f.newIdExpression(qualifiedName);
    final List<IASTInitializerClause> initializerClauses = new ArrayList<IASTInitializerClause>();
    for (final Object argumentObject : superMethodInvocation.arguments()) {
      final ExpressionInfo argument = new ExpressionInfo((Expression) argumentObject, typeDeclaration, compilationUnitInfo);
      initializerClauses.add(argument.getExpression());
    }
View Full Code Here


  private IASTExpression convertCastExpression(final CastExpression castExpression) {
    final int operator = ICPPASTCastExpression.op_static_cast;
    final TypeInfo type = new TypeInfo(castExpression.getType(), compilationUnitInfo);
    final ICPPASTTypeId typeId = f.newTypeId(type.getDeclSpecifier(), null);
    final IASTExpression expr = new ExpressionInfo(castExpression.getExpression(), typeDeclaration, compilationUnitInfo).getExpression();
    return f.newCastExpression(operator, typeId, expr);
  }
View Full Code Here

    fieldReference.setIsPointerDereference(true);
    return fieldReference;
  }

  private IASTExpression convertMethodInvocation(final MethodInvocation methodInvocation) {
    IASTExpression call;
    if (methodInvocation.getExpression() != null) {
      final IMethodBinding methodBinding = methodInvocation.resolveMethodBinding();
      if ((methodBinding != null) && ((methodBinding.getModifiers() & Modifier.STATIC) != 0)) {
        final ICPPASTQualifiedName qualifiedName = f.newQualifiedName();
        qualifiedName.addName(f.newName(methodBinding.getDeclaringClass().getName().toCharArray()));
View Full Code Here

    }
    return f.newFunctionCallExpression(call, initializerClauses.toArray(new IASTInitializerClause[initializerClauses.size()]));
  }

  private IASTExpression convertConditionalExpression(final ConditionalExpression conditionalExpression) {
    final IASTExpression condition = new ExpressionInfo(conditionalExpression.getExpression(), typeDeclaration, compilationUnitInfo).getExpression();
    final IASTExpression positive = new ExpressionInfo(conditionalExpression.getThenExpression(), typeDeclaration, compilationUnitInfo).getExpression();
    final IASTExpression negative = new ExpressionInfo(conditionalExpression.getElseExpression(), typeDeclaration, compilationUnitInfo).getExpression();
    return f.newConditionalExpession(condition, positive, negative);
  }
View Full Code Here

    final IASTExpression negative = new ExpressionInfo(conditionalExpression.getElseExpression(), typeDeclaration, compilationUnitInfo).getExpression();
    return f.newConditionalExpession(condition, positive, negative);
  }

  private IASTExpression convertArrayAccess(final ArrayAccess arrayAccess) {
    final IASTExpression arrayExpr = new ExpressionInfo(arrayAccess.getArray(), typeDeclaration, compilationUnitInfo).getExpression();
    final IASTExpression subscript = new ExpressionInfo(arrayAccess.getIndex(), typeDeclaration, compilationUnitInfo).getExpression();
    return f.newArraySubscriptExpression(arrayExpr, subscript);
  }
View Full Code Here

  }

  private void writeEnumerator(final IASTEnumerator enumerator) {
    enumerator.getName().accept(visitor);

    final IASTExpression value = enumerator.getValue();
    if (value != null) {
      scribe.print(EQUALS);
      value.accept(visitor);
    }
  }
View Full Code Here

  }

  private void writeReturnStatement(final IASTReturnStatement returnStatement) {
    scribe.noNewLines();
    scribe.print(RETURN);
    final IASTExpression returnValue = returnStatement.getReturnValue();
    if (returnValue != null) {
      scribe.printSpaces(1);
      returnValue.accept(visitor);
    }
    scribe.newLines();
    scribe.printSemicolon();
  }
View Full Code Here

  private IASTStatement convertThrowStatement(final ThrowStatement throwStatement) {
    return f.newExpressionStatement(f.newUnaryExpression(ICPPASTUnaryExpression.op_throw, null));
  }

  private IASTStatement convertConstructorInvocation(final ConstructorInvocation constructorInvocation) {
    final IASTExpression call = new ExpressionInfo(typeDeclaration.getName(), typeDeclaration, compilationUnitInfo).getExpression();
    final List<IASTInitializerClause> initializerClauses = new ArrayList<IASTInitializerClause>();
    for (final Object argumentObject : constructorInvocation.arguments()) {
      final ExpressionInfo argument = new ExpressionInfo((Expression) argumentObject, typeDeclaration, compilationUnitInfo);
      initializerClauses.add(argument.getExpression());
    }
View Full Code Here

      init = declarationStatement;
    }

    final ExpressionInfo condition = new ExpressionInfo(forStatement.getExpression(), typeDeclaration, compilationUnitInfo);

    IASTExpression iterationExpression;
    if (forStatement.updaters().isEmpty()) {
      iterationExpression = f.newIdExpression(f.newName());
    } else {
      final ICPPASTExpressionList expressionList = f.newExpressionList();
      for (final Object updaterObject : forStatement.updaters()) {
        final IASTExpression updater = new ExpressionInfo((Expression) updaterObject, typeDeclaration, compilationUnitInfo).getExpression();
        expressionList.addExpression(updater);
      }
      iterationExpression = expressionList;
    }
View Full Code Here

      throw new IllegalArgumentException("Unkwown unaryExpressionType " + unaryExpressionType); //$NON-NLS-1$
    }
  }

  private void writeBinaryExpression(final IASTBinaryExpression binExp) {
    final IASTExpression operand1 = binExp.getOperand1();
    if (!macroHandler.checkisMacroExpansionNode(operand1)) {
      operand1.accept(visitor);
    }
    final IASTExpression operand2 = binExp.getOperand2();
    if (macroHandler.checkisMacroExpansionNode(operand2, false) && macroHandler.macroExpansionAlreadyPrinted(operand2)) {
      return;
    }
    scribe.print(getBinaryExpressionOperator(binExp.getOperator()));
    operand2.accept(visitor);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.cdt.core.dom.ast.IASTExpression

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.