diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2016-11-01 10:07:20 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2016-12-01 00:17:50 +0800 |
commit | b1add657b76621952be100b4203dd2c8a466b9a1 (patch) | |
tree | 2f894e440b6486e227569d74ebf658e88acd59f9 | |
parent | 99b803cbcbe4f7a0806db12d53cb7152fde490ef (diff) | |
download | dexon-solidity-b1add657b76621952be100b4203dd2c8a466b9a1.tar dexon-solidity-b1add657b76621952be100b4203dd2c8a466b9a1.tar.gz dexon-solidity-b1add657b76621952be100b4203dd2c8a466b9a1.tar.bz2 dexon-solidity-b1add657b76621952be100b4203dd2c8a466b9a1.tar.lz dexon-solidity-b1add657b76621952be100b4203dd2c8a466b9a1.tar.xz dexon-solidity-b1add657b76621952be100b4203dd2c8a466b9a1.tar.zst dexon-solidity-b1add657b76621952be100b4203dd2c8a466b9a1.zip |
LLL: throw exceptions on invalid symbols
-rw-r--r-- | liblll/CodeFragment.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp index 35ad4e59..af7d7f0a 100644 --- a/liblll/CodeFragment.cpp +++ b/liblll/CodeFragment.cpp @@ -91,15 +91,11 @@ CodeFragment::CodeFragment(sp::utree const& _t, CompilerState& _s, bool _allowAS { auto it = _s.vars.find(s); if (it == _s.vars.end()) - { - bool ok; - tie(it, ok) = _s.vars.insert(make_pair(s, make_pair(_s.stackSize, 32))); - _s.stackSize += 32; - } + error<InvalidName>(std::string("Symbol not found: ") + s); m_asm.append((u256)it->second.first); } else - error<BareSymbol>(); + error<BareSymbol>(s); break; } @@ -111,7 +107,9 @@ CodeFragment::CodeFragment(sp::utree const& _t, CompilerState& _s, bool _allowAS m_asm.append((u256)i); break; } - default: break; + default: + error<CompilerException>("Unexpected fragment type"); + break; } } @@ -177,11 +175,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s) { auto it = _s.vars.find(n); if (it == _s.vars.end()) - { - bool ok; - tie(it, ok) = _s.vars.insert(make_pair(n, make_pair(_s.stackSize, 32))); - _s.stackSize += 32; - } + error<InvalidName>(std::string("Symbol not found: ") + s); return it->second.first; }; |