mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-28 18:30:06 +00:00
Fix parsing for procedure literals expression statements; improve assert performance; other minor fixes
This commit is contained in:
@@ -955,6 +955,7 @@ parse_stmt :: proc(p: ^Parser) -> ^ast.Stmt {
|
||||
switch p.curr_tok.kind {
|
||||
// Operands
|
||||
case token.Context, // Also allows for 'context = '
|
||||
token.Proc,
|
||||
token.Inline, token.No_Inline,
|
||||
token.Ident,
|
||||
token.Integer, token.Float, token.Imag,
|
||||
|
||||
@@ -666,11 +666,13 @@ card :: proc(s: $S/bit_set[$E; $U]) -> int {
|
||||
@builtin
|
||||
assert :: proc(condition: bool, message := "", loc := #caller_location) -> bool {
|
||||
if !condition {
|
||||
p := context.assertion_failure_proc;
|
||||
if p == nil {
|
||||
p = default_assertion_failure_proc;
|
||||
}
|
||||
p("Runtime assertion", message, loc);
|
||||
proc(message: string, loc: Source_Code_Location) {
|
||||
p := context.assertion_failure_proc;
|
||||
if p == nil {
|
||||
p = default_assertion_failure_proc;
|
||||
}
|
||||
p("Runtime assertion", message, loc);
|
||||
}(message, loc);
|
||||
}
|
||||
return condition;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ foreign kernel32 {
|
||||
@(link_name="GetModuleFileNameA") get_module_file_name_a :: proc(module: Hmodule, filename: cstring, size: u32) -> u32 ---;
|
||||
@(link_name="GetModuleFileNameW") get_module_file_name_w :: proc(module: Hmodule, filename: Wstring, size: u32) -> u32 ---;
|
||||
|
||||
@(link_name="Sleep") sleep :: proc(ms: i32) -> i32 ---;
|
||||
@(link_name="Sleep") sleep :: proc(ms: u32) ---;
|
||||
@(link_name="QueryPerformanceFrequency") query_performance_frequency :: proc(result: ^i64) -> i32 ---;
|
||||
@(link_name="QueryPerformanceCounter") query_performance_counter :: proc(result: ^i64) -> i32 ---;
|
||||
@(link_name="OutputDebugStringA") output_debug_string_a :: proc(c_str: cstring) ---;
|
||||
|
||||
@@ -182,7 +182,7 @@ foreign user32 {
|
||||
@(link_name="DestroyIcon") destroy_icon :: proc(icon: Hicon) -> Bool ---;
|
||||
|
||||
@(link_name="LoadCursorA") load_cursor_a :: proc(instance: Hinstance, cursor_name: cstring) -> Hcursor ---;
|
||||
@(link_name="LoadCursorW") load_cursor_w :: proc(instance: Hinstance, cursor_name: cstring) -> Hcursor ---;
|
||||
@(link_name="LoadCursorW") load_cursor_w :: proc(instance: Hinstance, cursor_name: Wstring) -> Hcursor ---;
|
||||
@(link_name="GetCursor") get_cursor :: proc() -> Hcursor ---;
|
||||
@(link_name="SetCursor") set_cursor :: proc(cursor: Hcursor) -> Hcursor ---;
|
||||
|
||||
|
||||
@@ -20,5 +20,5 @@ now :: proc() -> Time {
|
||||
|
||||
|
||||
sleep :: proc(d: Duration) {
|
||||
win32.sleep(i32(d/Millisecond));
|
||||
win32.sleep(u32(d/Millisecond));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user