Commit 0d465821 authored by Alastair Robertson's avatar Alastair Robertson

Semantic analyser wait until final pass to declare invalid field accesses

parent ab16f8b7
...@@ -282,9 +282,11 @@ void SemanticAnalyser::visit(FieldAccess &acc) ...@@ -282,9 +282,11 @@ void SemanticAnalyser::visit(FieldAccess &acc)
acc.expr->accept(*this); acc.expr->accept(*this);
if (acc.expr->type.type != Type::cast) { if (acc.expr->type.type != Type::cast) {
err_ << "Can not access field '" << acc.field if (is_final_pass()) {
<< "' on expression of type '" << acc.expr->type err_ << "Can not access field '" << acc.field
<< "'" << std::endl; << "' on expression of type '" << acc.expr->type
<< "'" << std::endl;
}
return; return;
} }
......
...@@ -346,7 +346,7 @@ TEST(semantic_analyser, field_access_wrong_field) ...@@ -346,7 +346,7 @@ TEST(semantic_analyser, field_access_wrong_field)
TEST(semantic_analyser, field_access_wrong_expr) TEST(semantic_analyser, field_access_wrong_expr)
{ {
test("kprobe:f { 1234->field }", 1); test("kprobe:f { 1234->field }", 10);
} }
TEST(semantic_analyser, field_access_types) TEST(semantic_analyser, field_access_types)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment