Class ReceiveKeywordsInstr

All Implemented Interfaces:
ArgReceiver, ResultInstr

public class ReceiveKeywordsInstr extends NoOperandResultBaseInstr implements ArgReceiver
Gets the keyword arg (or representation of what might be holding keyword args). The result of this is passed into the other keyword arg instructions to get what those instrs are interested in. One intent of this result is that it can be mutable so it can toggle off keyword arg flags early in the method before any exceptions or side-effects in the method can occur. It also can remove key/value pairs as individual keyword instructions execute. After all individual instructions have executed anything left is either kwrest or an arity error.
  • Constructor Details

    • ReceiveKeywordsInstr

      public ReceiveKeywordsInstr(Variable result, boolean hasRestArg, boolean acceptsKeywords)
  • Method Details

    • hasRestArg

      public boolean hasRestArg()
    • acceptsKeywords

      public boolean acceptsKeywords()
    • encode

      public void encode(IRWriterEncoder e)
      Overrides:
      encode in class ResultBaseInstr
    • clone

      public Instr clone(CloneInfo ii)
      Description copied from class: Instr
      Clone the instruction for use in an inlining context (either when a scope is inlined into another scope, or when a block has to be cloned because its associated call belongs to an inlined scope). This might renaming variables and labels to eliminate naming conflicts. The implementation might vary on the cloning mode.
      Specified by:
      clone in class Instr
      Parameters:
      ii - This object manages renaming of variables and labels, handles args and return values.
      Returns:
      a new instruction that can be used in the target scope.
    • decode

      public static ReceiveKeywordsInstr decode(IRReaderDecoder d)
    • receiveArg

      public IRubyObject receiveArg(ThreadContext context, IRubyObject self, DynamicScope currDynScope, StaticScope currScope, Object[] temp, IRubyObject[] args, boolean ruby2keywords)
      Specified by:
      receiveArg in interface ArgReceiver
    • visit

      public void visit(IRVisitor visitor)
      Overrides:
      visit in class Instr