Add TypeOf operator

This commit is contained in:
Krzosa Karol
2022-10-11 11:13:07 +02:00
parent 4004b8b8d3
commit e37bf8b1bc
8 changed files with 61 additions and 38 deletions

View File

@@ -38,6 +38,7 @@ keyword_for = l->intern("for"_s);
keyword_enum = l->intern("enum"_s);
l->interns.first_keyword = keyword_struct.str;
l->interns.last_keyword = keyword_enum.str;
intern_typeof = l->intern("TypeOf"_s);
intern_sizeof = l->intern("SizeOf"_s);
intern_len = l->intern("Len"_s);
intern_alignof = l->intern("AlignOf"_s);
@@ -340,11 +341,11 @@ compile_file(String filename, U32 compile_flags = COMPILE_NULL){
if(is_flag_set(compile_flags, COMPILE_AND_RUN)){
String testing = compile_flags&COMPILE_TESTING ? "testing"_s : ""_s;
#if OS_WINDOWS
#if OS_WINDOWS
String sys = string_fmt(scratch, "a.exe %Q", testing);
#else
#else
String sys = string_fmt(scratch, "./a.out %Q", testing);
#endif
#endif
int result = system((char *)sys.str);
assert(result != -1);
if(result == 0){