Class GraphFacadeImpl

java.lang.Object
org.kink_lang.kink.hostfun.graph.impl.GraphFacadeImpl
All Implemented Interfaces:
GraphFacade

public class GraphFacadeImpl extends Object implements GraphFacade
The implementation of GraphFacade.
  • Constructor Details

    • GraphFacadeImpl

      public GraphFacadeImpl(Vm vm)
      Constructs the facade with the vm.
      Parameters:
      vm - the vm.
  • Method Details

    • init

      public void init()
      Initializses the facade.
    • of

      public GraphNode of(Val val)
      Description copied from interface: GraphFacade
      Returns a graph node which emits the val.
      Specified by:
      of in interface GraphFacade
      Parameters:
      val - the val to be emitted.
      Returns:
      the graph node which emits the val.
    • call

      public CallGraphNodeToRecv call(FunVal fun)
      Description copied from interface: GraphFacade
      Returns a graph node which calls the fun.
      Specified by:
      call in interface GraphFacade
      Parameters:
      fun - the fun to call.
      Returns:
      the call graph node which calls the fun.
    • call

      public CallGraphNodeToRecv call(GraphNode owner, int symHandle)
      Description copied from interface: GraphFacade
      Returns a call graph node which calls a method in the owner.
      Specified by:
      call in interface GraphFacade
      Parameters:
      owner - the owner of the method.
      symHandle - the sym handle of the method fun.
      Returns:
      the call graph node which calls a method in the owner.
    • call

      public CallGraphNodeToArgs call(String modName, int symHandle)
      Description copied from interface: GraphFacade
      Returns a call graph node which calls a fun in the mod.
      Specified by:
      call in interface GraphFacade
      Parameters:
      modName - the name of the mod.
      symHandle - the sym handle of the fun.
      Returns:
      the call graph node which calls a fun in the mod.
    • repr

      public GraphNode repr(Val val)
      Description copied from interface: GraphFacade
      Convenient method to call val.repr.
      Specified by:
      repr in interface GraphFacade
      Parameters:
      val - the val for which the .repr method is called.
      Returns:
      the execution graph to call val.repr.
    • format

      public GraphNode format(String template, GraphNode... args)
      Description copied from interface: GraphFacade
      Convenient method to call the Kink method template.format(...args).
      Specified by:
      format in interface GraphFacade
      Parameters:
      template - the template for Str.format method, such as "Catch {}".
      args - the args for Str.format method.
      Returns:
      the execution graph to call template.format(...args).
    • raiseFormat

      public GraphNode raiseFormat(String template, GraphNode... args)
      Description copied from interface: GraphFacade
      Convenient method to call CORE.raise(template.format(...args)).
      Specified by:
      raiseFormat in interface GraphFacade
      Parameters:
      template - the template for Str.format method, such as "expected a num, but got {}".
      args - the args for Str.format method.
      Returns:
      the execution graph to call CORE.raise(template.format(...args)).