mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into develop_060
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user