From 09c34352f8a87ed9597b4af0de564aa7d831761a Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 19 Dec 2016 00:04:51 -0500 Subject: IR: if and switch guaranteed compile time if target expr is --- src/analyze.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/analyze.cpp') diff --git a/src/analyze.cpp b/src/analyze.cpp index 144d50a70c..c7f6989423 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -2924,3 +2924,12 @@ void ensure_complete_type(CodeGen *g, TypeTableEntry *type_entry) { resolve_union_type(g, type_entry); } } + +bool ir_get_var_is_comptime(VariableTableEntry *var) { + if (!var->is_comptime) + return false; + if (var->is_comptime->other) + return var->is_comptime->other->static_value.data.x_bool; + return var->is_comptime->static_value.data.x_bool; +} + -- cgit v1.2.3