| java.lang.Object gnu.expr.Declaration
Declaration | public class Declaration implements SourceLocator(Code) | | The static information associated with a local variable binding.
author: Per Bothner author: These are the kinds of Declaration we use: author: A local variable that is not captured by an inner lambda is stored author: in a Java local variables slot (register). The predicate isSimple () author: is true, and offset is the number of the local variable slot. author: If a local variable is captured by an inner lambda, the author: variable is stored in a field of the LambdaExp's heapFrame variable. author: (The latter declaration has isSimple and isArtificial true.) author: The Declaration's field specifies the Field used. author: If a function takes a fixed number of parameters, at most four, author: then the arguments are passed in Java registers 1..4. author: If a parameter is not captured by an inner lambda, the parameter author: has the flags isSimple and isParameter true. author: If a function takes more than 4 or a variable number of parameters, author: the arguments are passed in an array (using the applyN virtual method). author: This array is referenced by the argsArray declaration, which has author: isSimple(), isParameter(), and isArtificial() true, and its offset is 1. author: The parameters are copied into the program-named variables by the author: procedure prologue, so the parameters henceforth act like local variables. |
Field Summary | |
final static int | CAN_CALL | final static int | CAN_READ | final static int | CAN_WRITE | final public static int | EARLY_INIT Initialize in
/
rather than in
run /
$run$ >. | final public static int | EXPORT_SPECIFIED | final public static int | EXTERNAL_ACCESS This flag bit is set if this can be be acceessed from other modules.
Ignored unless PRIVATE.
Used when an exported macro references a non-exported name. | final public static int | FIELD_OR_METHOD True if this is a field or method in a class definition. | final static int | INDIRECT_BINDING If this flag is set then to get the actual value you have to dereference
a gnu.mapping.Location . | final public static int | IS_ALIAS | final public static int | IS_CONSTANT | final public static int | IS_DYNAMIC | final static int | IS_FLUID | final public static int | IS_IMPORTED | final public static int | IS_NAMESPACE_PREFIX Set if this declares a namespace prefix (as in XML namespaces). | final static int | IS_SIMPLE | final public static int | IS_SINGLE_VALUE | final public static int | IS_SYNTAX | final public static int | IS_UNKNOWN | final public static int | MODULE_REFERENCE A reference to a module instance. | final public static int | NONSTATIC_SPECIFIED | final public static int | NOT_DEFINING Set if this is just a declaration, not a definition. | final public static int | PACKAGE_ACCESS | final static int | PRIVATE | final public static int | PRIVATE_ACCESS | final public static String | PRIVATE_PREFIX This prefix is used in field names for a declaration that has
both EXTERNAL_ACCESS and IS_PRIVATE set. | final public static int | PRIVATE_SPECIFIED | final static int | PROCEDURE True if in the function namespace, for languages that distinguishes them.
I.e. | final public static int | PROTECTED_ACCESS | final public static int | PUBLIC_ACCESS | final public static int | STATIC_SPECIFIED | final public static int | TYPE_SPECIFIED | final static String | UNKNOWN_PREFIX This prefix is prepended to field names for unknown names. | public Declaration | base If non-null, field is relative to base.
If IS_FLUID, base points to IS_UNKNOWN Symbol. | public ScopeExp | context | static int | counter | int | evalIndex Index in evalFrame for this scope, if interpreting. | public Field | field | String | filename | public ApplyExp | firstCall List of ApplyExp where this declaration is the function called.
The applications are chained using their nextCall fields.
The chain is not built if STATIC_SPECIFIED. | protected int | flags | protected int | id Unique id number, to ease print-outs and debugging.
If negative, a code to specify a builtin function. | Method | makeLocationMethod | Declaration | next | Declaration | nextCapturedVar Used to link Declarations in a LambdaExp's capturedVars list. | int | position | Object | symbol The name of the new variable, either an interned String or a Symbol.
This is the source-level (non-mangled) name. | protected Type | type | protected Expression | typeExp | protected Expression | value If non-null, the single expression used to set this variable.
If the variable can be set more than once, then value is null. | Variable | var |
Method Summary | |
final public Variable | allocateVariable(CodeAttr code) | public void | compileStore(Compilation comp) | public static Declaration | followAliases(Declaration decl) | public short | getAccessFlags(short defaultFlags) | final public boolean | getCanCall() | final public boolean | getCanRead() | final public boolean | getCanWrite() | public int | getCode() | final public int | getColumnNumber() | final public Object | getConstantValue() If getValue() is a constant, return the constant value, otherwise null. | final public ScopeExp | getContext() Return the ScopeExp that contains (declares) this Declaration. | public static Declaration | getDeclaration(Named proc) | public static Declaration | getDeclaration(Object proc, String name) | public static Declaration | getDeclarationFromStatic(String cname, String fname) Create a declaration corresponding to a static field. | public static Declaration | getDeclarationValueFromStatic(String className, String fieldName, String name) Similar to
getDeclarationFromStatic ,
but also do
noteValue with the field's value. | final public String | getFileName() | final public boolean | getFlag(int flag) | final public int | getLineNumber() Get the line number of (the start of) this Expression.
The "first" line is line 1; unknown is -1. | final public String | getName() | public String | getPublicId() | final public Object | getSymbol() | public String | getSystemId() | final public Type | getType() | final public Expression | getTypeExp() | final public Expression | getValue() The value of this Declaration , if known.
Usually the expression used to initialize the Declaration ,
or null if the Declaration can be assigned a different
value after initialization. | public Variable | getVariable() | public boolean | ignorable() True if we never need to access this declaration. | final public boolean | isAlias() | final public boolean | isFluid() True if this is a fluid binding (in a FluidLetExp). | final public boolean | isIndirectBinding() True if the value of the variable is the contents of a Location. | final public boolean | isLexical() | final public boolean | isNamespaceDecl() | final public boolean | isPrivate() | final public boolean | isProcedureDecl() | final public boolean | isPublic() | final public boolean | isSimple() | public boolean | isStableSourceLocation() | public boolean | isStatic() | final public boolean | isThisParameter() | final public static boolean | isUnknown(Declaration decl) | public void | load(AccessExp access, int flags, Compilation comp, Target target) | void | loadOwningObject(Declaration owner, Compilation comp) If this is a field in some object, load a reference to that object. | public void | makeField(Compilation comp, Expression value) | public void | makeField(ClassType frameType, Compilation comp, Expression value) | gnu.mapping.Location | makeIndirectLocationFor() | final public boolean | needsContext() If we need a 'context' supplied from a ReferenceExp or 'this. | final public boolean | needsExternalAccess() | public boolean | needsInit() | final public Declaration | nextDecl() | public void | noteValue(Expression value) | public void | printInfo(OutPort out) | public void | printInfo(StringBuffer sbuf) | public void | pushIndirectBinding(Compilation comp) Create a Location object, given that isIndirectBinding().
Assume the initial value is already pushed on the stack;
leaves initialized Location object on stack. | final public void | setAlias(boolean flag) | final public void | setCanCall(boolean called) | final public void | setCanCall() | final public void | setCanRead(boolean read) | final public void | setCanRead() | final public void | setCanWrite(boolean written) | final public void | setCanWrite() | public void | setCode(int code) | final public void | setFile(String filename) | final public void | setFlag(boolean setting, int flag) | final public void | setFlag(int flag) | final public void | setFluid(boolean fluid) | final public void | setIndirectBinding(boolean indirectBinding) Note that the value of the variable is the contents of a Location. | final public void | setLine(int lineno, int colno) | final public void | setLine(int lineno) | final public void | setLocation(SourceLocator location) | final public void | setName(Object symbol) | final public void | setNext(Declaration next) | final public void | setPrivate(boolean isPrivate) | final public void | setProcedureDecl(boolean val) | final public void | setSimple(boolean b) | final public void | setSymbol(Object symbol) | final public void | setSyntax() | final public void | setType(Type type) | final public void | setTypeExp(Expression typeExp) | final public void | setValue(Expression value) Set the value assoociated with this Declaration.
Most code should use noteValue instead. | public String | toString() |
CAN_CALL | final static int CAN_CALL(Code) | | |
CAN_READ | final static int CAN_READ(Code) | | |
CAN_WRITE | final static int CAN_WRITE(Code) | | |
EARLY_INIT | final public static int EARLY_INIT(Code) | | Initialize in
/
rather than in
run /
$run$ >.
|
EXPORT_SPECIFIED | final public static int EXPORT_SPECIFIED(Code) | | |
EXTERNAL_ACCESS | final public static int EXTERNAL_ACCESS(Code) | | This flag bit is set if this can be be acceessed from other modules.
Ignored unless PRIVATE.
Used when an exported macro references a non-exported name.
|
FIELD_OR_METHOD | final public static int FIELD_OR_METHOD(Code) | | True if this is a field or method in a class definition.
|
INDIRECT_BINDING | final static int INDIRECT_BINDING(Code) | | If this flag is set then to get the actual value you have to dereference
a gnu.mapping.Location . I.e. this Declaration 's
var or field does not contain the
Declaration 's value directly, but rather yields a
Location that contains the Declaration 's value.
Note that this flag indicates the representation:
The result of getValue() is not the location, but the
semantic value. after dereferencing. Likewise getType is
the value after de-referencing, not a Location sub-class.
|
IS_ALIAS | final public static int IS_ALIAS(Code) | | |
IS_CONSTANT | final public static int IS_CONSTANT(Code) | | |
IS_DYNAMIC | final public static int IS_DYNAMIC(Code) | | |
IS_FLUID | final static int IS_FLUID(Code) | | |
IS_IMPORTED | final public static int IS_IMPORTED(Code) | | |
IS_NAMESPACE_PREFIX | final public static int IS_NAMESPACE_PREFIX(Code) | | Set if this declares a namespace prefix (as in XML namespaces).
|
IS_SIMPLE | final static int IS_SIMPLE(Code) | | |
IS_SINGLE_VALUE | final public static int IS_SINGLE_VALUE(Code) | | |
IS_SYNTAX | final public static int IS_SYNTAX(Code) | | |
IS_UNKNOWN | final public static int IS_UNKNOWN(Code) | | |
MODULE_REFERENCE | final public static int MODULE_REFERENCE(Code) | | A reference to a module instance.
|
NONSTATIC_SPECIFIED | final public static int NONSTATIC_SPECIFIED(Code) | | |
NOT_DEFINING | final public static int NOT_DEFINING(Code) | | Set if this is just a declaration, not a definition.
|
PACKAGE_ACCESS | final public static int PACKAGE_ACCESS(Code) | | |
PRIVATE | final static int PRIVATE(Code) | | |
PRIVATE_ACCESS | final public static int PRIVATE_ACCESS(Code) | | |
PRIVATE_PREFIX | final public static String PRIVATE_PREFIX(Code) | | This prefix is used in field names for a declaration that has
both EXTERNAL_ACCESS and IS_PRIVATE set.
|
PRIVATE_SPECIFIED | final public static int PRIVATE_SPECIFIED(Code) | | |
PROCEDURE | final static int PROCEDURE(Code) | | True if in the function namespace, for languages that distinguishes them.
I.e. a function definition or macro definition.
|
PROTECTED_ACCESS | final public static int PROTECTED_ACCESS(Code) | | |
PUBLIC_ACCESS | final public static int PUBLIC_ACCESS(Code) | | |
STATIC_SPECIFIED | final public static int STATIC_SPECIFIED(Code) | | |
TYPE_SPECIFIED | final public static int TYPE_SPECIFIED(Code) | | |
UNKNOWN_PREFIX | final static String UNKNOWN_PREFIX(Code) | | This prefix is prepended to field names for unknown names.
|
base | public Declaration base(Code) | | If non-null, field is relative to base.
If IS_FLUID, base points to IS_UNKNOWN Symbol.
|
counter | static int counter(Code) | | |
evalIndex | int evalIndex(Code) | | Index in evalFrame for this scope, if interpreting.
|
firstCall | public ApplyExp firstCall(Code) | | List of ApplyExp where this declaration is the function called.
The applications are chained using their nextCall fields.
The chain is not built if STATIC_SPECIFIED.
|
flags | protected int flags(Code) | | |
id | protected int id(Code) | | Unique id number, to ease print-outs and debugging.
If negative, a code to specify a builtin function.
|
nextCapturedVar | Declaration nextCapturedVar(Code) | | Used to link Declarations in a LambdaExp's capturedVars list.
|
symbol | Object symbol(Code) | | The name of the new variable, either an interned String or a Symbol.
This is the source-level (non-mangled) name.
|
value | protected Expression value(Code) | | If non-null, the single expression used to set this variable.
If the variable can be set more than once, then value is null.
|
Declaration | protected Declaration()(Code) | | |
getAccessFlags | public short getAccessFlags(short defaultFlags)(Code) | | |
getCanCall | final public boolean getCanCall()(Code) | | |
getCanRead | final public boolean getCanRead()(Code) | | |
getCanWrite | final public boolean getCanWrite()(Code) | | |
getCode | public int getCode()(Code) | | |
getColumnNumber | final public int getColumnNumber()(Code) | | |
getConstantValue | final public Object getConstantValue()(Code) | | If getValue() is a constant, return the constant value, otherwise null.
|
getContext | final public ScopeExp getContext()(Code) | | Return the ScopeExp that contains (declares) this Declaration.
|
getDeclarationFromStatic | public static Declaration getDeclarationFromStatic(String cname, String fname)(Code) | | Create a declaration corresponding to a static field.
Parameters: cname - name of class containing field Parameters: fname - name of static field |
getDeclarationValueFromStatic | public static Declaration getDeclarationValueFromStatic(String className, String fieldName, String name)(Code) | | Similar to
getDeclarationFromStatic ,
but also do
noteValue with the field's value.
|
getFlag | final public boolean getFlag(int flag)(Code) | | |
getLineNumber | final public int getLineNumber()(Code) | | Get the line number of (the start of) this Expression.
The "first" line is line 1; unknown is -1.
|
getValue | final public Expression getValue()(Code) | | The value of this Declaration , if known.
Usually the expression used to initialize the Declaration ,
or null if the Declaration can be assigned a different
value after initialization. Note that this is the semantic value: If the
INDIRECT_LOCATION is set, then getValue is the
value after de-referencing the resulting Location .
An exception is if isAlias() ; in that case
getValue() is an expression yielding a Location
which needs to be de-referenced to get this Declaration 's
actual value.
|
ignorable | public boolean ignorable()(Code) | | True if we never need to access this declaration.
|
isAlias | final public boolean isAlias()(Code) | | |
isFluid | final public boolean isFluid()(Code) | | True if this is a fluid binding (in a FluidLetExp).
|
isIndirectBinding | final public boolean isIndirectBinding()(Code) | | True if the value of the variable is the contents of a Location.
See Also: Declaration.INDIRECT_BINDING See Also: |
isLexical | final public boolean isLexical()(Code) | | |
isNamespaceDecl | final public boolean isNamespaceDecl()(Code) | | |
isPrivate | final public boolean isPrivate()(Code) | | |
isProcedureDecl | final public boolean isProcedureDecl()(Code) | | |
isPublic | final public boolean isPublic()(Code) | | |
isSimple | final public boolean isSimple()(Code) | | |
isStableSourceLocation | public boolean isStableSourceLocation()(Code) | | |
isStatic | public boolean isStatic()(Code) | | |
isThisParameter | final public boolean isThisParameter()(Code) | | Is this an implicit 'this' parameter?
|
loadOwningObject | void loadOwningObject(Declaration owner, Compilation comp)(Code) | | If this is a field in some object, load a reference to that object.
|
needsContext | final public boolean needsContext()(Code) | | If we need a 'context' supplied from a ReferenceExp or 'this.
|
needsExternalAccess | final public boolean needsExternalAccess()(Code) | | |
needsInit | public boolean needsInit()(Code) | | Does this variable need to be initialized or is default ok
|
pushIndirectBinding | public void pushIndirectBinding(Compilation comp)(Code) | | Create a Location object, given that isIndirectBinding().
Assume the initial value is already pushed on the stack;
leaves initialized Location object on stack.
|
setAlias | final public void setAlias(boolean flag)(Code) | | |
setCanCall | final public void setCanCall(boolean called)(Code) | | |
setCanCall | final public void setCanCall()(Code) | | |
setCanRead | final public void setCanRead(boolean read)(Code) | | |
setCanRead | final public void setCanRead()(Code) | | |
setCanWrite | final public void setCanWrite(boolean written)(Code) | | |
setCanWrite | final public void setCanWrite()(Code) | | |
setCode | public void setCode(int code)(Code) | | |
setFlag | final public void setFlag(boolean setting, int flag)(Code) | | |
setFlag | final public void setFlag(int flag)(Code) | | |
setFluid | final public void setFluid(boolean fluid)(Code) | | |
setIndirectBinding | final public void setIndirectBinding(boolean indirectBinding)(Code) | | Note that the value of the variable is the contents of a Location.
See Also: Declaration.INDIRECT_BINDING See Also: |
setLine | final public void setLine(int lineno, int colno)(Code) | | |
setLine | final public void setLine(int lineno)(Code) | | |
setPrivate | final public void setPrivate(boolean isPrivate)(Code) | | |
setProcedureDecl | final public void setProcedureDecl(boolean val)(Code) | | |
setSimple | final public void setSimple(boolean b)(Code) | | |
setSyntax | final public void setSyntax()(Code) | | |
setValue | final public void setValue(Expression value)(Code) | | Set the value assoociated with this Declaration.
Most code should use noteValue instead.
|
|
|