Example usage for org.eclipse.jdt.internal.compiler.lookup BlockScope BlockScope

List of usage examples for org.eclipse.jdt.internal.compiler.lookup BlockScope BlockScope

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup BlockScope BlockScope.

Prototype

protected BlockScope(int kind, Scope parent) 

Source Link

Usage

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.ast.WithinStatement.java

License:Open Source License

public void resolve(BlockScope upperScope) {
    this.scope = new BlockScope(upperScope, this.explicitDeclarations);
    // special treatment of type errors for teamExpr:
    Expression teamExpr = this.teamVarDecl.initialization;
    teamExpr.resolve(this.scope);
    TypeBinding tb = teamExpr.resolvedType;

    if ((tb instanceof ReferenceBinding) && ((ReferenceBinding) tb).isTeam()) {
        this.teamVarDecl.initialization = null; // don't resolve again...
        this.teamVarDecl.resolve(this.scope); // no type error possible any more.
        this.teamVarDecl.initialization = teamExpr; // ... restore.
    } else {//from  ww  w .  ja  v a2 s.  c om
        this.scope.problemReporter().withinStatementNeedsTeamInstance(teamExpr);
        // don't procede because we don't want to see errors related
        // to the generated variable...
        return;
    }
    for (int i = 1; i < this.statements.length; i++) // skip [0]: it's the teamVarDecl.
        this.statements[i].resolve(this.scope);
}