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

Examples of org.eclipse.cdt.core.dom.ast.cpp.ICPPASTArrayDeclarator


  public AbstractVariableFragmentDeclarationInfo(final VariableDeclaration variableDeclaration, final Type type, final CompilationUnitInfo compilationUnitInfo) {
    final TypeInfo typeInfo = new TypeInfo(type, compilationUnitInfo);
    declSpecifier = typeInfo.getDeclSpecifier();

    if (type.isArrayType()) {
      final ICPPASTArrayDeclarator arrayDeclarator = f.newArrayDeclarator(new NameInfo(variableDeclaration.getName()).getName());
      arrayDeclarator.addPointerOperator(f.newPointer());
      if (variableDeclaration.getInitializer() != null) {
        final ArrayCreation arrayCreation = (ArrayCreation) variableDeclaration.getInitializer();
        for (final Object dimensionObject : arrayCreation.dimensions()) {
          final ExpressionInfo dimension = new ExpressionInfo((Expression) dimensionObject, null, compilationUnitInfo);
          arrayDeclarator.addArrayModifier(f.newArrayModifier(dimension.getExpression()));
        }
      } else {
        final ArrayType arrayType = (ArrayType) type;
        for (int i = 0; i < arrayType.getDimensions(); i++) {
          arrayDeclarator.addPointerOperator(f.newPointer());
        }
      }
      initializer = null;
      declarator = arrayDeclarator;
    } else {
View Full Code Here

TOP

Related Classes of org.eclipse.cdt.core.dom.ast.cpp.ICPPASTArrayDeclarator

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.