aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/SyntaxChecker.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-03-27 21:38:28 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-03-27 22:49:41 +0800
commitb540ba527a70df440299de9c0bf44f9d11ac6ef6 (patch)
treee9a57df2cabfc118ba92f671d66f430c1936ec2c /libsolidity/analysis/SyntaxChecker.cpp
parent62559cf1278afc417d19ec181e2bced364cadea2 (diff)
downloaddexon-solidity-b540ba527a70df440299de9c0bf44f9d11ac6ef6.tar.gz
dexon-solidity-b540ba527a70df440299de9c0bf44f9d11ac6ef6.tar.zst
dexon-solidity-b540ba527a70df440299de9c0bf44f9d11ac6ef6.zip
Disallow empty structs
Diffstat (limited to 'libsolidity/analysis/SyntaxChecker.cpp')
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp
index ddac194b..e03417a9 100644
--- a/libsolidity/analysis/SyntaxChecker.cpp
+++ b/libsolidity/analysis/SyntaxChecker.cpp
@@ -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;
+}