diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2016-10-12 07:00:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-12 07:00:28 +0800 |
commit | 48ac9706770f72fe95848656147131c4ea644a77 (patch) | |
tree | d76a715155a177df2a9136be4b6a699ea0663688 | |
parent | 821fe6e916deb096009b54f4a228b7a8a596933a (diff) | |
parent | d0791fb365bd90c8d4b4f3ba6f83b126087d9a8e (diff) | |
download | dexon-solidity-48ac9706770f72fe95848656147131c4ea644a77.tar.gz dexon-solidity-48ac9706770f72fe95848656147131c4ea644a77.tar.zst dexon-solidity-48ac9706770f72fe95848656147131c4ea644a77.zip |
Merge pull request #1169 from ethereum/inline-assembly-tags
Fix assignment after tags in inline assembly
-rw-r--r-- | Changelog.md | 1 | ||||
-rw-r--r-- | libsolidity/inlineasm/AsmParser.cpp | 4 | ||||
-rw-r--r-- | test/libsolidity/InlineAssembly.cpp | 5 |
3 files changed, 9 insertions, 1 deletions
diff --git a/Changelog.md b/Changelog.md index 1560990d..bc79b88a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,6 +9,7 @@ Features: Bugfixes: * Disallow unknown options in `solc` * Inline assembly: support the `address` opcode + * Inline assembly: fix parsing of assignment after a label. ### 0.4.2 (2016-09-17) diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp index ee9c150e..8d2c2ed4 100644 --- a/libsolidity/inlineasm/AsmParser.cpp +++ b/libsolidity/inlineasm/AsmParser.cpp @@ -95,7 +95,9 @@ assembly::Statement Parser::parseStatement() fatalParserError("Label name / variable name must precede \":\"."); assembly::Identifier const& identifier = boost::get<assembly::Identifier>(statement); m_scanner->next(); - if (m_scanner->currentToken() == Token::Assign) + // identifier:=: should be parsed as identifier: =: (i.e. a label), + // while identifier:= (being followed by a non-colon) as identifier := (assignment). + if (m_scanner->currentToken() == Token::Assign && m_scanner->peekNextToken() != Token::Colon) { // functional assignment FunctionalAssignment funAss = createWithLocation<FunctionalAssignment>(identifier.location); diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp index 136d72e6..45eceb34 100644 --- a/test/libsolidity/InlineAssembly.cpp +++ b/test/libsolidity/InlineAssembly.cpp @@ -157,6 +157,11 @@ BOOST_AUTO_TEST_CASE(oversize_string_literals) BOOST_CHECK(!successAssemble("{ let x := \"123456789012345678901234567890123\" }")); } +BOOST_AUTO_TEST_CASE(assignment_after_tag) +{ + BOOST_CHECK(successParse("{ let x := 1 { tag: =: x } }")); +} + BOOST_AUTO_TEST_SUITE_END() } |