aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/inlineasm/AsmParser.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-29 22:12:02 +0800
committerchriseth <chris@ethereum.org>2018-11-08 02:30:27 +0800
commit674e17c2a895eff6729357d8c10db709ac368b79 (patch)
tree300a55700b068709f36340563db1b43e5b8b1188 /libsolidity/inlineasm/AsmParser.cpp
parent0a96f091ab63e8d77106e00590a442c59714eecb (diff)
downloaddexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.gz
dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.zst
dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.zip
Performance: Replace string by special single-copy YulString class.
Diffstat (limited to 'libsolidity/inlineasm/AsmParser.cpp')
-rw-r--r--libsolidity/inlineasm/AsmParser.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp
index 54cdc1c6..1f399edc 100644
--- a/libsolidity/inlineasm/AsmParser.cpp
+++ b/libsolidity/inlineasm/AsmParser.cpp
@@ -112,8 +112,8 @@ assembly::Statement Parser::parseStatement()
advance();
expectToken(Token::Colon);
assignment.variableName.location = location();
- assignment.variableName.name = currentLiteral();
- if (instructions().count(assignment.variableName.name))
+ assignment.variableName.name = YulString(currentLiteral());
+ if (instructions().count(assignment.variableName.name.str()))
fatalParserError("Identifier expected, got instruction name.");
assignment.location.end = endPosition();
expectToken(Token::Identifier);
@@ -173,7 +173,7 @@ assembly::Statement Parser::parseStatement()
if (currentToken() == Token::Assign && peekNextToken() != Token::Colon)
{
assembly::Assignment assignment = createWithLocation<assembly::Assignment>(identifier.location);
- if (m_flavour != AsmFlavour::Yul && instructions().count(identifier.name))
+ if (m_flavour != AsmFlavour::Yul && instructions().count(identifier.name.str()))
fatalParserError("Cannot use instruction names for identifier names.");
advance();
assignment.variableNames.emplace_back(identifier);
@@ -363,7 +363,7 @@ Parser::ElementaryOperation Parser::parseElementaryOperation()
ret = Instruction{location(), instr};
}
else
- ret = Identifier{location(), literal};
+ ret = Identifier{location(), YulString{literal}};
advance();
break;
}
@@ -394,15 +394,15 @@ Parser::ElementaryOperation Parser::parseElementaryOperation()
Literal literal{
location(),
kind,
- currentLiteral(),
- ""
+ YulString{currentLiteral()},
+ {}
};
advance();
if (m_flavour == AsmFlavour::Yul)
{
expectToken(Token::Colon);
literal.location.end = endPosition();
- literal.type = expectAsmIdentifier();
+ literal.type = YulString{expectAsmIdentifier()};
}
else if (kind == LiteralKind::Boolean)
fatalParserError("True and false are not valid literals.");
@@ -449,7 +449,7 @@ assembly::FunctionDefinition Parser::parseFunctionDefinition()
RecursionGuard recursionGuard(*this);
FunctionDefinition funDef = createWithLocation<FunctionDefinition>();
expectToken(Token::Function);
- funDef.name = expectAsmIdentifier();
+ funDef.name = YulString{expectAsmIdentifier()};
expectToken(Token::LParen);
while (currentToken() != Token::RParen)
{
@@ -564,12 +564,12 @@ TypedName Parser::parseTypedName()
{
RecursionGuard recursionGuard(*this);
TypedName typedName = createWithLocation<TypedName>();
- typedName.name = expectAsmIdentifier();
+ typedName.name = YulString{expectAsmIdentifier()};
if (m_flavour == AsmFlavour::Yul)
{
expectToken(Token::Colon);
typedName.location.end = endPosition();
- typedName.type = expectAsmIdentifier();
+ typedName.type = YulString{expectAsmIdentifier()};
}
return typedName;
}