MCPcopy Create free account
hub / github.com/argotorg/solidity / parseAndReturnFirstError

Function parseAndReturnFirstError

test/libyul/Parser.cpp:82–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82std::optional<Error> parseAndReturnFirstError(std::string const& _source, Dialect const& _dialect, bool _allowWarningsAndInfos = true)
83{
84 ErrorList errors;
85 ErrorReporter errorReporter(errors);
86 if (!parse(_source, _dialect, errorReporter))
87 {
88 BOOST_REQUIRE(!errors.empty());
89 BOOST_CHECK_EQUAL(errors.size(), 1);
90 return *errors.front();
91 }
92 else
93 {
94 // If success is true, there might still be an error in the assembly stage.
95 if (_allowWarningsAndInfos && !Error::containsErrors(errors))
96 return {};
97 else if (!errors.empty())
98 {
99 if (!_allowWarningsAndInfos)
100 BOOST_CHECK_EQUAL(errors.size(), 1);
101 return *errors.front();
102 }
103 }
104 return {};
105}
106
107bool successParse(std::string const& _source, Dialect const& _dialect, bool _allowWarningsAndInfos = true)
108{

Callers 2

successParseFunction · 0.70
expectErrorFunction · 0.70

Calls 3

parseFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected