edu.cmu.cs.crystal.tac.eclipse
Class EclipseTAC

java.lang.Object
  extended by edu.cmu.cs.crystal.tac.eclipse.EclipseTAC
All Implemented Interfaces:
IEclipseVariableQuery

public class EclipseTAC
extends Object
implements IEclipseVariableQuery

This class converts AST nodes from a single method to TAC instructions. A separate instance of this class is required for each method.

Author:
Kevin Bierhoff
See Also:
CompilationUnitTACs.getMethodTAC(MethodDeclaration)

Method Summary
 ThisVariable implicitThisVariable(IBinding accessedElement)
          Determines the implicit this variable for a method call or field access.
 TACInstruction instruction(ASTNode astNode)
          Instruction for a given AST Node.
static boolean isDefaultBinding(IBinding binding)
           
static boolean isStaticBinding(IBinding binding)
           
 ITypeBinding resolveThisType()
          Returns the type of this, if any.
 SourceVariable sourceVariable(IVariableBinding binding)
          Determines the variable for the given parameter or local variable binding.
 SuperVariable superVariable(Name qualifier)
          Determines the super variable, taking a possible qualifier into account.
 ThisVariable thisVariable()
          Returns the represented method's (unqualified) this.
 TypeVariable typeVariable(ITypeBinding binding)
          Determines the variable for a given type binding.
 Variable variable(ASTNode astNode)
          Returns the variable representing the result of evaluating the given AST node.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instruction

public TACInstruction instruction(ASTNode astNode)
Instruction for a given AST Node.

Parameters:
astNode -
Returns:
Instruction object for a given ASTNode, or null if none exists.

variable

public Variable variable(ASTNode astNode)
Description copied from interface: IEclipseVariableQuery
Returns the variable representing the result of evaluating the given AST node.

Specified by:
variable in interface IEclipseVariableQuery
Parameters:
astNode - Must be a node that evaluates to a value (usually an Expression.
Returns:
the variable representing the result of evaluating the given AST node.

sourceVariable

public SourceVariable sourceVariable(IVariableBinding binding)
Description copied from interface: IEclipseVariableQuery
Determines the variable for the given parameter or local variable binding.

Specified by:
sourceVariable in interface IEclipseVariableQuery
Parameters:
binding - Binding for a parameter or local variable.
Returns:
Variable for the given local variable binding.

typeVariable

public TypeVariable typeVariable(ITypeBinding binding)
Description copied from interface: IEclipseVariableQuery
Determines the variable for a given type binding.

Specified by:
typeVariable in interface IEclipseVariableQuery
Parameters:
binding - Type binding.
Returns:
Variable for the given type binding.

thisVariable

public ThisVariable thisVariable()
Returns the represented method's (unqualified) this.

Specified by:
thisVariable in interface IEclipseVariableQuery
Returns:
the represented method's (unqualified) this.

implicitThisVariable

public ThisVariable implicitThisVariable(IBinding accessedElement)
Description copied from interface: IEclipseVariableQuery
Determines the implicit this variable for a method call or field access.

Specified by:
implicitThisVariable in interface IEclipseVariableQuery
Parameters:
accessedElement - The element being accessed with an implicit this. Must be a IMethodBinding for a method or constructor or a IVariableBinding for a field.
Returns:
Implicit this variable for a method call or field access.

resolveThisType

public ITypeBinding resolveThisType()
Returns the type of this, if any.

Returns:
the type of this or null if this is a static method.

isStaticBinding

public static boolean isStaticBinding(IBinding binding)

isDefaultBinding

public static boolean isDefaultBinding(IBinding binding)

superVariable

public SuperVariable superVariable(Name qualifier)
Description copied from interface: IEclipseVariableQuery
Determines the super variable, taking a possible qualifier into account.

Specified by:
superVariable in interface IEclipseVariableQuery
Parameters:
qualifier - Qualifier for super access; null for unqualified super.
Returns:
super variable for the given qualifier.