Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
clonker committed Jun 20, 2024
1 parent 5a7168d commit ff37008
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions libyul/AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ std::optional<std::pair<std::string_view, SourceLocation>> Parser::parseSrcComme
return scanner.peekNextToken() == Token::EOS || _arguments[endIndex] == ' ' || _arguments[endIndex] == '\t' || _arguments[endIndex] == '\n' || _arguments[endIndex] == '\r';
}();

// index out of range is handled by error 6367
if (!success && !indexOutOfRange)
{
m_errorReporter.syntaxError(
Expand All @@ -265,15 +266,6 @@ std::optional<std::pair<std::string_view, SourceLocation>> Parser::parseSrcComme
);
return std::nullopt;
}
else if (indexOutOfRange)
{
m_errorReporter.syntaxError(
6367_error,
_commentLocation,
"Invalid value in source location mapping. "
"Expected non-negative integer values or -1 for source index and location."
);
}

if (scanner.peekNextToken() == Token::StringLiteral &&
isNonBreakingWhitespace(_arguments[static_cast<size_t>(scanner.currentLocation().end)]))
Expand Down Expand Up @@ -312,7 +304,7 @@ std::optional<std::pair<std::string_view, SourceLocation>> Parser::parseSrcComme
return {{tail, SourceLocation{}}};
}

if ((sourceIndex < 0 && sourceIndex != -1) || (start < 0 && start != -1) || (end < 0 && end != -1))
if (indexOutOfRange || (sourceIndex < 0 && sourceIndex != -1) || (start < 0 && start != -1) || (end < 0 && end != -1))
m_errorReporter.syntaxError(
6367_error,
_commentLocation,
Expand Down

0 comments on commit ff37008

Please sign in to comment.