Disallow empty structs

This commit is contained in:
Alex Beregszaszi
2018-03-27 15:49:41 +01:00
parent 62559cf127
commit b540ba527a
6 changed files with 17 additions and 2 deletions
+7
View File
@@ -255,3 +255,10 @@ bool SyntaxChecker::visit(VariableDeclaration const& _declaration)
}
return true;
}
bool SyntaxChecker::visit(StructDefinition const& _struct)
{
if (_struct.members().empty())
m_errorReporter.syntaxError(_struct.location(), "Defining empty structs is disallowed.");
return true;
}
+2
View File
@@ -71,6 +71,8 @@ private:
virtual bool visit(VariableDeclaration const& _declaration) override;
virtual bool visit(StructDefinition const& _struct) override;
ErrorReporter& m_errorReporter;
/// Flag that indicates whether a function modifier actually contains '_'.