Merge remote-tracking branch 'origin/develop' into develop_060

This commit is contained in:
chriseth
2019-11-26 16:19:35 +01:00
65 changed files with 1942 additions and 203 deletions
+1
View File
@@ -851,6 +851,7 @@ string ASTJsonConverter::literalTokenKind(Token _token)
case dev::solidity::Token::Number:
return "number";
case dev::solidity::Token::StringLiteral:
case dev::solidity::Token::HexStringLiteral:
return "string";
case dev::solidity::Token::TrueLiteral:
case dev::solidity::Token::FalseLiteral:
+1
View File
@@ -347,6 +347,7 @@ TypePointer TypeProvider::forLiteral(Literal const& _literal)
case Token::Number:
return rationalNumber(_literal);
case Token::StringLiteral:
case Token::HexStringLiteral:
return stringLiteral(_literal.value());
default:
return nullptr;
+3 -2
View File
@@ -23,6 +23,7 @@
#include <libsolidity/codegen/ABIFunctions.h>
#include <libsolidity/codegen/CompilerUtils.h>
#include <libdevcore/CommonData.h>
#include <libdevcore/Whiskers.h>
#include <libdevcore/StringUtils.h>
@@ -975,7 +976,7 @@ string ABIFunctions::abiEncodingFunctionStringLiteral(
for (size_t i = 0; i < words; ++i)
{
wordParams[i]["offset"] = to_string(i * 32);
wordParams[i]["wordValue"] = "0x" + h256(value.substr(32 * i, 32), h256::AlignLeft).hex();
wordParams[i]["wordValue"] = formatAsStringOrNumber(value.substr(32 * i, 32));
}
templ("word", wordParams);
return templ.render();
@@ -990,7 +991,7 @@ string ABIFunctions::abiEncodingFunctionStringLiteral(
}
)");
templ("functionName", functionName);
templ("wordValue", "0x" + h256(value, h256::AlignLeft).hex());
templ("wordValue", formatAsStringOrNumber(value));
return templ.render();
}
});
+3 -1
View File
@@ -23,6 +23,8 @@
#include <libsolidity/codegen/MultiUseYulFunctionCollector.h>
#include <libsolidity/ast/AST.h>
#include <libsolidity/codegen/CompilerUtils.h>
#include <libdevcore/CommonData.h>
#include <libdevcore/Whiskers.h>
#include <libdevcore/StringUtils.h>
@@ -1807,7 +1809,7 @@ string YulUtilFunctions::conversionFunctionSpecial(Type const& _from, Type const
for (size_t i = 0; i < words; ++i)
{
wordParams[i]["offset"] = to_string(32 + i * 32);
wordParams[i]["wordValue"] = "0x" + h256(data.substr(32 * i, 32), h256::AlignLeft).hex();
wordParams[i]["wordValue"] = formatAsStringOrNumber(data.substr(32 * i, 32));
}
templ("word", wordParams);
return templ.render();
+14 -1
View File
@@ -1783,9 +1783,22 @@ ASTPointer<Expression> Parser::parsePrimaryExpression()
}
break;
case Token::StringLiteral:
case Token::HexStringLiteral:
{
string literal = m_scanner->currentLiteral();
Token firstToken = m_scanner->currentToken();
while (m_scanner->peekNextToken() == firstToken)
{
m_scanner->next();
literal += m_scanner->currentLiteral();
}
nodeFactory.markEndPosition();
expression = nodeFactory.createNode<Literal>(token, getLiteralAndAdvance());
m_scanner->next();
if (m_scanner->currentToken() == Token::Illegal)
fatalParserError(to_string(m_scanner->currentError()));
expression = nodeFactory.createNode<Literal>(token, make_shared<ASTString>(literal));
break;
}
case Token::Identifier:
nodeFactory.markEndPosition();
expression = nodeFactory.createNode<Identifier>(getLiteralAndAdvance());