Class CompileBuildObject

java.lang.Object
gnu.kawa.reflect.CompileBuildObject
Direct Known Subclasses:
LangObjType.SimpleVectorBuilder

public class CompileBuildObject extends Object
Support for custom class-specific compile-time object builders. This class as-is supports compiling the Scheme form:
 (TYPE carg1 ... cargK key1: karg1 ... keyL: kargL carg1 ... cargM)
 
to:
 tmp = new TYPE(carg1, ..., cargK);
 tmp.setKey1(karg1);
 ...
 tmp.setKeyM(kargM);
 tmp.add(carg1);
 ...
 tmp.add(cargM);
 return tmp;
 
Methods in this class can be overridden in various ways to provide custom mappings. This is a work in progress.
  • Constructor Details

    • CompileBuildObject

      public CompileBuildObject()
  • Method Details

    • getCompilation

      public Compilation getCompilation()
    • getLanguage

      public Language getLanguage()
    • getResultType

      public ObjectType getResultType()
    • resultTypeExtends

      public boolean resultTypeExtends(ObjectType other)
    • resultTypeExtends

      public boolean resultTypeExtends(Class other)
    • getArg

      public Expression getArg(int i)
    • getArgCount

      public int getArgCount()
    • setArg

      public void setArg(int i, Expression arg)
    • numKeywordArgs

      public int numKeywordArgs()
    • keywordStart

      public int keywordStart()
    • insertArgument

      public void insertArgument(int index, Expression arg)
      Insert an expression into the argument list.
    • init

      protected void init(ApplyExp exp, InlineCalls visitor, Type required, ObjectType ctype, ClassType caller)
    • make

      public static CompileBuildObject make(ApplyExp exp, InlineCalls visitor, Type required, ObjectType ctype, ClassType caller)
    • setDefaultConstructor

      public void setDefaultConstructor(PrimProcedure proc)
    • getDefaultConstructor

      public PrimProcedure getDefaultConstructor()
    • hasDefaultConstructor

      public boolean hasDefaultConstructor()
    • hasAddChildMethod

      public boolean hasAddChildMethod()
    • findNamedMember

      public Member findNamedMember(String name)
    • buildSetter

      public Expression buildSetter(Declaration target, Member member, Expression value)
    • getAddChildMethodName

      public String getAddChildMethodName()
    • buildAddChild

      public Expression buildAddChild(Declaration target, Expression child)
    • useBuilder

      public boolean useBuilder(int numCode, InlineCalls visitor)
      Check if we should use the builder rather than the default.
      Returns:
      if true, caller should rewrite using the build() method; otherwise caller (CompileInvoke) should do the work itself.
    • build

      public Expression build()