fix regression in compile errors

master
Andrew Kelley 2020-05-23 20:27:09 -04:00
parent f771545a7e
commit c432811d96
2 changed files with 3 additions and 3 deletions

View File

@ -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;
}
}

View File

@ -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;
}
}