Example usage for org.eclipse.jdt.internal.compiler.ast ASTNode ErrorInSignature

List of usage examples for org.eclipse.jdt.internal.compiler.ast ASTNode ErrorInSignature

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast ASTNode ErrorInSignature.

Prototype

int ErrorInSignature

To view the source code for org.eclipse.jdt.internal.compiler.ast ASTNode ErrorInSignature.

Click Source Link

Usage

From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java

License:Open Source License

protected void reportSyntaxErrors(boolean isDietParse, int oldFirstToken) {
    if (this.referenceContext instanceof MethodDeclaration) {
        MethodDeclaration methodDeclaration = (MethodDeclaration) this.referenceContext;
        if ((methodDeclaration.bits & ASTNode.ErrorInSignature) != 0) {
            return;
        }//from  ww  w . jav  a 2 s .c o m
    }
    this.compilationUnit.compilationResult.lineSeparatorPositions = this.scanner.getLineEnds();
    this.scanner.recordLineSeparator = false;

    int start = this.scanner.initialPosition;
    int end = this.scanner.eofPosition == Integer.MAX_VALUE ? this.scanner.eofPosition
            : this.scanner.eofPosition - 1;
    if (isDietParse) {
        TypeDeclaration[] types = this.compilationUnit.types;
        int[][] intervalToSkip = org.eclipse.jdt.internal.compiler.parser.diagnose.RangeUtil
                .computeDietRange(types);
        DiagnoseParser diagnoseParser = new DiagnoseParser(this, oldFirstToken, start, end, intervalToSkip[0],
                intervalToSkip[1], intervalToSkip[2], this.options);
        diagnoseParser.diagnoseParse(false);

        reportSyntaxErrorsForSkippedMethod(types);
        this.scanner.resetTo(start, end);
    } else {
        DiagnoseParser diagnoseParser = new DiagnoseParser(this, oldFirstToken, start, end, this.options);
        diagnoseParser.diagnoseParse(this.options.performStatementsRecovery);
    }
}

From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java

License:Open Source License

private void reportSyntaxErrorsForSkippedMethod(TypeDeclaration[] types) {
    if (types != null) {
        for (int i = 0; i < types.length; i++) {
            TypeDeclaration[] memberTypes = types[i].memberTypes;
            if (memberTypes != null) {
                reportSyntaxErrorsForSkippedMethod(memberTypes);
            }/*from  w w  w.j  av  a  2  s  .  c om*/

            AbstractMethodDeclaration[] methods = types[i].methods;
            if (methods != null) {
                for (int j = 0; j < methods.length; j++) {
                    AbstractMethodDeclaration method = methods[j];
                    if ((method.bits & ASTNode.ErrorInSignature) != 0) {
                        if (method.isAnnotationMethod()) {
                            DiagnoseParser diagnoseParser = new DiagnoseParser(this, TokenNameQUESTION,
                                    method.declarationSourceStart, method.declarationSourceEnd, this.options);
                            diagnoseParser.diagnoseParse(this.options.performStatementsRecovery);
                        } else {
                            DiagnoseParser diagnoseParser = new DiagnoseParser(this, TokenNameDIVIDE,
                                    method.declarationSourceStart, method.declarationSourceEnd, this.options);
                            diagnoseParser.diagnoseParse(this.options.performStatementsRecovery);
                        }

                    }
                }
            }

            FieldDeclaration[] fields = types[i].fields;
            if (fields != null) {
                int length = fields.length;
                for (int j = 0; j < length; j++) {
                    if (fields[j] instanceof Initializer) {
                        Initializer initializer = (Initializer) fields[j];
                        if ((initializer.bits & ASTNode.ErrorInSignature) != 0) {
                            DiagnoseParser diagnoseParser = new DiagnoseParser(this, TokenNameRIGHT_SHIFT,
                                    initializer.declarationSourceStart, initializer.declarationSourceEnd,
                                    this.options);
                            diagnoseParser.diagnoseParse(this.options.performStatementsRecovery);
                        }
                    }
                }
            }
        }
    }
}