Rewritten field access, lose functionality but I'm fine with it, it's simpler now,

might need to support casting
This commit is contained in:
Krzosa Karol
2022-06-11 23:19:41 +02:00
parent ac371b7203
commit 0fcdd02c5b
5 changed files with 42 additions and 116 deletions

View File

@@ -184,7 +184,8 @@ gen_expr(Ast_Expr *ast){
CASE(BINARY, Binary){
if(node->op == TK_Dot){
gen_expr(node->left);
if(node->type->kind == TYPE_POINTER) gen("->");
if(!node->type) gen("__");
else if(node->type->kind == TYPE_POINTER) gen("->");
else gen(".");
gen_expr(node->right);
return;
@@ -426,7 +427,11 @@ compile_files(Array<String> filename){
// by default it's name of the file
// but if you add [package name] then it's overwritten
Token *token = token_get();
String filename_without_ext = string_chop_last_period(token->file.s);
String filename_without_ext = {};
if(string_find(token->file.s, "."_s, MatchFlag_None, &filename_without_ext.len)){
filename_without_ext.str = token->file.str;
} else filename_without_ext = token->file.s;
it.name = pctx->intern(filename_without_ext);
if(token_is(SAME_SCOPE) && token_is_keyword(keyword_package, 1)){