From 4c0953385e4d6d0a9869259efb52ac5fbc0b7f3d Mon Sep 17 00:00:00 2001 From: benjaminion Date: Sat, 15 Jul 2017 22:17:20 +0100 Subject: LLL: Improve error reporting in certain cases. --- liblll/CodeFragment.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'liblll') 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(); + error(us); string fileName = firstAsString(); if (fileName.empty()) error("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(); + error(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(); + error(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(); + error(us); vector 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(); + error(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(); + error(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(); }; - auto requireMinSize = [&](unsigned s) { if (code.size() < s) error(); }; - auto requireMaxSize = [&](unsigned s) { if (code.size() > s) error(); }; - auto requireDeposit = [&](unsigned i, int s) { if (code[i].m_asm.deposit() != s) error(); }; + auto requireSize = [&](unsigned s) { if (code.size() != s) error(us); }; + auto requireMinSize = [&](unsigned s) { if (code.size() < s) error(us); }; + auto requireMaxSize = [&](unsigned s) { if (code.size() > s) error(us); }; + auto requireDeposit = [&](unsigned i, int s) { if (code[i].m_asm.deposit() != s) error(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(); + error(us); } else if (us == "WHEN" || us == "UNLESS") { -- cgit v1.2.3