aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenjaminion <ben@edginet.org>2017-07-16 05:17:20 +0800
committerbenjaminion <ben@edginet.org>2017-07-16 05:17:20 +0800
commit4c0953385e4d6d0a9869259efb52ac5fbc0b7f3d (patch)
tree39b2d0b67c55413ac3a03b634def93113cfdf01b
parentb61f744dd9c5e954f53deb781c7e408da55dcda1 (diff)
downloaddexon-solidity-4c0953385e4d6d0a9869259efb52ac5fbc0b7f3d.tar.gz
dexon-solidity-4c0953385e4d6d0a9869259efb52ac5fbc0b7f3d.tar.zst
dexon-solidity-4c0953385e4d6d0a9869259efb52ac5fbc0b7f3d.zip
LLL: Improve error reporting in certain cases.
-rw-r--r--liblll/CodeFragment.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp
index f637dfb1..a721a025 100644
--- a/liblll/CodeFragment.cpp
+++ b/liblll/CodeFragment.cpp
@@ -203,7 +203,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
else if (us == "INCLUDE")
{
if (_t.size() != 2)
- error<IncorrectParameterCount>();
+ error<IncorrectParameterCount>(us);
string fileName = firstAsString();
if (fileName.empty())
error<InvalidName>("Empty file name provided");
@@ -215,7 +215,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
else if (us == "SET")
{
if (_t.size() != 3)
- error<IncorrectParameterCount>();
+ error<IncorrectParameterCount>(us);
int c = 0;
for (auto const& i: _t)
if (c++ == 2)
@@ -226,7 +226,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
else if (us == "GET")
{
if (_t.size() != 2)
- error<IncorrectParameterCount>();
+ error<IncorrectParameterCount>(us);
m_asm.append((u256)varAddress(firstAsString()));
m_asm.append(Instruction::MLOAD);
}
@@ -237,7 +237,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
string n;
unsigned ii = 0;
if (_t.size() != 3 && _t.size() != 4)
- error<IncorrectParameterCount>();
+ error<IncorrectParameterCount>(us);
vector<string> args;
for (auto const& i: _t)
{
@@ -288,7 +288,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
else if (us == "LIT")
{
if (_t.size() < 3)
- error<IncorrectParameterCount>();
+ error<IncorrectParameterCount>(us);
unsigned ii = 0;
CodeFragment pos;
bytes data;
@@ -303,7 +303,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
{
pos = CodeFragment(i, _s);
if (pos.m_asm.deposit() != 1)
- error<InvalidDeposit>();
+ error<InvalidDeposit>(us);
}
else if (i.tag() != 0)
{
@@ -384,10 +384,10 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
else
code.push_back(CodeFragment(i, _s));
}
- auto requireSize = [&](unsigned s) { if (code.size() != s) error<IncorrectParameterCount>(); };
- auto requireMinSize = [&](unsigned s) { if (code.size() < s) error<IncorrectParameterCount>(); };
- auto requireMaxSize = [&](unsigned s) { if (code.size() > s) error<IncorrectParameterCount>(); };
- auto requireDeposit = [&](unsigned i, int s) { if (code[i].m_asm.deposit() != s) error<InvalidDeposit>(); };
+ auto requireSize = [&](unsigned s) { if (code.size() != s) error<IncorrectParameterCount>(us); };
+ auto requireMinSize = [&](unsigned s) { if (code.size() < s) error<IncorrectParameterCount>(us); };
+ auto requireMaxSize = [&](unsigned s) { if (code.size() > s) error<IncorrectParameterCount>(us); };
+ auto requireDeposit = [&](unsigned i, int s) { if (code[i].m_asm.deposit() != s) error<InvalidDeposit>(us); };
if (_s.macros.count(make_pair(s, code.size())))
{
@@ -475,7 +475,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
m_asm.append(code[1].m_asm, minDep);
m_asm << end.tag();
if (m_asm.deposit() != deposit)
- error<InvalidDeposit>();
+ error<InvalidDeposit>(us);
}
else if (us == "WHEN" || us == "UNLESS")
{