Doxygen cleanups

This commit is contained in:
K. Lange 2021-03-18 14:29:27 +09:00
parent 2de2d6ba6e
commit 30ef65355c
2 changed files with 29 additions and 0 deletions

View File

@ -1,3 +1,11 @@
/**
* @file obj_gen.c
* @brief Generator objects.
*
* Generator objects track runtime state so they can be resumed and yielded from.
* Any function with a `yield` statement in its body is implicitly transformed
* into a generator object when called.
*/
#include <string.h>
#include "vm.h"
#include "value.h"
@ -5,6 +13,10 @@
#include "util.h"
static KrkClass * generator;
/**
* @brief Generator object implementation.
* @extends KrkInstance
*/
struct generator {
KrkInstance inst;
KrkClosure * closure;
@ -36,6 +48,17 @@ static void _set_generator_done(struct generator * self) {
self->ip = NULL;
}
/**
* @brief Create a generator object from a closure and set of arguments.
*
* Initializes the generator object, attaches the argument list, and sets up
* the execution state to point to the start of the function's code object.
*
* @param closure Function object to transform.
* @param argsIn Array of arguments passed to the call.
* @param argCount Number of arguments in @p argsIn
* @return A @ref generator object.
*/
KrkInstance * krk_buildGenerator(KrkClosure * closure, KrkValue * argsIn, size_t argCount) {
/* Copy the args */
KrkValue * args = malloc(sizeof(KrkValue) * (argCount));

View File

@ -271,12 +271,18 @@ typedef struct {
KrkTable entries;
} KrkDict;
/**
* @extends KrkInstance
*/
struct DictItems {
KrkInstance inst;
KrkValue dict;
size_t i;
};
/**
* @extends KrkInstance
*/
struct DictKeys {
KrkInstance inst;
KrkValue dict;