Search in sources :

Example 1 with ControlBlock

use of org.eclipse.ceylon.model.typechecker.model.ControlBlock in project ceylon by eclipse.

the class DeclarationVisitor method visit.

@Override
public void visit(Tree.SwitchStatement that) {
    ControlBlock cb = new ControlBlock();
    cb.setId(id++);
    that.setControlBlock(cb);
    visitElement(that, cb);
    Scope o = enterScope(cb);
    super.visit(that);
    exitScope(o);
}
Also used : ControlBlock(org.eclipse.ceylon.model.typechecker.model.ControlBlock) Scope(org.eclipse.ceylon.model.typechecker.model.Scope) ConditionScope(org.eclipse.ceylon.model.typechecker.model.ConditionScope) ModelUtil.getRealScope(org.eclipse.ceylon.model.typechecker.model.ModelUtil.getRealScope)

Example 2 with ControlBlock

use of org.eclipse.ceylon.model.typechecker.model.ControlBlock in project ceylon by eclipse.

the class DefiniteAssignmentVisitor method visit.

public void visit(Tree.AnyClass that) {
    ControlBlock prevControlBlock = forBlock;
    forBlock = null;
    super.visit(that);
    forBlock = prevControlBlock;
}
Also used : ControlBlock(org.eclipse.ceylon.model.typechecker.model.ControlBlock)

Example 3 with ControlBlock

use of org.eclipse.ceylon.model.typechecker.model.ControlBlock in project ceylon by eclipse.

the class DefiniteAssignmentVisitor method visit.

public void visit(Tree.SpecifierStatement stmt) {
    Tree.Term bme = stmt.getBaseMemberExpression();
    if (bme instanceof Tree.MemberOrTypeExpression) {
        Declaration decl = ((Tree.MemberOrTypeExpression) bme).getDeclaration();
        if (// non-variable and deferred
        tracked.containsKey(decl) && // specification is in a for/else
        forBlock != null && !forBlock.equals(tracked.get(decl))) {
            // not declared in *this* for/else
            if (elseBlock == null) {
                ((Value) decl).setSpecifiedInForElse(true);
            }
            ControlBlock assigningBlock = elseBlock != null ? elseBlock : forBlock;
            addSpecified(decl, assigningBlock);
        }
    }
    super.visit(stmt);
}
Also used : ControlBlock(org.eclipse.ceylon.model.typechecker.model.ControlBlock) Value(org.eclipse.ceylon.model.typechecker.model.Value) Tree(org.eclipse.ceylon.compiler.typechecker.tree.Tree) Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration)

Example 4 with ControlBlock

use of org.eclipse.ceylon.model.typechecker.model.ControlBlock in project ceylon by eclipse.

the class DeclarationVisitor method visit.

@Override
public void visit(Tree.SwitchExpression that) {
    ControlBlock cb = new ControlBlock();
    cb.setId(id++);
    visitElement(that, cb);
    Scope o = enterScope(cb);
    super.visit(that);
    exitScope(o);
}
Also used : ControlBlock(org.eclipse.ceylon.model.typechecker.model.ControlBlock) Scope(org.eclipse.ceylon.model.typechecker.model.Scope) ConditionScope(org.eclipse.ceylon.model.typechecker.model.ConditionScope) ModelUtil.getRealScope(org.eclipse.ceylon.model.typechecker.model.ModelUtil.getRealScope)

Example 5 with ControlBlock

use of org.eclipse.ceylon.model.typechecker.model.ControlBlock in project ceylon by eclipse.

the class DeclarationVisitor method visit.

@Override
public void visit(Tree.ControlClause that) {
    ControlBlock cb = new ControlBlock();
    cb.setLet(that instanceof Tree.LetClause);
    cb.setId(id++);
    that.setControlBlock(cb);
    visitElement(that, cb);
    Scope o = enterScope(cb);
    super.visit(that);
    exitScope(o);
}
Also used : ControlBlock(org.eclipse.ceylon.model.typechecker.model.ControlBlock) Scope(org.eclipse.ceylon.model.typechecker.model.Scope) ConditionScope(org.eclipse.ceylon.model.typechecker.model.ConditionScope) ModelUtil.getRealScope(org.eclipse.ceylon.model.typechecker.model.ModelUtil.getRealScope) CustomTree(org.eclipse.ceylon.compiler.typechecker.tree.CustomTree) Tree(org.eclipse.ceylon.compiler.typechecker.tree.Tree)

Aggregations

ControlBlock (org.eclipse.ceylon.model.typechecker.model.ControlBlock)10 ConditionScope (org.eclipse.ceylon.model.typechecker.model.ConditionScope)4 Declaration (org.eclipse.ceylon.model.typechecker.model.Declaration)4 ModelUtil.getRealScope (org.eclipse.ceylon.model.typechecker.model.ModelUtil.getRealScope)4 Scope (org.eclipse.ceylon.model.typechecker.model.Scope)4 Tree (org.eclipse.ceylon.compiler.typechecker.tree.Tree)3 Value (org.eclipse.ceylon.model.typechecker.model.Value)3 CustomTree (org.eclipse.ceylon.compiler.typechecker.tree.CustomTree)2 ArrayList (java.util.ArrayList)1 AnalyzerUtil.getPackageTypeDeclaration (org.eclipse.ceylon.compiler.typechecker.analyzer.AnalyzerUtil.getPackageTypeDeclaration)1 AnalyzerUtil.getTypeDeclaration (org.eclipse.ceylon.compiler.typechecker.analyzer.AnalyzerUtil.getTypeDeclaration)1 ClassOrInterface (org.eclipse.ceylon.model.typechecker.model.ClassOrInterface)1 Function (org.eclipse.ceylon.model.typechecker.model.Function)1 FunctionOrValue (org.eclipse.ceylon.model.typechecker.model.FunctionOrValue)1 ModelUtil.getContainingClassOrInterface (org.eclipse.ceylon.model.typechecker.model.ModelUtil.getContainingClassOrInterface)1 ParameterList (org.eclipse.ceylon.model.typechecker.model.ParameterList)1 Setter (org.eclipse.ceylon.model.typechecker.model.Setter)1 TypeDeclaration (org.eclipse.ceylon.model.typechecker.model.TypeDeclaration)1 TypedDeclaration (org.eclipse.ceylon.model.typechecker.model.TypedDeclaration)1 Unit (org.eclipse.ceylon.model.typechecker.model.Unit)1