You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ChocoPy/src/main/java/chocopy/common/codegen/GlobalVarInfo.java

29 lines
910 B

package chocopy.common.codegen;
import chocopy.common.analysis.types.ValueType;
import chocopy.common.astnodes.Literal;
/** Code-generation related information about a global variable. */
public class GlobalVarInfo extends VarInfo {
/**
* This variable resides in static storage tagged with LABEL. The label is prepended with "$" to
* prevent name clashes.
*/
protected final Label label;
/**
* A descriptor for a global variable named VARNAME of type VARTYPE whose initial value is
* labeled with INITIALVALUE (null if no initialization value).
*/
public GlobalVarInfo(String varName, ValueType varType, Literal initialValue) {
super(varName, varType, initialValue);
this.label = new Label(String.format("$%s", varName));
}
/** Return the code location of this variable. */
public Label getLabel() {
return label;
}
}