KrkCodeObject Struct Reference

Code object. More...

#include <object.h>

Inheritance diagram for KrkCodeObject:

Public Member Functions

KrkCodeObjectkrk_newCodeObject (void)
 Create a new, uninitialized code object. More...
 

Data Fields

unsigned short requiredArgs
 Arity of required (non-default) arguments.
 
unsigned short keywordArgs
 Arity of keyword (default) arguments.
 
unsigned short potentialPositionals
 Precalculated positional arguments for complex argument processing.
 
unsigned short totalArguments
 Total argument cells we can fill in complex argument processing.
 
size_t upvalueCount
 Number of upvalues this function collects as a closure.
 
KrkChunk chunk
 Bytecode data.
 
KrkStringname
 Name of the function.
 
KrkStringdocstring
 Docstring attached to the function.
 
KrkValueArray positionalArgNames
 Array of names for positional arguments (and *args)
 
KrkValueArray keywordArgNames
 Array of names for keyword-only arguments (and **kwargs)
 
size_t localNameCapacity
 Capacity of localNames.
 
size_t localNameCount
 Number of entries in localNames.
 
KrkLocalEntrylocalNames
 Stores the names of local variables used in the function, for debugging.
 
KrkStringqualname
 The dotted name of the function.
 
- Data Fields inherited from KrkObj
uint16_t type
 Tag indicating core type.
 
uint16_t flags
 General object flags, mostly related to garbage collection.
 
uint32_t hash
 Cached hash value for table keys.
 
struct KrkObjnext
 Invasive linked list of all objects in the VM.
 

Protected Attributes

KrkObj obj
 Base.
 

Detailed Description

Code object.

Contains the static data associated with a chunk of bytecode.

Definition at line 144 of file object.h.

Member Function Documentation

◆ krk_newCodeObject()

KrkCodeObject * krk_newCodeObject ( void  )

Create a new, uninitialized code object.

The code object will have an empty bytecode chunk and no assigned names or docstrings. This is intended only to be used by a compiler directly.

Definition at line 261 of file object.c.


The documentation for this struct was generated from the following file: