From e269caae02778c5b15a101c42d2d2d5150af59c8 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 22 Jan 2016 23:12:33 -0700 Subject: implement undefined literal --- src/analyze.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/analyze.cpp') diff --git a/src/analyze.cpp b/src/analyze.cpp index 29cd794b5a..95896d9a2f 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -111,6 +111,7 @@ TypeTableEntry *new_type_table_entry(TypeTableEntryId id) { case TypeTableEntryIdMaybe: case TypeTableEntryIdFn: case TypeTableEntryIdError: + case TypeTableEntryIdUndefLit: // nothing to init break; case TypeTableEntryIdStruct: @@ -1063,6 +1064,7 @@ static bool type_has_codegen_value(TypeTableEntryId id) { case TypeTableEntryIdUnreachable: case TypeTableEntryIdNumLitFloat: case TypeTableEntryIdNumLitInt: + case TypeTableEntryIdUndefLit: return false; case TypeTableEntryIdBool: @@ -2481,10 +2483,9 @@ static TypeTableEntry *analyze_undefined_literal_expr(CodeGen *g, ImportTableEnt ConstExprValue *const_val = &expr->const_val; const_val->ok = true; + const_val->undef = true; - zig_panic("TODO"); - - return expected_type; + return expected_type ? expected_type : g->builtin_types.entry_undef; } -- cgit v1.2.3