cmakepp_lang/object/call

Defines functions used to process calls to member functions assigned to an object.

cmakepp_lang/object/call._cpp_object_call_guts(this result method)

Determines the correct member function to call for the input.

This function is factored out of _cpp_object_call to avoid contaminating the caller’s namespace with temporary variables needed to lookup the symbol of the member function we are calling.

Parameters:
  • this (obj) – The Object instance whose member function is being called.

  • result (desc) – Identifier to hold the symbol of the function to call.

  • method (desc) – The name of the method to call. The actual name is case-insensitive.

  • *args – The arguments which are being forwarded to the member function.

Returns:

result will be set to the symbol (mangled name) of the member function to call.

Return type:

fxn

Note

This function is considered an implementation detail of object_call and does not perform any type checking.

Error Checking

This function will raise an error if the Object instance does not contain a member function capable of being called with the provided signature.

cmakepp_lang/object/call._cpp_object_call(this method)

Note

This is a macro, and so does not introduce a new scope.

Calls the specified member function.

This is the “public” API (users of CMakePP should rarely need to go through the Object class directly) for calling an Object instance’s member function. This function encapsulates the process of determining the correct overload to call and actually invoking it.

Parameters:
  • this (obj) – The Object instance whose member function is being called.

  • method (desc) – The name of the member function to call.

  • *args – The arguments to forward to the member function (the required first argument of the this pointer is forwarded automatically and should not be provided in this list)

Returns:

This function will return whatever the member function returns using the mechanism of that function. If the member function does not return this function will not return.

Return type:

str

Variables:

CMAKEPP_LANG_DEBUG_MODE (bool) – Used to determine if CMakePP is being run in debug mode or not.

Note

This command is a macro to avoid needing to forward the results of the subcall.

Error Checking

If CMakePP is run in debug mode (and only if CMakePP is run in debug mode) this function will ensure that it was called with the correct number and types of arguments. If it is not an error will be raised.

Additionally, this function will raise an error if the Object instance does not contain a suitable overload for the provided arguments.