Package: org.codehaus.groovy.classgen.asm

## [Java] Class CallSiteWriter

- org.codehaus.groovy.classgen.asm.CallSiteWriter

-     public class CallSiteWriter
      extends Object

  This class represents non-public API used by AsmClassGenerator. Don't use this class in your code

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String` | `CONSTRUCTOR` | Sentinel name for constructor calls.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `CallSiteWriter(WriterController wc)` Creates a call site writer with the given controller.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `fallbackAttributeOrPropertySite(PropertyExpression expression, Expression objectExpression, String name, MethodCallerMultiAdapter adapter)` Generates a fallback call for attribute or property access.
    `` | `public void` | `generateCallSiteArray()` Generates the call site array field and accessor methods.
    `` | `public List<String>` | `getCallSites()` Returns the list of call site names.
    `` | `public boolean` | `hasCallSiteUse()` Checks if any call sites have been used.
    `` | `public void` | `makeCallSite(Expression receiver, String message, Expression arguments, boolean safe, boolean implicitThis, boolean callCurrent, boolean callStatic)` Generates a general method call through the call site infrastructure.
    `` | `public void` | `makeCallSiteArrayInitializer()` Generates bytecode to initialize the call site array field to null.
    `` | `public void` | `makeGetPropertySite(Expression receiver, String methodName, boolean safe, boolean implicitThis)` Generates a general getProperty call.
    `` | `public void` | `makeGroovyObjectGetPropertySite(Expression receiver, String methodName, boolean safe, boolean implicitThis)` Generates a GroovyObject getProperty call.
    `` | `public final void` | `makeSingleArgumentCall(Expression receiver, String message, Expression arguments)` Generates a single-argument method call.
    `` | `public void` | `makeSingleArgumentCall(Expression receiver, String message, Expression arguments, boolean safe)` Generates a single-argument method call with optional safe navigation.
    `` | `public void` | `makeSiteEntry()` Generates bytecode to load the call site array into a local variable.
    `` | `public void` | `prepareCallSite(String message)` Prepares a call-site entry for the named method on the bytecode operand stack, loading the call-site array and selecting the slot for `message`.
    `` | `protected void` | `prepareSiteAndReceiver(Expression receiver, String methodName, boolean implicitThis, boolean lhs)` Generates bytecode to prepare the call site and receiver for a method call.
    `` | `protected void` | `visitBoxedArgument(Expression exp)` Visits an argument expression and ensures it is boxed.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### public static final String CONSTRUCTOR

      Sentinel name for constructor calls.

  - ### Constructor Detail

    - #### public CallSiteWriter(WriterController wc)

      Creates a call site writer with the given controller.

      Parameters:
        `wc` - the writer controller

  - ### Method Detail

    - #### public void fallbackAttributeOrPropertySite(PropertyExpression expression, Expression objectExpression, String name, MethodCallerMultiAdapter adapter)

      Generates a fallback call for attribute or property access.

      Parameters:
        `expression` - the property expression
        `objectExpression` - the object expression
        `name` - the property name
        `adapter` - the method caller adapter

    - #### public void generateCallSiteArray()

      Generates the call site array field and accessor methods.

    - #### public List<String> getCallSites()

      Returns the list of call site names.

      Returns:
        the call site names

    - #### public boolean hasCallSiteUse()

      Checks if any call sites have been used.

      Returns:
        true if call sites have been used

    - #### public void makeCallSite(Expression receiver, String message, Expression arguments, boolean safe, boolean implicitThis, boolean callCurrent, boolean callStatic)

      Generates a general method call through the call site infrastructure.

      Parameters:
        `receiver` - the receiver expression
        `message` - the method name
        `arguments` - the arguments expression
        `safe` - whether to use safe navigation
        `implicitThis` - whether the receiver is implicit 'this'
        `callCurrent` - whether to call on the current object
        `callStatic` - whether this is a static method call

    - #### public void makeCallSiteArrayInitializer()

      Generates bytecode to initialize the call site array field to null.

    - #### public void makeGetPropertySite(Expression receiver, String methodName, boolean safe, boolean implicitThis)

      Generates a general getProperty call.

      Parameters:
        `receiver` - the receiver expression
        `methodName` - the property name
        `safe` - whether to use safe navigation
        `implicitThis` - whether the receiver is implicit 'this'

    - #### public void makeGroovyObjectGetPropertySite(Expression receiver, String methodName, boolean safe, boolean implicitThis)

      Generates a GroovyObject getProperty call.

      Parameters:
        `receiver` - the receiver expression
        `methodName` - the property name
        `safe` - whether to use safe navigation
        `implicitThis` - whether the receiver is implicit 'this'

    - #### public final void makeSingleArgumentCall(Expression receiver, String message, Expression arguments)

      Generates a single-argument method call.

      Parameters:
        `receiver` - the receiver expression
        `message` - the method name
        `arguments` - the argument expression

    - #### public void makeSingleArgumentCall(Expression receiver, String message, Expression arguments, boolean safe)

      Generates a single-argument method call with optional safe navigation.

      Parameters:
        `receiver` - the receiver expression
        `message` - the method name
        `arguments` - the argument expression
        `safe` - whether to use safe navigation

    - #### public void makeSiteEntry()

      Generates bytecode to load the call site array into a local variable.

    - #### public void prepareCallSite(String message)

      Prepares a call-site entry for the named method on the bytecode operand stack, loading the call-site array and selecting the slot for `message`.

      Parameters:
        `message` - the method name for which to prepare the call site

    - #### protected void prepareSiteAndReceiver(Expression receiver, String methodName, boolean implicitThis, boolean lhs)

      Generates bytecode to prepare the call site and receiver for a method call.

      Parameters:
        `receiver` - the receiver expression
        `methodName` - the method name
        `implicitThis` - whether the receiver is implicit 'this'
        `lhs` - whether this is on the left-hand side of an assignment

    - #### protected void visitBoxedArgument(Expression exp)

      Visits an argument expression and ensures it is boxed.

      Parameters:
        `exp` - the argument expression