Package gnu.expr

Class ClassExp

All Implemented Interfaces:
gnu.kawa.format.Printable, Named, SourceLocator, SourceLocator, Locator
Direct Known Subclasses:
ObjectExp

public class ClassExp extends LambdaExp
  • Field Details

    • IS_ABSTRACT

      public static final int IS_ABSTRACT
      See Also:
    • INTERFACE_SPECIFIED

      public static final int INTERFACE_SPECIFIED
      See Also:
    • CLASS_SPECIFIED

      public static final int CLASS_SPECIFIED
      See Also:
    • HAS_SUBCLASS

      public static final int HAS_SUBCLASS
      See Also:
    • IS_PACKAGE_MEMBER

      public static final int IS_PACKAGE_MEMBER
      True if the resulting class(es) are *not* member/inner classes.
      See Also:
    • classNameSpecifier

      public String classNameSpecifier
    • supers

      public Expression[] supers
      List of base classes and implemented interfaces.
    • superClassIndex

      public int superClassIndex
      Index in supers array of class we extend, or -1.
    • initMethod

      public LambdaExp initMethod
      An artificial method named "$finit$" for evaluating non-static initializations. All constructors need to call this.
    • clinitMethod

      public LambdaExp clinitMethod
      An artificial method named "$clinit$" for evaluating static initializations.
  • Constructor Details

    • ClassExp

      public ClassExp(boolean simple, ClassType type)
  • Method Details

    • isSimple

      public boolean isSimple()
    • isAbstract

      public final boolean isAbstract()
      Overrides:
      isAbstract in class LambdaExp
    • isMakingClassPair

      public boolean isMakingClassPair()
      True if we should make a pair of an interface and a class.
    • calculateType

      protected Type calculateType()
      The ClassType generated for this class. Note difference from getClassType: The value of a ClassExp (viewed as an expression) is a class/type object, so getType returns the type of a type.
      Overrides:
      calculateType in class LambdaExp
    • getClassType

      public ClassType getClassType()
      The ClassType generated for this class.
      Overrides:
      getClassType in class LambdaExp
    • setClassType

      public void setClassType(ClassType type)
    • mustCompile

      protected boolean mustCompile()
      Overrides:
      mustCompile in class LambdaExp
    • compile

      public void compile(Compilation comp, Target target)
      Overrides:
      compile in class LambdaExp
    • compilePushClass

      public void compilePushClass(Compilation comp, Target target)
    • getCompiledClassType

      protected ClassType getCompiledClassType(Compilation comp)
      Description copied from class: LambdaExp
      Return the ClassType of the Procedure this is being compiled into.
      Overrides:
      getCompiledClassType in class LambdaExp
    • createFields

      public void createFields(Compilation comp)
      Create a Field in the instanceClass for each declared field. This allows name SlotGet.lookupMember (used in Translator.rewrite when looking for a binding for a symbol) to return a match. Note that if we later (in setTypes) create a pair-type, then the field will be replaced by a getter/setter pair. Later yet (in declareParts): We set the types of the Field or getter/setter pair. We should create tentative Methods for methods in the same manner, but that is is a project for another day.
    • setTypes

      public void setTypes(Compilation comp)
    • getClassName

      public String getClassName(Compilation comp)
    • declareParts

      public void declareParts(Compilation comp)
    • compileMembers

      public ClassType compileMembers(Compilation comp)
    • findMethodForBridge

      protected Method findMethodForBridge(String mname, Type[] ptypes, Type rtype)
      Finds a like-named method suitable for bridging the given arg/return types (i.e. a method whose arg types and return types are subclasses of those given here.
    • generateBridgeMethod

      public final void generateBridgeMethod(Compilation comp, Method src_method, Type[] bridge_arg_types, Type bridge_return_type)
      Given an existing method and a desired bridge method signature, generates an appropriate bridge method.
    • visit

      protected <R, D> R visit(ExpVisitor<R,D> visitor, D d)
      Overrides:
      visit in class LambdaExp
    • visitChildren

      protected <R, D> void visitChildren(ExpVisitor<R,D> visitor, D d)
      Overrides:
      visitChildren in class LambdaExp
    • print

      public void print(gnu.kawa.io.OutPort out)
      Overrides:
      print in class LambdaExp
    • compileSetField

      public Field compileSetField(Compilation comp)
      Overrides:
      compileSetField in class LambdaExp
    • slotToMethodName

      public static String slotToMethodName(String prefix, String sname)
      Mangle a "slot" name to a get- or set- method name.
      Parameters:
      prefix - either "get" or "set" or "add"
      sname - a "slot" (property) name. This is mangled if needed.
    • addMethod

      public Declaration addMethod(LambdaExp lexp, Object mname)