aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-01-06 07:02:21 +0800
committerGitHub <noreply@github.com>2018-01-06 07:02:21 +0800
commitbca01f8f680c4f7d3a2da56fa014f587c5645c6a (patch)
tree0e5406e44ed53dc63b934314a7c59aae03cdc8d2
parentcf4fdab134366d36d2614fc549eadf149e8ee82b (diff)
parenta91393f4d74352be022b9a83fc3007881f770ed7 (diff)
downloaddexon-solidity-bca01f8f680c4f7d3a2da56fa014f587c5645c6a.tar
dexon-solidity-bca01f8f680c4f7d3a2da56fa014f587c5645c6a.tar.gz
dexon-solidity-bca01f8f680c4f7d3a2da56fa014f587c5645c6a.tar.bz2
dexon-solidity-bca01f8f680c4f7d3a2da56fa014f587c5645c6a.tar.lz
dexon-solidity-bca01f8f680c4f7d3a2da56fa014f587c5645c6a.tar.xz
dexon-solidity-bca01f8f680c4f7d3a2da56fa014f587c5645c6a.tar.zst
dexon-solidity-bca01f8f680c4f7d3a2da56fa014f587c5645c6a.zip
Merge pull request #3382 from ethereum/julia-identifier-parser
Support some restricted tokens (return, byte, address) as identifier in Julia
-rw-r--r--Changelog.md1
-rw-r--r--libsolidity/inlineasm/AsmParser.cpp8
-rw-r--r--test/libjulia/Parser.cpp8
3 files changed, 16 insertions, 1 deletions
diff --git a/Changelog.md b/Changelog.md
index bad9baab..9846023c 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -3,6 +3,7 @@
Features:
* Limit the number of warnings raised for creating abstract contracts.
* Inline Assembly: Issue warning for using jump labels (already existed for jump instructions).
+ * Inline Assembly: Support some restricted tokens (return, byte, address) as identifiers in Julia mode.
* SMT Checker: If-else branch conditions are taken into account in the SMT encoding of the program
variables.
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp
index 273e1d5c..9336e620 100644
--- a/libsolidity/inlineasm/AsmParser.cpp
+++ b/libsolidity/inlineasm/AsmParser.cpp
@@ -566,10 +566,16 @@ string Parser::expectAsmIdentifier()
string name = currentLiteral();
if (m_julia)
{
- if (currentToken() == Token::Bool)
+ switch (currentToken())
{
+ case Token::Return:
+ case Token::Byte:
+ case Token::Address:
+ case Token::Bool:
advance();
return name;
+ default:
+ break;
}
}
else if (instructions().count(name))
diff --git a/test/libjulia/Parser.cpp b/test/libjulia/Parser.cpp
index 9aa325a4..3ca62a90 100644
--- a/test/libjulia/Parser.cpp
+++ b/test/libjulia/Parser.cpp
@@ -196,6 +196,14 @@ BOOST_AUTO_TEST_CASE(empty_call)
CHECK_ERROR("{ () }", ParserError, "Literal or identifier expected.");
}
+BOOST_AUTO_TEST_CASE(tokens_as_identifers)
+{
+ BOOST_CHECK(successParse("{ let return:u256 := 1:u256 }"));
+ BOOST_CHECK(successParse("{ let byte:u256 := 1:u256 }"));
+ BOOST_CHECK(successParse("{ let address:u256 := 1:u256 }"));
+ BOOST_CHECK(successParse("{ let bool:u256 := 1:u256 }"));
+}
+
BOOST_AUTO_TEST_CASE(lacking_types)
{
CHECK_ERROR("{ let x := 1:u256 }", ParserError, "Expected token Identifier got 'Assign'");