diff options
| author | ryuukk <ryuukk.dev@gmail.com> | 2023-06-26 03:48:23 +0200 |
|---|---|---|
| committer | ryuukk <ryuukk.dev@gmail.com> | 2023-06-26 03:48:23 +0200 |
| commit | 0bb54d7b9cf217a1a6101508de3beb537f8b8a21 (patch) | |
| tree | b47d2e4cc3ce13dea2fb8bf5d16aa8330dbceb73 /src | |
| parent | 00acff7d5ca65dd2ba062cf74b3001f3fd396c49 (diff) | |
cleanup
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/ast.odin | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/common/ast.odin b/src/common/ast.odin index d32b32f..c8e2da5 100644 --- a/src/common/ast.odin +++ b/src/common/ast.odin @@ -314,11 +314,20 @@ collect_globals :: proc( } if ident != nil && implicit != nil { - allowed := - ident.name == "ODIN_OS" && + allowed := false + + if binary.op.text == "==" { + allowed = ident.name == "ODIN_OS" && implicit.field.name == fmt.tprint(ODIN_OS) || ident.name == "ODIN_ARCH" && implicit.field.name == fmt.tprint(ODIN_ARCH) + } else if binary.op.text == "!=" { + allowed = ident.name == "ODIN_OS" && + implicit.field.name != fmt.tprint(ODIN_OS) || + ident.name == "ODIN_ARCH" && + implicit.field.name != fmt.tprint(ODIN_ARCH) + } + if allowed { if block, ok := when_decl.body.derived.(^ast.Block_Stmt); ok { |