net.janino
Class Java.AmbiguousName

java.lang.Object
  |
  +--net.janino.Java.Located
        |
        +--net.janino.Java.Atom
              |
              +--net.janino.Java.Rvalue
                    |
                    +--net.janino.Java.Lvalue
                          |
                          +--net.janino.Java.AmbiguousName
All Implemented Interfaces:
Java.Locatable
Enclosing class:
Java

public static class Java.AmbiguousName
extends Java.Lvalue

This class is special: It does not extend/implement the Atom subclasses, but overrides Atom's "to...()" methods.


Fields inherited from class net.janino.Java.Rvalue
CONSTANT_VALUE_NULL, JUMP_IF_FALSE, JUMP_IF_TRUE
 
Constructor Summary
Java.AmbiguousName(Scanner.Location location, Java.Scope scope, java.lang.String[] identifiers)
           
Java.AmbiguousName(Scanner.Location location, Java.Scope scope, java.lang.String[] identifiers, int n)
           
 
Method Summary
 int compileContext()
          Generates code that determines the context of the Java.Rvalue and puts it on the operand stack.
 IClass compileGet()
          Generates code that determines the value of the Java.Rvalue and puts it on the operand stack.
 void compileSet(IClass valueType, java.lang.Object optionalConstantValue)
          Generates code that stores a value in the Java.Lvalue.
 java.lang.Object getConstantValue()
          Attempts to evaluate as a constant expression.
 IClass getType()
           
 boolean isType()
           
 java.lang.String toString()
           
 Java.Type toType()
           
 
Methods inherited from class net.janino.Java.Lvalue
toLvalue
 
Methods inherited from class net.janino.Java.Rvalue
compile, compileBoolean, compileGetValue, getNegatedConstantValue, toRvalue
 
Methods inherited from class net.janino.Java.Atom
addConstantFloatInfo, addConstantIntegerInfo, addConstantStringInfo, allocateLocalVariable, compileError, createDummyCodeAttribute, getLocation, newInserter, newOffset, newUnsetOffset, popInserter, pushInserter, restoreLocalVariables, saveLocalVariables, throwParseException, toLvalueOrCE, toLvalueOrPE, toRvalueOrCE, toRvalueOrPE, toTypeOrCE, toTypeOrPE, write, writeBranch, writeByte, writeConstantClassInfo, writeConstantDoubleInfo, writeConstantFieldrefInfo, writeConstantFloatInfo, writeConstantIntegerInfo, writeConstantInterfaceMethodrefInfo, writeConstantLongInfo, writeConstantMethodrefInfo, writeConstantStringInfo, writeInt, writeOffset, writeOpcode, writeShort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Java.AmbiguousName

public Java.AmbiguousName(Scanner.Location location,
                          Java.Scope scope,
                          java.lang.String[] identifiers)

Java.AmbiguousName

public Java.AmbiguousName(Scanner.Location location,
                          Java.Scope scope,
                          java.lang.String[] identifiers,
                          int n)
Method Detail

toType

public Java.Type toType()
Overrides:
toType in class Java.Atom

getType

public IClass getType()
               throws Java.CompileException
Overrides:
getType in class Java.Atom

isType

public boolean isType()
               throws Java.CompileException
Overrides:
isType in class Java.Atom

compileContext

public int compileContext()
                   throws Java.CompileException
Description copied from class: Java.Rvalue
Generates code that determines the context of the Java.Rvalue and puts it on the operand stack. Most expressions do not have a "context", but some do. E.g. for "x[y]", the context is "x, y". The bottom line is that for statements like "x[y] += 3" the context is only evaluated once.
Overrides:
compileContext in class Java.Rvalue
Following copied from class: net.janino.Java.Rvalue
Returns:
The size of the context on the operand stack

compileGet

public IClass compileGet()
                  throws Java.CompileException
Description copied from class: Java.Rvalue
Generates code that determines the value of the Java.Rvalue and puts it on the operand stack. This method relies on that the "context" of the Java.Rvalue is on top of the operand stack (see Java.Rvalue.compileContext()).
Overrides:
compileGet in class Java.Rvalue
Following copied from class: net.janino.Java.Rvalue
Returns:
The type of the Java.Rvalue

getConstantValue

public java.lang.Object getConstantValue()
                                  throws Java.CompileException
Description copied from class: Java.Rvalue
Attempts to evaluate as a constant expression.

Expression typeReturn value type
StringString
byteByte
shortChort
intInteger
booleanBoolean
charCharacter
floatFloat
longLong
doubleDouble
nullJava.Rvalue.CONSTANT_VALUE_NULL

Overrides:
getConstantValue in class Java.Rvalue

compileSet

public void compileSet(IClass valueType,
                       java.lang.Object optionalConstantValue)
                throws Java.CompileException
Description copied from class: Java.Lvalue
Generates code that stores a value in the Java.Lvalue. Expects the Java.Lvalue's context (see Java.Rvalue.compileContext()) and a value of type "valueType" on the operand stack.

If optionalConstantValue is not null, then the stack top value is identical to it; this allows for "primitive constant assignment conversion" (JLS 5.2).

Overrides:
compileSet in class Java.Lvalue

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object