From c634d4a96d5e3fff379c72c31d268b198700277f Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 6 Mar 2019 19:13:50 +0000 Subject: [PATCH] Using implicit selector expressions in the core library --- core/odin/parser/parser.odin | 4 ++-- core/os/os.odin | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/core/odin/parser/parser.odin b/core/odin/parser/parser.odin index 90de2ca30..17a24c5f5 100644 --- a/core/odin/parser/parser.odin +++ b/core/odin/parser/parser.odin @@ -2679,7 +2679,7 @@ parse_simple_stmt :: proc(p: ^Parser, flags: Stmt_Allow_Flags) -> ^ast.Stmt { return stmt; case op.kind == token.In: - if Stmt_Allow_Flag.In in flags { + if .In in flags { allow_token(p, token.In); prev_allow_range := p.allow_range; p.allow_range = true; @@ -2697,7 +2697,7 @@ parse_simple_stmt :: proc(p: ^Parser, flags: Stmt_Allow_Flags) -> ^ast.Stmt { } case op.kind == token.Colon: expect_token_after(p, token.Colon, "identifier list"); - if Stmt_Allow_Flag.Label in flags && len(lhs) == 1 { + if .Label in flags && len(lhs) == 1 { switch p.curr_tok.kind { case token.Open_Brace, token.If, token.For, token.Switch: label := lhs[0]; diff --git a/core/os/os.odin b/core/os/os.odin index 9db84ddfe..d9bb318c4 100644 --- a/core/os/os.odin +++ b/core/os/os.odin @@ -123,20 +123,18 @@ read_ptr :: proc(fd: Handle, data: rawptr, len: int) -> (int, Errno) { heap_allocator_proc :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode, size, alignment: int, old_memory: rawptr, old_size: int, flags: u64 = 0, loc := #caller_location) -> rawptr { - using mem.Allocator_Mode; - switch mode { - case Alloc: + case .Alloc: return heap_alloc(size); - case Free: + case .Free: heap_free(old_memory); return nil; - case Free_All: + case .Free_All: // NOTE(bill): Does nothing - case Resize: + case .Resize: if old_memory == nil { return heap_alloc(size); }