selfhost: port switch — N_SWITCH parser + cgen + scratch slot
This commit is contained in:
@@ -149,6 +149,16 @@ main(void)
|
||||
" let m: mode = mode.RW;\n"
|
||||
" return m as i32;\n"
|
||||
"};" },
|
||||
{ "switch",
|
||||
"fn classify(x: i32) i32 = {\n"
|
||||
" switch (x) {\n"
|
||||
" case 1, 2, 3: return 10;\n"
|
||||
" case 7: return 70;\n"
|
||||
" case: return 0;\n"
|
||||
" };\n"
|
||||
" return -1;\n"
|
||||
"};\n"
|
||||
"fn main() i32 = { return classify(2); };" },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user