aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-07-01 16:21:32 +0100
committergingerBill <bill@gingerbill.org>2018-07-01 16:21:32 +0100
commit9bef5ec01abfffc01067d3ed1817f13b4918b315 (patch)
tree04c3ebc4d16bef4a69928abb0bdf182d332ff3bf /src
parent3a16f1e854d60059ab93efbf946c582138e95a66 (diff)
Fix anonymous procedures
Diffstat (limited to 'src')
-rw-r--r--src/ir.cpp2
-rw-r--r--src/parser.cpp3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 5b97a79d2..9103b5491 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -1578,7 +1578,7 @@ void ir_emit_zero_init(irProcedure *p, irValue *address, Ast *expr) {
args[0] = ir_emit_conv(p, address, t_rawptr);
args[1] = ir_const_int(a, type_size_of(t));
AstPackage *pkg = get_core_package(p->module->info, str_lit("mem"));
- if (p->entity->token.string != "zero" && p->entity->pkg != pkg) {
+ if (p->entity != nullptr && p->entity->token.string != "zero" && p->entity->pkg != pkg) {
ir_emit_package_call(p, "mem", "zero", args, expr);
}
ir_emit(p, ir_instr_zero_init(p, address));
diff --git a/src/parser.cpp b/src/parser.cpp
index fe992eda8..600c35608 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -4292,6 +4292,9 @@ bool parse_file(Parser *p, AstFile *f) {
CommentGroup *docs = f->lead_comment;
f->package_token = expect_token(f, Token_package);
+ if (f->error_count > 0) {
+ return false;
+ }
Token package_name = expect_token_after(f, Token_Ident, "package");
if (package_name.kind == Token_Ident) {
if (package_name.string == "_") {