KrkInstance Struct Reference

An object of a class. More...

#include <object.h>

Inheritance diagram for KrkInstance:

Public Member Functions

KrkInstancekrk_newInstance (KrkClass *_class)
 Create a new instance of the given class. More...
 

Data Fields

KrkClass_class
 Type.
 
KrkTable fields
 Attributes table.
 
- 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

An object of a class.

Created by class initializers, instances are the standard type of objects built by managed code. Not all objects are instances, but all instances are objects, and all instances have well-defined class.

Definition at line 281 of file object.h.

Member Function Documentation

◆ krk_newInstance()

KrkInstance * krk_newInstance ( KrkClass _class)

Create a new instance of the given class.

Handles allocation, but not init, of the new instance. Be sure to populate any fields expected by the class or call its init function (eg. with krk_callStack) as needed.

Definition at line 343 of file object.c.


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