diff options
Diffstat (limited to 'libyul/AsmParser.cpp')
-rw-r--r-- | libyul/AsmParser.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/libyul/AsmParser.cpp b/libyul/AsmParser.cpp index 33bb42f9..c7302063 100644 --- a/libyul/AsmParser.cpp +++ b/libyul/AsmParser.cpp @@ -107,14 +107,14 @@ Statement Parser::parseStatement() return parseForLoop(); case Token::Assign: { - if (m_dialect.flavour != AsmFlavour::Loose) + if (m_dialect->flavour != AsmFlavour::Loose) break; StackAssignment assignment = createWithLocation<StackAssignment>(); advance(); expectToken(Token::Colon); assignment.variableName.location = location(); assignment.variableName.name = YulString(currentLiteral()); - if (m_dialect.builtins->query(assignment.variableName.name)) + if (m_dialect->builtin(assignment.variableName.name)) fatalParserError("Identifier expected, got builtin symbol."); else if (instructions().count(assignment.variableName.name.str())) fatalParserError("Identifier expected, got instruction name."); @@ -176,9 +176,9 @@ Statement Parser::parseStatement() if (currentToken() == Token::Assign && peekNextToken() != Token::Colon) { Assignment assignment = createWithLocation<Assignment>(identifier.location); - if (m_dialect.builtins->query(identifier.name)) + if (m_dialect->builtin(identifier.name)) fatalParserError("Cannot assign to builtin function \"" + identifier.name.str() + "\"."); - else if (m_dialect.flavour != AsmFlavour::Yul && instructions().count(identifier.name.str())) + else if (m_dialect->flavour != AsmFlavour::Yul && instructions().count(identifier.name.str())) fatalParserError("Cannot use instruction names for identifier names."); advance(); assignment.variableNames.emplace_back(identifier); @@ -189,7 +189,7 @@ Statement Parser::parseStatement() else { // label - if (m_dialect.flavour != AsmFlavour::Loose) + if (m_dialect->flavour != AsmFlavour::Loose) fatalParserError("Labels are not supported."); Label label = createWithLocation<Label>(identifier.location); label.name = identifier.name; @@ -197,7 +197,7 @@ Statement Parser::parseStatement() } } default: - if (m_dialect.flavour != AsmFlavour::Loose) + if (m_dialect->flavour != AsmFlavour::Loose) fatalParserError("Call or assignment expected."); break; } @@ -273,7 +273,7 @@ Expression Parser::parseExpression() instructionNames().at(instr.instruction) + "\" not allowed in this context." ); - if (m_dialect.flavour != AsmFlavour::Loose && currentToken() != Token::LParen) + if (m_dialect->flavour != AsmFlavour::Loose && currentToken() != Token::LParen) fatalParserError( "Non-functional instructions are not allowed in this context." ); @@ -293,7 +293,7 @@ Expression Parser::parseExpression() else if (operation.type() == typeid(Instruction)) { // Instructions not taking arguments are allowed as expressions. - solAssert(m_dialect.flavour == AsmFlavour::Loose, ""); + solAssert(m_dialect->flavour == AsmFlavour::Loose, ""); Instruction& instr = boost::get<Instruction>(operation); return FunctionalInstruction{std::move(instr.location), instr.instruction, {}}; } @@ -362,9 +362,9 @@ Parser::ElementaryOperation Parser::parseElementaryOperation() else literal = YulString{currentLiteral()}; // first search the set of builtins, then the instructions. - if (m_dialect.builtins->query(literal)) + if (m_dialect->builtin(literal)) ret = Identifier{location(), literal}; - else if (m_dialect.flavour != AsmFlavour::Yul && instructions().count(literal.str())) + else if (m_dialect->flavour != AsmFlavour::Yul && instructions().count(literal.str())) { dev::solidity::Instruction const& instr = instructions().at(literal.str()); ret = Instruction{location(), instr}; @@ -405,7 +405,7 @@ Parser::ElementaryOperation Parser::parseElementaryOperation() {} }; advance(); - if (m_dialect.flavour == AsmFlavour::Yul) + if (m_dialect->flavour == AsmFlavour::Yul) { expectToken(Token::Colon); literal.location.end = endPosition(); @@ -418,7 +418,7 @@ Parser::ElementaryOperation Parser::parseElementaryOperation() } default: fatalParserError( - m_dialect.flavour == AsmFlavour::Yul ? + m_dialect->flavour == AsmFlavour::Yul ? "Literal or identifier expected." : "Literal, identifier or instruction expected." ); @@ -488,7 +488,7 @@ Expression Parser::parseCall(Parser::ElementaryOperation&& _initialOp) RecursionGuard recursionGuard(*this); if (_initialOp.type() == typeid(Instruction)) { - solAssert(m_dialect.flavour != AsmFlavour::Yul, "Instructions are invalid in Yul"); + solAssert(m_dialect->flavour != AsmFlavour::Yul, "Instructions are invalid in Yul"); Instruction& instruction = boost::get<Instruction>(_initialOp); FunctionalInstruction ret; ret.instruction = instruction.instruction; @@ -559,7 +559,7 @@ Expression Parser::parseCall(Parser::ElementaryOperation&& _initialOp) } else fatalParserError( - m_dialect.flavour == AsmFlavour::Yul ? + m_dialect->flavour == AsmFlavour::Yul ? "Function name expected." : "Assembly instruction or function name required in front of \"(\")" ); @@ -572,7 +572,7 @@ TypedName Parser::parseTypedName() RecursionGuard recursionGuard(*this); TypedName typedName = createWithLocation<TypedName>(); typedName.name = expectAsmIdentifier(); - if (m_dialect.flavour == AsmFlavour::Yul) + if (m_dialect->flavour == AsmFlavour::Yul) { expectToken(Token::Colon); typedName.location.end = endPosition(); @@ -584,7 +584,7 @@ TypedName Parser::parseTypedName() YulString Parser::expectAsmIdentifier() { YulString name = YulString{currentLiteral()}; - if (m_dialect.flavour == AsmFlavour::Yul) + if (m_dialect->flavour == AsmFlavour::Yul) { switch (currentToken()) { @@ -598,7 +598,7 @@ YulString Parser::expectAsmIdentifier() break; } } - else if (m_dialect.builtins->query(name)) + else if (m_dialect->builtin(name)) fatalParserError("Cannot use builtin function name \"" + name.str() + "\" as identifier name."); else if (instructions().count(name.str())) fatalParserError("Cannot use instruction names for identifier names."); |