Compare commits
1 Commits
2bfc16c662
...
149d057403
Author | SHA1 | Date | |
---|---|---|---|
149d057403 |
@ -93,7 +93,6 @@ fn void compile(Arena* arena, Options options)
|
||||
.name = options.name,
|
||||
.path = options.path,
|
||||
.executable = options.executable,
|
||||
.definitions = options.definitions,
|
||||
.objects = options.objects,
|
||||
.library_directories = options.library_directories,
|
||||
.library_names = options.library_names,
|
||||
@ -110,6 +109,24 @@ fn void compile(Arena* arena, Options options)
|
||||
.id = ValueId::infer_or_ignore,
|
||||
};
|
||||
|
||||
for (auto definition: options.definitions)
|
||||
{
|
||||
auto definition_global = new_global(&module);
|
||||
auto definition_value = new_value(&module);
|
||||
*definition_value = {
|
||||
.string_literal = definition.value,
|
||||
.id = ValueId::string_literal,
|
||||
};
|
||||
*definition_global = Global{
|
||||
.variable = {
|
||||
.initial_value = definition_value,
|
||||
.type = get_slice_type(&module, uint8(&module)),
|
||||
.scope = &module.scope,
|
||||
.name = definition.name,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
parse(&module);
|
||||
emit(&module);
|
||||
}
|
||||
|
@ -1336,7 +1336,6 @@ struct Module
|
||||
String path;
|
||||
String executable;
|
||||
|
||||
Slice<Definition> definitions;
|
||||
Slice<String> objects;
|
||||
Slice<String> library_directories;
|
||||
Slice<String> library_names;
|
||||
|
@ -3167,24 +3167,6 @@ void parse(Module* module)
|
||||
{
|
||||
auto scope = &module->scope;
|
||||
|
||||
for (auto definition: module->definitions)
|
||||
{
|
||||
auto definition_global = new_global(module);
|
||||
auto definition_value = new_value(module);
|
||||
*definition_value = {
|
||||
.string_literal = definition.value,
|
||||
.id = ValueId::string_literal,
|
||||
};
|
||||
*definition_global = Global{
|
||||
.variable = {
|
||||
.initial_value = definition_value,
|
||||
.type = get_slice_type(module, uint8(module)),
|
||||
.scope = scope,
|
||||
.name = definition.name,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
skip_space(module);
|
||||
|
Loading…
x
Reference in New Issue
Block a user