org.extendj.ast.ArrayInit 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:183
* @astdecl ArrayInit : Expr ::= Init:Expr*;
* @production ArrayInit : {@link Expr} ::= Init:{@link Expr}*;
*/
public class ArrayInit extends Expr implements Cloneable {
/**
* @aspect Java4PrettyPrint
* @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrint.jadd:48
*/
public void prettyPrint(PrettyPrinter out) {
out.print("{ ");
out.join(getInitList(), new PrettyPrinter.Joiner() {
@Override
public void printSeparator(PrettyPrinter out) {
out.print(", ");
}
});
out.print(" }");
}
/**
* @aspect CreateBCode
* @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:967
*/
public void createBCode(CodeGeneration gen) {
IntegerLiteral.push(gen, getNumInit());
if (type().componentType().isPrimitive()) {
gen.NEWARRAY(type());
} else {
gen.ANEWARRAY(type());
}
for (int i = 0; i < getNumInit(); i++) {
gen.DUP();
IntegerLiteral.push(gen, i);
getInit(i).createBCode(gen);
if (getInit(i) instanceof ArrayInit) {
gen.AASTORE();
} else {
getInit(i).emitAssignConvTo(gen, expectedType());
expectedType().emitArrayStore(gen);
}
}
}
/**
* @declaredat ASTNode:1
*/
public ArrayInit() {
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[1];
setChild(new List(), 0);
}
/**
* @declaredat ASTNode:14
*/
@ASTNodeAnnotation.Constructor(
name = {"Init"},
type = {"List"},
kind = {"List"}
)
public ArrayInit(List p0) {
setChild(p0, 0);
}
/** @apilevel low-level
* @declaredat ASTNode:23
*/
protected int numChildren() {
return 1;
}
/**
* @apilevel internal
* @declaredat ASTNode:29
*/
public boolean mayHaveRewrite() {
return false;
}
/** @apilevel internal
* @declaredat ASTNode:33
*/
public void flushAttrCache() {
super.flushAttrCache();
type_reset();
computeDABefore_int_Variable_reset();
unassignedAfter_Variable_reset();
computeDUbefore_int_Variable_reset();
declType_reset();
}
/** @apilevel internal
* @declaredat ASTNode:42
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/** @apilevel internal
* @declaredat ASTNode:46
*/
public ArrayInit clone() throws CloneNotSupportedException {
ArrayInit node = (ArrayInit) super.clone();
return node;
}
/** @apilevel internal
* @declaredat ASTNode:51
*/
public ArrayInit copy() {
try {
ArrayInit node = (ArrayInit) 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:70
*/
@Deprecated
public ArrayInit 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:80
*/
public ArrayInit treeCopyNoTransform() {
ArrayInit tree = (ArrayInit) 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:100
*/
public ArrayInit treeCopy() {
ArrayInit tree = (ArrayInit) 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:114
*/
protected boolean is$Equal(ASTNode node) {
return super.is$Equal(node);
}
/**
* Replaces the Init list.
* @param list The new list node to be used as the Init list.
* @apilevel high-level
*/
public void setInitList(List list) {
setChild(list, 0);
}
/**
* Retrieves the number of children in the Init list.
* @return Number of children in the Init list.
* @apilevel high-level
*/
public int getNumInit() {
return getInitList().getNumChild();
}
/**
* Retrieves the number of children in the Init list.
* Calling this method will not trigger rewrites.
* @return Number of children in the Init list.
* @apilevel low-level
*/
public int getNumInitNoTransform() {
return getInitListNoTransform().getNumChildNoTransform();
}
/**
* Retrieves the element at index {@code i} in the Init list.
* @param i Index of the element to return.
* @return The element at position {@code i} in the Init list.
* @apilevel high-level
*/
public Expr getInit(int i) {
return (Expr) getInitList().getChild(i);
}
/**
* Check whether the Init list has any children.
* @return {@code true} if it has at least one child, {@code false} otherwise.
* @apilevel high-level
*/
public boolean hasInit() {
return getInitList().getNumChild() != 0;
}
/**
* Append an element to the Init list.
* @param node The element to append to the Init list.
* @apilevel high-level
*/
public void addInit(Expr node) {
List list = (parent == null) ? getInitListNoTransform() : getInitList();
list.addChild(node);
}
/** @apilevel low-level
*/
public void addInitNoTransform(Expr node) {
List list = getInitListNoTransform();
list.addChild(node);
}
/**
* Replaces the Init list element at index {@code i} with the new node {@code node}.
* @param node The new node to replace the old list element.
* @param i The list index of the node to be replaced.
* @apilevel high-level
*/
public void setInit(Expr node, int i) {
List list = getInitList();
list.setChild(node, i);
}
/**
* Retrieves the Init list.
* @return The node representing the Init list.
* @apilevel high-level
*/
@ASTNodeAnnotation.ListChild(name="Init")
public List getInitList() {
List list = (List) getChild(0);
return list;
}
/**
* Retrieves the Init list.
* This method does not invoke AST transformations.
* @return The node representing the Init list.
* @apilevel low-level
*/
public List getInitListNoTransform() {
return (List) getChildNoTransform(0);
}
/**
* @return the element at index {@code i} in the Init list without
* triggering rewrites.
*/
public Expr getInitNoTransform(int i) {
return (Expr) getInitListNoTransform().getChildNoTransform(i);
}
/**
* Retrieves the Init list.
* @return The node representing the Init list.
* @apilevel high-level
*/
public List getInits() {
return getInitList();
}
/**
* Retrieves the Init list.
* This method does not invoke AST transformations.
* @return The node representing the Init list.
* @apilevel low-level
*/
public List getInitsNoTransform() {
return getInitListNoTransform();
}
/** @apilevel internal */
private void type_reset() {
type_computed = null;
type_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle type_computed = null;
/** @apilevel internal */
protected TypeDecl type_value;
/**
* @attribute syn
* @aspect TypeAnalysis
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:296
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeAnalysis", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:296")
public TypeDecl type() {
ASTState state = state();
if (type_computed == ASTState.NON_CYCLE || type_computed == state().cycle()) {
return type_value;
}
type_value = declType();
if (state().inCircle()) {
type_computed = state().cycle();
} else {
type_computed = ASTState.NON_CYCLE;
}
return type_value;
}
/**
* @attribute syn
* @aspect TypeCheck
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeCheck.jrag:188
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeCheck.jrag:188")
public Collection typeProblems() {
{
Collection problems = new LinkedList();
TypeDecl initializerType = declType().componentType();
if (initializerType.isUnknown()) {
problems.add(error("the dimension of the initializer is larger than the expected dimension"));
}
for (int i = 0; i < getNumInit(); i++) {
Expr e = getInit(i);
if (!e.type().assignConversionTo(initializerType, e)) {
problems.add(errorf("the type %s of the initializer is not compatible with %s",
e.type().name(), initializerType.name()));
}
}
return problems;
}
}
/**
* representableIn(T) is true if and only if the the expression is a
* compile-time constant of type byte, char, short or int, and the value
* of the expression can be represented (by an expression) in the type T
* where T must be byte, char or short.
* @attribute syn
* @aspect ConstantExpression
* @declaredat /home/jesper/git/extendj/java4/frontend/ConstantExpression.jrag:328
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="ConstantExpression", declaredAt="/home/jesper/git/extendj/java4/frontend/ConstantExpression.jrag:328")
public boolean representableIn(TypeDecl t) {
{
for (int i = 0; i < getNumInit(); i++) {
if (!getInit(i).representableIn(t)) {
return false;
}
}
return true;
}
}
/**
* @attribute syn
* @aspect DefiniteAssignment
* @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:268
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="DefiniteAssignment", declaredAt="/home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:268")
public boolean assignedAfter(Variable v) {
boolean assignedAfter_Variable_value = getNumInit() == 0
? assignedBefore(v)
: getInit(getNumInit()-1).assignedAfter(v);
return assignedAfter_Variable_value;
}
/** @apilevel internal */
private void computeDABefore_int_Variable_reset() {
computeDABefore_int_Variable_values = null;
}
protected java.util.Map computeDABefore_int_Variable_values;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="DefiniteAssignment", declaredAt="/home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:649")
public boolean computeDABefore(int childIndex, Variable v) {
java.util.List _parameters = new java.util.ArrayList(2);
_parameters.add(childIndex);
_parameters.add(v);
if (computeDABefore_int_Variable_values == null) computeDABefore_int_Variable_values = new java.util.HashMap(4);
ASTState.CircularValue _value;
if (computeDABefore_int_Variable_values.containsKey(_parameters)) {
Object _cache = computeDABefore_int_Variable_values.get(_parameters);
if (!(_cache instanceof ASTState.CircularValue)) {
return (Boolean) _cache;
} else {
_value = (ASTState.CircularValue) _cache;
}
} else {
_value = new ASTState.CircularValue();
computeDABefore_int_Variable_values.put(_parameters, _value);
_value.value = true;
}
ASTState state = state();
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
boolean new_computeDABefore_int_Variable_value;
do {
_value.cycle = state.nextCycle();
new_computeDABefore_int_Variable_value = computeDABefore_compute(childIndex, v);
if (((Boolean)_value.value) != new_computeDABefore_int_Variable_value) {
state.setChangeInCycle();
_value.value = new_computeDABefore_int_Variable_value;
}
} while (state.testAndClearChangeInCycle());
computeDABefore_int_Variable_values.put(_parameters, new_computeDABefore_int_Variable_value);
state.leaveCircle();
return new_computeDABefore_int_Variable_value;
} else if (_value.cycle != state.cycle()) {
_value.cycle = state.cycle();
boolean new_computeDABefore_int_Variable_value = computeDABefore_compute(childIndex, v);
if (((Boolean)_value.value) != new_computeDABefore_int_Variable_value) {
state.setChangeInCycle();
_value.value = new_computeDABefore_int_Variable_value;
}
return new_computeDABefore_int_Variable_value;
} else {
return (Boolean) _value.value;
}
}
/** @apilevel internal */
private boolean computeDABefore_compute(int childIndex, Variable v) {
if (childIndex == 0) {
return assignedBefore(v);
}
int index = childIndex-1;
while (index > 0 && getInit(index).isConstant()) {
index--;
}
return getInit(childIndex-1).assignedAfter(v);
}
/** @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:899")
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 = getNumInit() == 0 ? unassignedBefore(v) : getInit(getNumInit()-1).unassignedAfter(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 = getNumInit() == 0 ? unassignedBefore(v) : getInit(getNumInit()-1).unassignedAfter(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 void computeDUbefore_int_Variable_reset() {
computeDUbefore_int_Variable_values = null;
}
protected java.util.Map computeDUbefore_int_Variable_values;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="DefiniteUnassignment", declaredAt="/home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:1196")
public boolean computeDUbefore(int childIndex, Variable v) {
java.util.List _parameters = new java.util.ArrayList(2);
_parameters.add(childIndex);
_parameters.add(v);
if (computeDUbefore_int_Variable_values == null) computeDUbefore_int_Variable_values = new java.util.HashMap(4);
ASTState.CircularValue _value;
if (computeDUbefore_int_Variable_values.containsKey(_parameters)) {
Object _cache = computeDUbefore_int_Variable_values.get(_parameters);
if (!(_cache instanceof ASTState.CircularValue)) {
return (Boolean) _cache;
} else {
_value = (ASTState.CircularValue) _cache;
}
} else {
_value = new ASTState.CircularValue();
computeDUbefore_int_Variable_values.put(_parameters, _value);
_value.value = true;
}
ASTState state = state();
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
boolean new_computeDUbefore_int_Variable_value;
do {
_value.cycle = state.nextCycle();
new_computeDUbefore_int_Variable_value = computeDUbefore_compute(childIndex, v);
if (((Boolean)_value.value) != new_computeDUbefore_int_Variable_value) {
state.setChangeInCycle();
_value.value = new_computeDUbefore_int_Variable_value;
}
} while (state.testAndClearChangeInCycle());
computeDUbefore_int_Variable_values.put(_parameters, new_computeDUbefore_int_Variable_value);
state.leaveCircle();
return new_computeDUbefore_int_Variable_value;
} else if (_value.cycle != state.cycle()) {
_value.cycle = state.cycle();
boolean new_computeDUbefore_int_Variable_value = computeDUbefore_compute(childIndex, v);
if (((Boolean)_value.value) != new_computeDUbefore_int_Variable_value) {
state.setChangeInCycle();
_value.value = new_computeDUbefore_int_Variable_value;
}
return new_computeDUbefore_int_Variable_value;
} else {
return (Boolean) _value.value;
}
}
/** @apilevel internal */
private boolean computeDUbefore_compute(int childIndex, Variable v) {
if (childIndex == 0) {
return unassignedBefore(v);
}
int index = childIndex-1;
while (index > 0 && getInit(index).isConstant()) {
index--;
}
return getInit(childIndex-1).unassignedAfter(v);
}
/**
* @attribute inh
* @aspect TypeAnalysis
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:277
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH)
@ASTNodeAnnotation.Source(aspect="TypeAnalysis", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:277")
public TypeDecl declType() {
ASTState state = state();
if (declType_computed == ASTState.NON_CYCLE || declType_computed == state().cycle()) {
return declType_value;
}
declType_value = getParent().Define_declType(this, null);
if (state().inCircle()) {
declType_computed = state().cycle();
} else {
declType_computed = ASTState.NON_CYCLE;
}
return declType_value;
}
/** @apilevel internal */
private void declType_reset() {
declType_computed = null;
declType_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle declType_computed = null;
/** @apilevel internal */
protected TypeDecl declType_value;
/**
* @attribute inh
* @aspect InnerClasses
* @declaredat /home/jesper/git/extendj/java4/backend/InnerClasses.jrag:104
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH)
@ASTNodeAnnotation.Source(aspect="InnerClasses", declaredAt="/home/jesper/git/extendj/java4/backend/InnerClasses.jrag:104")
public TypeDecl expectedType() {
TypeDecl expectedType_value = getParent().Define_expectedType(this, null);
return expectedType_value;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:277
* @apilevel internal
*/
public TypeDecl Define_declType(ASTNode _callerNode, ASTNode _childNode) {
if (_callerNode == getInitListNoTransform()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:284
int childIndex = _callerNode.getIndexOfChild(_childNode);
return declType().componentType();
}
else {
return getParent().Define_declType(this, _callerNode);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:277
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute declType
*/
protected boolean canDefine_declType(ASTNode _callerNode, ASTNode _childNode) {
return true;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:44
* @apilevel internal
*/
public boolean Define_isSource(ASTNode _callerNode, ASTNode _childNode) {
if (_callerNode == getInitListNoTransform()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:59
int childIndex = _callerNode.getIndexOfChild(_childNode);
return true;
}
else {
return getParent().Define_isSource(this, _callerNode);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:44
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute isSource
*/
protected boolean canDefine_isSource(ASTNode _callerNode, ASTNode _childNode) {
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 (_callerNode == getInitListNoTransform()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:647
int childIndex = _callerNode.getIndexOfChild(_childNode);
return computeDABefore(childIndex, 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 (_callerNode == getInitListNoTransform()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:1194
int childIndex = _callerNode.getIndexOfChild(_childNode);
return computeDUbefore(childIndex, 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;
}
/**
* @declaredat /home/jesper/git/extendj/java4/backend/InnerClasses.jrag:104
* @apilevel internal
*/
public TypeDecl Define_expectedType(ASTNode _callerNode, ASTNode _childNode) {
if (_callerNode == getInitListNoTransform()) {
// @declaredat /home/jesper/git/extendj/java4/backend/InnerClasses.jrag:110
int childIndex = _callerNode.getIndexOfChild(_childNode);
return expectedType().componentType();
}
else {
return getParent().Define_expectedType(this, _callerNode);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/backend/InnerClasses.jrag:104
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute expectedType
*/
protected boolean canDefine_expectedType(ASTNode _callerNode, ASTNode _childNode) {
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:186
{
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);
for (Problem value : typeProblems()) {
collection.add(value);
}
}
}