commit c432811d96de1e8ac019ce16457c3992f039cb8c (tree)
parent f771545a7ecfa77ad18745b11d80d0f5238ecb65
Author: Andrew Kelley <andrew@ziglang.org>
Date: Sat, 23 May 2020 20:27:09 -0400
fix regression in compile errors
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/analyze.cpp b/src/analyze.cpp
@@ -3614,7 +3614,7 @@ static void add_top_level_decl(CodeGen *g, ScopeDecls *decls_scope, Tld *tld) {
Tld *other_tld = entry->value;
if (other_tld->id == TldIdVar) {
ZigVar *var = reinterpret_cast<TldVar *>(other_tld)->var;
- if (var->var_type != nullptr && type_is_invalid(var->var_type)) {
+ if (var != nullptr && var->var_type != nullptr && type_is_invalid(var->var_type)) {
return; // already reported compile error
}
}
@@ -3896,7 +3896,7 @@ ZigVar *add_variable(CodeGen *g, AstNode *source_node, Scope *parent_scope, Buf
bool want_err_msg = true;
if (tld->id == TldIdVar) {
ZigVar *var = reinterpret_cast<TldVar *>(tld)->var;
- if (var->var_type != nullptr && type_is_invalid(var->var_type)) {
+ if (var != nullptr && var->var_type != nullptr && type_is_invalid(var->var_type)) {
want_err_msg = false;
}
}
diff --git a/src/ir.cpp b/src/ir.cpp
@@ -5303,7 +5303,7 @@ static ZigVar *create_local_var(CodeGen *codegen, AstNode *node, Scope *parent_s
bool want_err_msg = true;
if (tld->id == TldIdVar) {
ZigVar *var = reinterpret_cast<TldVar *>(tld)->var;
- if (var->var_type != nullptr && type_is_invalid(var->var_type)) {
+ if (var != nullptr && var->var_type != nullptr && type_is_invalid(var->var_type)) {
want_err_msg = false;
}
}