mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Remove CharStream from SourceLocation.
This commit is contained in:
@@ -591,19 +591,21 @@ BOOST_AUTO_TEST_CASE(inline_asm_end_location)
|
||||
class CheckInlineAsmLocation: public ASTConstVisitor
|
||||
{
|
||||
public:
|
||||
explicit CheckInlineAsmLocation(string _sourceCode): m_sourceCode(_sourceCode) {}
|
||||
bool visited = false;
|
||||
bool visit(InlineAssembly const& _inlineAsm) override
|
||||
{
|
||||
auto loc = _inlineAsm.location();
|
||||
auto asmStr = loc.source->source().substr(static_cast<size_t>(loc.start), static_cast<size_t>(loc.end - loc.start));
|
||||
auto asmStr = m_sourceCode.substr(static_cast<size_t>(loc.start), static_cast<size_t>(loc.end - loc.start));
|
||||
BOOST_CHECK_EQUAL(asmStr, "assembly { a := 0x12345678 }");
|
||||
visited = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
string m_sourceCode;
|
||||
};
|
||||
|
||||
CheckInlineAsmLocation visitor;
|
||||
CheckInlineAsmLocation visitor{sourceCode};
|
||||
contract->accept(visitor);
|
||||
|
||||
BOOST_CHECK_MESSAGE(visitor.visited, "No inline asm block found?!");
|
||||
|
||||
Reference in New Issue
Block a user