use of com.redhat.ceylon.model.typechecker.model.ControlBlock in project ceylon-compiler by ceylon.
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;
Set<Value> assigned = assigningBlock.getSpecifiedValues();
if (assigned == null) {
assigned = new HashSet<Value>(1);
assigningBlock.setSpecifiedValues(assigned);
}
assigned.add((Value) decl);
}
}
super.visit(stmt);
}
use of com.redhat.ceylon.model.typechecker.model.ControlBlock in project ceylon-compiler by ceylon.
the class DefiniteAssignmentVisitor method visit.
public void visit(Tree.AnyClass that) {
ControlBlock prevControlBlock = forBlock;
forBlock = null;
super.visit(that);
forBlock = prevControlBlock;
}
use of com.redhat.ceylon.model.typechecker.model.ControlBlock in project ceylon-compiler by ceylon.
the class DefiniteAssignmentVisitor method visit.
public void visit(Tree.AnyMethod that) {
ControlBlock prevControlBlock = forBlock;
forBlock = null;
super.visit(that);
forBlock = prevControlBlock;
}
use of com.redhat.ceylon.model.typechecker.model.ControlBlock in project ceylon-compiler by ceylon.
the class StatementTransformer method closeInnerSubstituionsForSpecifiedValues.
/**
* Removes the "inner substitutions" for any deferred values specified
* in the given control block
*/
private void closeInnerSubstituionsForSpecifiedValues(Tree.ControlClause contolClause) {
if (contolClause != null) {
ControlBlock controlBlock = contolClause.getControlBlock();
java.util.Set<Value> assigned = controlBlock.getSpecifiedValues();
if (assigned != null) {
for (Value value : assigned) {
DeferredSpecification ds = statementGen().getDeferredSpecification(value);
if (ds != null) {
ds.closeInnerSubstitution();
}
}
}
}
}
use of com.redhat.ceylon.model.typechecker.model.ControlBlock in project ceylon-compiler by ceylon.
the class DefiniteAssignmentVisitor method visit.
public void visit(Tree.ForStatement that) {
ControlBlock prevControlBlock = forBlock;
forBlock = that.getForClause().getControlBlock();
that.getForClause().visit(this);
if (that.getElseClause() != null) {
elseBlock = that.getElseClause().getControlBlock();
that.getElseClause().visit(this);
elseBlock = null;
}
forBlock = prevControlBlock;
}
Aggregations