Class ReceivePostReqdArgInstr

All Implemented Interfaces:
FixedArityInstr, ResultInstr

public class ReceivePostReqdArgInstr extends ReceiveArgBase implements FixedArityInstr
This represents a required arg that shows up after optional/rest args in a method/block parameter list. This instruction gets to pick an argument based on how many arguments have already been accounted for by parameters present earlier in the list.
  • Field Details

    • preReqdArgsCount

      public final int preReqdArgsCount
      The method/block parameter list has these many required parameters before opt+rest args
    • optArgsCount

      public final int optArgsCount
      The method/block parameter list has a maximum of this many optional arguments
    • restArg

      public final boolean restArg
      Does this method/block accept a rest argument
    • postReqdArgsCount

      public final int postReqdArgsCount
      The method/block parameter list has these many required parameters after opt+rest args
  • Constructor Details

    • ReceivePostReqdArgInstr

      public ReceivePostReqdArgInstr(Variable result, int argIndex, int preReqdArgsCount, int optArgCount, boolean restArg, int postReqdArgsCount)
  • Method Details

    • toStringNonOperandArgs

      public String[] toStringNonOperandArgs()
      Overrides:
      toStringNonOperandArgs in class ReceiveArgBase
    • clone

      public Instr clone(CloneInfo info)
      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:
      info - 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.
    • encode

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

      public static ReceivePostReqdArgInstr decode(IRReaderDecoder d)
    • receivePostReqdArg

      public IRubyObject receivePostReqdArg(ThreadContext context, IRubyObject[] args, boolean acceptsKeywordArgument)
    • visit

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