aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/builtins.c
blob: d0e58c2c66e8ef6264e9a9bda5778a235f19d4e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

/*
 * Builtin classes (will be defined by the runtime library)
 *
 * Copyright © 2025 Samuel Lidén Borell <samuel@kodafritt.se>
 *
 * SPDX-License-Identifier: EUPL-1.2+ OR LGPL-2.1-or-later
 */
#include <assert.h>
#include <string.h>
#include "compiler.h"

struct Type *builtin_commandmain_class = NULL;
struct Type *builtin_string_class = NULL;

static struct Type *init_class(const char *name)
{
    struct Type *t;
    type_start(name, strlen(name));
    t = current_type;
    assert(t->ident.node.is_defined);
    type_end();
    return t;
}

void builtins_init(void)
{
    assert(builtin_commandmain_class == NULL);
    assert(builtin_string_class == NULL);

    current_filename = "<builtins>";
    current_line = 0;
    {
        struct Type *t = init_class("CommandMain");
        /* TODO */
        builtin_commandmain_class = t;
    }
    {
        struct Type *t = init_class("String");
        /* TODO */
        builtin_string_class = t;
    }
}