org.extendj.ast.WhileStmt Maven / Gradle / Ivy
/* This file was generated with JastAdd2 (http://jastadd.org) version 2.3.0 */
package org.extendj.ast;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.ArrayList;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.zip.*;
import java.io.*;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import org.jastadd.util.PrettyPrintable;
import org.jastadd.util.PrettyPrinter;
import java.io.FileNotFoundException;
import java.io.InputStream;
import org.jastadd.util.*;
import java.io.File;
import java.io.IOException;
import java.util.Set;
import beaver.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
/**
* @ast node
* @declaredat /home/jesper/git/extendj/java4/grammar/Java.ast:302
* @astdecl WhileStmt : BranchTargetStmt ::= Condition:Expr Stmt;
* @production WhileStmt : {@link BranchTargetStmt} ::= Condition:{@link Expr} {@link Stmt};
*/
public class WhileStmt extends BranchTargetStmt implements Cloneable {
/**
* @aspect PrettyPrintUtil
* @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrintUtil.jrag:197
*/
public void prettyPrint(PrettyPrinter out) {
out.print("while (");
out.print(getCondition());
out.print(") ");
if (getStmt() instanceof Block) {
out.print(getStmt());
} else {
out.print("{");
out.println();
out.indent(1);
out.print(getStmt());
out.println();
out.print("}");
}
}
/**
* @aspect CreateBCode
* @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1642
*/
public void createBCode(CodeGeneration gen) {
super.createBCode(gen);
gen.addLabel(cond_label());
if (!getCondition().isConstant()) {
getCondition().branchFalse(gen, end_label());
}
gen.addLabel(stmt_label());
if (getCondition().canBeTrue()) {
getStmt().createBCode(gen);
if (getStmt().canCompleteNormally()) {
gen.GOTO(cond_label());
}
}
gen.addLabel(end_label());
}
/**
* @declaredat ASTNode:1
*/
public WhileStmt() {
super();
}
/**
* Initializes the child array to the correct size.
* Initializes List and Opt nta children.
* @apilevel internal
* @ast method
* @declaredat ASTNode:10
*/
public void init$Children() {
children = new ASTNode[2];
}
/**
* @declaredat ASTNode:13
*/
@ASTNodeAnnotation.Constructor(
name = {"Condition", "Stmt"},
type = {"Expr", "Stmt"},
kind = {"Child", "Child"}
)
public WhileStmt(Expr p0, Stmt p1) {
setChild(p0, 0);
setChild(p1, 1);
}
/** @apilevel low-level
* @declaredat ASTNode:23
*/
protected int numChildren() {
return 2;
}
/**
* @apilevel internal
* @declaredat ASTNode:29
*/
public boolean mayHaveRewrite() {
return false;
}
/** @apilevel internal
* @declaredat ASTNode:33
*/
public void flushAttrCache() {
super.flushAttrCache();
canCompleteNormally_reset();
assignedAfter_Variable_reset();
unassignedAfter_Variable_reset();
unassignedBeforeCondition_Variable_reset();
cond_label_reset();
end_label_reset();
stmt_label_reset();
}
/** @apilevel internal
* @declaredat ASTNode:44
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/** @apilevel internal
* @declaredat ASTNode:48
*/
public WhileStmt clone() throws CloneNotSupportedException {
WhileStmt node = (WhileStmt) super.clone();
return node;
}
/** @apilevel internal
* @declaredat ASTNode:53
*/
public WhileStmt copy() {
try {
WhileStmt node = (WhileStmt) clone();
node.parent = null;
if (children != null) {
node.children = (ASTNode[]) children.clone();
}
return node;
} catch (CloneNotSupportedException e) {
throw new Error("Error: clone not supported for " + getClass().getName());
}
}
/**
* Create a deep copy of the AST subtree at this node.
* The copy is dangling, i.e. has no parent.
* @return dangling copy of the subtree at this node
* @apilevel low-level
* @deprecated Please use treeCopy or treeCopyNoTransform instead
* @declaredat ASTNode:72
*/
@Deprecated
public WhileStmt fullCopy() {
return treeCopyNoTransform();
}
/**
* Create a deep copy of the AST subtree at this node.
* The copy is dangling, i.e. has no parent.
* @return dangling copy of the subtree at this node
* @apilevel low-level
* @declaredat ASTNode:82
*/
public WhileStmt treeCopyNoTransform() {
WhileStmt tree = (WhileStmt) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
ASTNode child = (ASTNode) children[i];
if (child != null) {
child = child.treeCopyNoTransform();
tree.setChild(child, i);
}
}
}
return tree;
}
/**
* Create a deep copy of the AST subtree at this node.
* The subtree of this node is traversed to trigger rewrites before copy.
* The copy is dangling, i.e. has no parent.
* @return dangling copy of the subtree at this node
* @apilevel low-level
* @declaredat ASTNode:102
*/
public WhileStmt treeCopy() {
WhileStmt tree = (WhileStmt) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
ASTNode child = (ASTNode) getChild(i);
if (child != null) {
child = child.treeCopy();
tree.setChild(child, i);
}
}
}
return tree;
}
/** @apilevel internal
* @declaredat ASTNode:116
*/
protected boolean is$Equal(ASTNode node) {
return super.is$Equal(node);
}
/**
* Replaces the Condition child.
* @param node The new node to replace the Condition child.
* @apilevel high-level
*/
public void setCondition(Expr node) {
setChild(node, 0);
}
/**
* Retrieves the Condition child.
* @return The current node used as the Condition child.
* @apilevel high-level
*/
@ASTNodeAnnotation.Child(name="Condition")
public Expr getCondition() {
return (Expr) getChild(0);
}
/**
* Retrieves the Condition child.
* This method does not invoke AST transformations.
* @return The current node used as the Condition child.
* @apilevel low-level
*/
public Expr getConditionNoTransform() {
return (Expr) getChildNoTransform(0);
}
/**
* Replaces the Stmt child.
* @param node The new node to replace the Stmt child.
* @apilevel high-level
*/
public void setStmt(Stmt node) {
setChild(node, 1);
}
/**
* Retrieves the Stmt child.
* @return The current node used as the Stmt child.
* @apilevel high-level
*/
@ASTNodeAnnotation.Child(name="Stmt")
public Stmt getStmt() {
return (Stmt) getChild(1);
}
/**
* Retrieves the Stmt child.
* This method does not invoke AST transformations.
* @return The current node used as the Stmt child.
* @apilevel low-level
*/
public Stmt getStmtNoTransform() {
return (Stmt) getChildNoTransform(1);
}
/**
* @attribute syn
* @aspect NameCheck
* @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:567
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="NameCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/NameCheck.jrag:567")
public boolean continueLabel() {
boolean continueLabel_value = true;
return continueLabel_value;
}
/** @apilevel internal */
private void canCompleteNormally_reset() {
canCompleteNormally_computed = null;
}
/** @apilevel internal */
protected ASTState.Cycle canCompleteNormally_computed = null;
/** @apilevel internal */
protected boolean canCompleteNormally_value;
/**
* @attribute syn
* @aspect UnreachableStatements
* @declaredat /home/jesper/git/extendj/java4/frontend/UnreachableStatements.jrag:50
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="UnreachableStatements", declaredAt="/home/jesper/git/extendj/java4/frontend/UnreachableStatements.jrag:50")
public boolean canCompleteNormally() {
ASTState state = state();
if (canCompleteNormally_computed == ASTState.NON_CYCLE || canCompleteNormally_computed == state().cycle()) {
return canCompleteNormally_value;
}
canCompleteNormally_value = reachable() && (!getCondition().isConstant() || !getCondition().isTrue()) || reachableBreak();
if (state().inCircle()) {
canCompleteNormally_computed = state().cycle();
} else {
canCompleteNormally_computed = ASTState.NON_CYCLE;
}
return canCompleteNormally_value;
}
/**
* @return true
if this statement is a potential
* branch target of the given branch statement.
* @attribute syn
* @aspect BranchTarget
* @declaredat /home/jesper/git/extendj/java4/frontend/BranchTarget.jrag:215
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="BranchTarget", declaredAt="/home/jesper/git/extendj/java4/frontend/BranchTarget.jrag:215")
public boolean potentialTargetOf(Stmt branch) {
boolean potentialTargetOf_Stmt_value = branch.canBranchTo(this);
return potentialTargetOf_Stmt_value;
}
/** @apilevel internal */
private void assignedAfter_Variable_reset() {
assignedAfter_Variable_values = null;
}
protected java.util.Map assignedAfter_Variable_values;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="DefiniteAssignment", declaredAt="/home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:264")
public boolean assignedAfter(Variable v) {
Object _parameters = v;
if (assignedAfter_Variable_values == null) assignedAfter_Variable_values = new java.util.HashMap(4);
ASTState.CircularValue _value;
if (assignedAfter_Variable_values.containsKey(_parameters)) {
Object _cache = assignedAfter_Variable_values.get(_parameters);
if (!(_cache instanceof ASTState.CircularValue)) {
return (Boolean) _cache;
} else {
_value = (ASTState.CircularValue) _cache;
}
} else {
_value = new ASTState.CircularValue();
assignedAfter_Variable_values.put(_parameters, _value);
_value.value = true;
}
ASTState state = state();
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
boolean new_assignedAfter_Variable_value;
do {
_value.cycle = state.nextCycle();
new_assignedAfter_Variable_value = assignedAfter_compute(v);
if (((Boolean)_value.value) != new_assignedAfter_Variable_value) {
state.setChangeInCycle();
_value.value = new_assignedAfter_Variable_value;
}
} while (state.testAndClearChangeInCycle());
assignedAfter_Variable_values.put(_parameters, new_assignedAfter_Variable_value);
state.leaveCircle();
return new_assignedAfter_Variable_value;
} else if (_value.cycle != state.cycle()) {
_value.cycle = state.cycle();
boolean new_assignedAfter_Variable_value = assignedAfter_compute(v);
if (((Boolean)_value.value) != new_assignedAfter_Variable_value) {
state.setChangeInCycle();
_value.value = new_assignedAfter_Variable_value;
}
return new_assignedAfter_Variable_value;
} else {
return (Boolean) _value.value;
}
}
/** @apilevel internal */
private boolean assignedAfter_compute(Variable v) {
if (!getCondition().assignedAfterFalse(v)) {
return false;
}
for (BreakStmt stmt : targetBreaks()) {
if (!stmt.assignedAfterReachedFinallyBlocks(v)) {
return false;
}
}
return true;
}
/** @apilevel internal */
private void unassignedAfter_Variable_reset() {
unassignedAfter_Variable_values = null;
}
protected java.util.Map unassignedAfter_Variable_values;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="DefiniteUnassignment", declaredAt="/home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:895")
public boolean unassignedAfter(Variable v) {
Object _parameters = v;
if (unassignedAfter_Variable_values == null) unassignedAfter_Variable_values = new java.util.HashMap(4);
ASTState.CircularValue _value;
if (unassignedAfter_Variable_values.containsKey(_parameters)) {
Object _cache = unassignedAfter_Variable_values.get(_parameters);
if (!(_cache instanceof ASTState.CircularValue)) {
return (Boolean) _cache;
} else {
_value = (ASTState.CircularValue) _cache;
}
} else {
_value = new ASTState.CircularValue();
unassignedAfter_Variable_values.put(_parameters, _value);
_value.value = true;
}
ASTState state = state();
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
boolean new_unassignedAfter_Variable_value;
do {
_value.cycle = state.nextCycle();
new_unassignedAfter_Variable_value = unassignedAfter_compute(v);
if (((Boolean)_value.value) != new_unassignedAfter_Variable_value) {
state.setChangeInCycle();
_value.value = new_unassignedAfter_Variable_value;
}
} while (state.testAndClearChangeInCycle());
unassignedAfter_Variable_values.put(_parameters, new_unassignedAfter_Variable_value);
state.leaveCircle();
return new_unassignedAfter_Variable_value;
} else if (_value.cycle != state.cycle()) {
_value.cycle = state.cycle();
boolean new_unassignedAfter_Variable_value = unassignedAfter_compute(v);
if (((Boolean)_value.value) != new_unassignedAfter_Variable_value) {
state.setChangeInCycle();
_value.value = new_unassignedAfter_Variable_value;
}
return new_unassignedAfter_Variable_value;
} else {
return (Boolean) _value.value;
}
}
/** @apilevel internal */
private boolean unassignedAfter_compute(Variable v) {
if (!unassignedBeforeCondition(v)) { // Starts a circular evaluation here.
return false;
}
if (!getCondition().unassignedAfterFalse(v)) {
return false;
}
for (BreakStmt stmt : targetBreaks()) {
if (!stmt.unassignedAfterReachedFinallyBlocks(v)) {
return false;
}
}
return true;
}
/** @apilevel internal */
private void unassignedBeforeCondition_Variable_reset() {
unassignedBeforeCondition_Variable_values = null;
}
protected java.util.Map unassignedBeforeCondition_Variable_values;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="DefiniteUnassignment", declaredAt="/home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:1417")
public boolean unassignedBeforeCondition(Variable v) {
Object _parameters = v;
if (unassignedBeforeCondition_Variable_values == null) unassignedBeforeCondition_Variable_values = new java.util.HashMap(4);
ASTState.CircularValue _value;
if (unassignedBeforeCondition_Variable_values.containsKey(_parameters)) {
Object _cache = unassignedBeforeCondition_Variable_values.get(_parameters);
if (!(_cache instanceof ASTState.CircularValue)) {
return (Boolean) _cache;
} else {
_value = (ASTState.CircularValue) _cache;
}
} else {
_value = new ASTState.CircularValue();
unassignedBeforeCondition_Variable_values.put(_parameters, _value);
_value.value = true;
}
ASTState state = state();
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
boolean new_unassignedBeforeCondition_Variable_value;
do {
_value.cycle = state.nextCycle();
new_unassignedBeforeCondition_Variable_value = unassignedBeforeCondition_compute(v);
if (((Boolean)_value.value) != new_unassignedBeforeCondition_Variable_value) {
state.setChangeInCycle();
_value.value = new_unassignedBeforeCondition_Variable_value;
}
} while (state.testAndClearChangeInCycle());
unassignedBeforeCondition_Variable_values.put(_parameters, new_unassignedBeforeCondition_Variable_value);
state.leaveCircle();
return new_unassignedBeforeCondition_Variable_value;
} else if (_value.cycle != state.cycle()) {
_value.cycle = state.cycle();
boolean new_unassignedBeforeCondition_Variable_value = unassignedBeforeCondition_compute(v);
if (((Boolean)_value.value) != new_unassignedBeforeCondition_Variable_value) {
state.setChangeInCycle();
_value.value = new_unassignedBeforeCondition_Variable_value;
}
return new_unassignedBeforeCondition_Variable_value;
} else {
return (Boolean) _value.value;
}
}
/** @apilevel internal */
private boolean unassignedBeforeCondition_compute(Variable v) {
// 1st
if (!unassignedBefore(v)) {
return false;
} else if (!getStmt().unassignedAfter(v)) {
return false;
} else {
for (ContinueStmt stmt : targetContinues()) {
if (!stmt.unassignedAfterReachedFinallyBlocks(v)) {
return false;
}
}
}
return true;
}
/** @apilevel internal */
private void cond_label_reset() {
cond_label_computed = null;
}
/** @apilevel internal */
protected ASTState.Cycle cond_label_computed = null;
/** @apilevel internal */
protected int cond_label_value;
/**
* @attribute syn
* @aspect CreateBCode
* @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1638
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="CreateBCode", declaredAt="/home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1638")
public int cond_label() {
ASTState state = state();
if (cond_label_computed == ASTState.NON_CYCLE || cond_label_computed == state().cycle()) {
return cond_label_value;
}
cond_label_value = hostType().constantPool().newLabel();
if (state().inCircle()) {
cond_label_computed = state().cycle();
} else {
cond_label_computed = ASTState.NON_CYCLE;
}
return cond_label_value;
}
/** @apilevel internal */
private void end_label_reset() {
end_label_computed = null;
}
/** @apilevel internal */
protected ASTState.Cycle end_label_computed = null;
/** @apilevel internal */
protected int end_label_value;
/**
* @attribute syn
* @aspect CreateBCode
* @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1639
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="CreateBCode", declaredAt="/home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1639")
public int end_label() {
ASTState state = state();
if (end_label_computed == ASTState.NON_CYCLE || end_label_computed == state().cycle()) {
return end_label_value;
}
end_label_value = hostType().constantPool().newLabel();
if (state().inCircle()) {
end_label_computed = state().cycle();
} else {
end_label_computed = ASTState.NON_CYCLE;
}
return end_label_value;
}
/** @apilevel internal */
private void stmt_label_reset() {
stmt_label_computed = null;
}
/** @apilevel internal */
protected ASTState.Cycle stmt_label_computed = null;
/** @apilevel internal */
protected int stmt_label_value;
/**
* @attribute syn
* @aspect CreateBCode
* @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1640
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="CreateBCode", declaredAt="/home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1640")
public int stmt_label() {
ASTState state = state();
if (stmt_label_computed == ASTState.NON_CYCLE || stmt_label_computed == state().cycle()) {
return stmt_label_value;
}
stmt_label_value = hostType().constantPool().newLabel();
if (state().inCircle()) {
stmt_label_computed = state().cycle();
} else {
stmt_label_computed = ASTState.NON_CYCLE;
}
return stmt_label_value;
}
/**
* @attribute syn
* @aspect CreateBCode
* @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1698
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="CreateBCode", declaredAt="/home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1698")
public int break_label() {
int break_label_value = end_label();
return break_label_value;
}
/**
* @attribute syn
* @aspect CreateBCode
* @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1723
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="CreateBCode", declaredAt="/home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1723")
public int continue_label() {
int continue_label_value = cond_label();
return continue_label_value;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:523
* @apilevel internal
*/
public boolean Define_insideLoop(ASTNode _callerNode, ASTNode _childNode) {
if (getStmtNoTransform() != null && _callerNode == getStmt()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:528
return true;
}
else {
return getParent().Define_insideLoop(this, _callerNode);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:523
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute insideLoop
*/
protected boolean canDefine_insideLoop(ASTNode _callerNode, ASTNode _childNode) {
return true;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/UnreachableStatements.jrag:49
* @apilevel internal
*/
public boolean Define_reachable(ASTNode _callerNode, ASTNode _childNode) {
if (getStmtNoTransform() != null && _callerNode == getStmt()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/UnreachableStatements.jrag:133
return reachable() && !getCondition().isFalse();
}
else {
return getParent().Define_reachable(this, _callerNode);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/UnreachableStatements.jrag:49
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute reachable
*/
protected boolean canDefine_reachable(ASTNode _callerNode, ASTNode _childNode) {
return true;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/UnreachableStatements.jrag:207
* @apilevel internal
*/
public boolean Define_reportUnreachable(ASTNode _callerNode, ASTNode _childNode) {
if (getStmtNoTransform() != null && _callerNode == getStmt()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/UnreachableStatements.jrag:213
return reachable();
}
else {
return getParent().Define_reportUnreachable(this, _callerNode);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/UnreachableStatements.jrag:207
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute reportUnreachable
*/
protected boolean canDefine_reportUnreachable(ASTNode _callerNode, ASTNode _childNode) {
return true;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/BranchTarget.jrag:230
* @apilevel internal
*/
public Stmt Define_branchTarget(ASTNode _callerNode, ASTNode _childNode, Stmt branch) {
int childIndex = this.getIndexOfChild(_callerNode);
return branch.canBranchTo(this) ? this : branchTarget(branch);
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/BranchTarget.jrag:230
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute branchTarget
*/
protected boolean canDefine_branchTarget(ASTNode _callerNode, ASTNode _childNode, Stmt branch) {
return true;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:256
* @apilevel internal
*/
public boolean Define_assignedBefore(ASTNode _callerNode, ASTNode _childNode, Variable v) {
if (getStmtNoTransform() != null && _callerNode == getStmt()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:752
return getCondition().assignedAfterTrue(v);
}
else if (getConditionNoTransform() != null && _callerNode == getCondition()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:750
return assignedBefore(v);
}
else {
return getParent().Define_assignedBefore(this, _callerNode, v);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:256
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute assignedBefore
*/
protected boolean canDefine_assignedBefore(ASTNode _callerNode, ASTNode _childNode, Variable v) {
return true;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:887
* @apilevel internal
*/
public boolean Define_unassignedBefore(ASTNode _callerNode, ASTNode _childNode, Variable v) {
if (getStmtNoTransform() != null && _callerNode == getStmt()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:1434
return getCondition().unassignedAfterTrue(v);
}
else if (getConditionNoTransform() != null && _callerNode == getCondition()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:1414
return unassignedBeforeCondition(v);
}
else {
return getParent().Define_unassignedBefore(this, _callerNode, v);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:887
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute unassignedBefore
*/
protected boolean canDefine_unassignedBefore(ASTNode _callerNode, ASTNode _childNode, Variable v) {
return true;
}
/** @apilevel internal */
public ASTNode rewriteTo() {
return super.rewriteTo();
}
/** @apilevel internal */
public boolean canRewrite() {
return false;
}
/** @apilevel internal */
protected void collect_contributors_CompilationUnit_problems(CompilationUnit _root, java.util.Map> _map) {
// @declaredat /home/jesper/git/extendj/java4/frontend/TypeCheck.jrag:439
if (!getCondition().type().isBoolean()) {
{
java.util.Set contributors = _map.get(_root);
if (contributors == null) {
contributors = new java.util.LinkedHashSet();
_map.put((ASTNode) _root, contributors);
}
contributors.add(this);
}
}
super.collect_contributors_CompilationUnit_problems(_root, _map);
}
/** @apilevel internal */
protected void contributeTo_CompilationUnit_problems(LinkedList collection) {
super.contributeTo_CompilationUnit_problems(collection);
if (!getCondition().type().isBoolean()) {
collection.add(errorf("the type of \"%s\" is %s which is not boolean",
getCondition().prettyPrint(), getCondition().type().name()));
}
}
}