Any type initially working

This commit is contained in:
Krzosa Karol
2022-06-19 12:34:05 +02:00
parent ade2638255
commit 014ef07b9f
6 changed files with 93 additions and 55 deletions

View File

@@ -41,10 +41,9 @@ want to export all the symbols, we can namespace them optionally.
-------------------------------------------------------------------------------
@todo
[ ] - Probably need to give Ast_Expr a Value field, then I can express Type nicely
[ ] - I would love for String, slice, Any etc. to have their struct declarations in source files, I also would want for stuff like string.str to work without weird special cases
[ ] - Implementing type Any
[ ] - Runtime TypeInfo
[ ] - Proper type Type support
[ ] - #test construct that would gather all tests and run them on start of program or something
[ ] - Foreign import that would link library
@@ -54,7 +53,6 @@ want to export all the symbols, we can namespace them optionally.
[ ] - Mixing loads and imports leads to code duplication, is that what we want???
[ ] - Fix field access, cant cast, cant index
[ ] - Add parent_scope to Ast_Type, Add name to Ast_Type?
[ ] - Switch
[ ] - Some way to take slice of data
[ ] - Optional function renaming in codegen
[ ] - Using in structs to embed members, then casting offsets to that embedded member
@@ -83,6 +81,9 @@ want to export all the symbols, we can namespace them optionally.
[ ] - Polymorphism - create declaration of a polymorphic thing, when it's called just copy it, replace types and typecheck normally, when someone calls again you just search for the instantiation again
@donzo
[x] - Runtime TypeInfo
[x] - Proper type Type support
[x] - Switch
[x] - Type aliases :: should probably be strictly typed, but assigning constant values should work
[x] - Array of inferred size
[x] - Casting pointers to and from void should be implicit
@@ -188,7 +189,13 @@ int main(int argument_count, char **arguments){
pctx->language_base_module = module;
parse_all_modules();
resolve_everything_in_module(module);
// @note: language stuff needs to be declared before type_info data
// so we mark where it ends
pctx->base_language_ordered_decl_len = pctx->ordered_decls.len;
Ast_Decl *any_decl = search_for_decl(module, pctx->intern("Any"_s));
assert(any_decl->type == type_type);
type_any = any_decl->type_val;
}
Ast_Module *module = add_module(0, pctx->intern(program_name));