Example usage for org.eclipse.jdt.core.dom SuperConstructorInvocation getFlags

List of usage examples for org.eclipse.jdt.core.dom SuperConstructorInvocation getFlags

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom SuperConstructorInvocation getFlags.

Prototype

public final int getFlags() 

Source Link

Document

Returns the flags associated with this node.

Usage

From source file:org.eclipse.jdt.core.dom.ASTConverter.java

License:Open Source License

public Statement convert(org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall statement) {
    Statement newStatement;/*from  w  w  w  .ja  va 2 s.co  m*/
    int sourceStart = statement.sourceStart;
    if (statement.isSuperAccess() || statement.isSuper()) {
        SuperConstructorInvocation superConstructorInvocation = new SuperConstructorInvocation(this.ast);
        if (statement.qualification != null) {
            superConstructorInvocation.setExpression(convert(statement.qualification));
        }
        org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = statement.arguments;
        if (arguments != null) {
            int length = arguments.length;
            for (int i = 0; i < length; i++) {
                superConstructorInvocation.arguments().add(convert(arguments[i]));
            }
        }
        if (statement.typeArguments != null) {
            if (sourceStart > statement.typeArgumentsSourceStart) {
                sourceStart = statement.typeArgumentsSourceStart;
            }
            switch (this.ast.apiLevel) {
            case AST.JLS2_INTERNAL:
                superConstructorInvocation.setFlags(superConstructorInvocation.getFlags() | ASTNode.MALFORMED);
                break;
            default:
                for (int i = 0, max = statement.typeArguments.length; i < max; i++) {
                    superConstructorInvocation.typeArguments().add(convertType(statement.typeArguments[i]));
                }
                break;
            }
        }
        newStatement = superConstructorInvocation;
    } else {
        ConstructorInvocation constructorInvocation = new ConstructorInvocation(this.ast);
        org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = statement.arguments;
        if (arguments != null) {
            int length = arguments.length;
            for (int i = 0; i < length; i++) {
                constructorInvocation.arguments().add(convert(arguments[i]));
            }
        }
        if (statement.typeArguments != null) {
            if (sourceStart > statement.typeArgumentsSourceStart) {
                sourceStart = statement.typeArgumentsSourceStart;
            }
            switch (this.ast.apiLevel) {
            case AST.JLS2_INTERNAL:
                constructorInvocation.setFlags(constructorInvocation.getFlags() | ASTNode.MALFORMED);
                break;
            default:
                for (int i = 0, max = statement.typeArguments.length; i < max; i++) {
                    constructorInvocation.typeArguments().add(convertType(statement.typeArguments[i]));
                }
                break;
            }
        }
        if (statement.qualification != null) {
            // this is an error
            constructorInvocation.setFlags(constructorInvocation.getFlags() | ASTNode.MALFORMED);
        }
        newStatement = constructorInvocation;
    }
    newStatement.setSourceRange(sourceStart, statement.sourceEnd - sourceStart + 1);
    if (this.resolveBindings) {
        recordNodes(newStatement, statement);
    }
    return newStatement;
}