Skip to content

Commit

Permalink
Merge branch 'reflection' into breakage
Browse files Browse the repository at this point in the history
  • Loading branch information
Victorious3 committed Oct 12, 2024
2 parents ba787d7 + 9b2702b commit 376d731
Show file tree
Hide file tree
Showing 12 changed files with 1,077 additions and 122 deletions.
22 changes: 22 additions & 0 deletions src/builtins.pr
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,28 @@ export let size_t_ = create_int_type("size_t", size_of size_t, true)
)
}

// Reflection data
scope::create_variable(
builtins, parser::make_identifier("__reflection_data"),
parser::ShareMarker::EXPORT, parser::VarDecl::CONST, typechecking::pointer(uint8_),
[ kind = compiler::ValueKind::GLOBAL, tpe = typechecking::pointer(uint8_), name = "__reflection_data"] !&compiler::Value
)
scope::create_variable(
builtins, parser::make_identifier("__reflection_strings"),
parser::ShareMarker::EXPORT, parser::VarDecl::CONST, typechecking::pointer(char_),
[ kind = compiler::ValueKind::GLOBAL, tpe = typechecking::pointer(char_), name = "__reflection_strings"] !&compiler::Value
)
scope::create_variable(
builtins, parser::make_identifier("__reflection_data_size"),
parser::ShareMarker::EXPORT, parser::VarDecl::CONST, typechecking::pointer(size_t_),
[ kind = compiler::ValueKind::GLOBAL, tpe = typechecking::pointer(size_t_), name = "__reflection_data_size"] !&compiler::Value
)
scope::create_variable(
builtins, parser::make_identifier("__reflection_num_types"),
parser::ShareMarker::EXPORT, parser::VarDecl::CONST, typechecking::pointer(size_t_),
[ kind = compiler::ValueKind::GLOBAL, tpe = typechecking::pointer(size_t_), name = "__reflection_num_types"] !&compiler::Value
)

// These get set from toolchain
export var File_: &typechecking::Type = null
export var Type_: &typechecking::Type = null
Expand Down
4 changes: 0 additions & 4 deletions src/codegen.pr
Original file line number Diff line number Diff line change
Expand Up @@ -796,10 +796,6 @@ export def gen(module: &toolchain::Module) {
gen_header(fp, module)

if module.module == "main" {
module.imported.add("malloc")
module.imported.add("free")
module.imported.add("strlen")

gen_main_function(fp)
}

Expand Down
Loading

0 comments on commit 376d731

Please sign in to comment.