Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Core/GDCore/IDE/Events/ExpressionValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,11 @@ ExpressionValidator::Type ExpressionValidator::ValidateFunction(
// Check if the expression is deprecated
if (metadata.IsDeprecated()) {
gd::String deprecationMessage = metadata.GetDeprecationMessage();
auto diagnostic = gd::make_unique<ExpressionParserError>(
RaiseWarning(
gd::ExpressionParserError::ErrorType::DeprecatedExpression,
_("This expression is deprecated.") +
(deprecationMessage.empty() ? "" : " " + deprecationMessage),
function.location);
deprecationWarnings.push_back(diagnostic.get());
supplementalErrors.push_back(std::move(diagnostic));
}

// Validate the type of the function
Expand Down
14 changes: 14 additions & 0 deletions Core/GDCore/IDE/Events/ExpressionValidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,20 @@ class GD_CORE_API ExpressionValidator : public ExpressionParser2NodeWorker {
supplementalErrors.push_back(std::move(diagnostic));
}

void RaiseWarning(gd::ExpressionParserError::ErrorType type,
const gd::String &message,
const ExpressionParserLocation &location,
const gd::String &actualValue = "",
const gd::String &objectName = "") {
auto diagnostic = gd::make_unique<ExpressionParserError>(
type, message, location, actualValue, objectName);
deprecationWarnings.push_back(diagnostic.get());
// Warnings found by the validator are not holden by the AST nodes.
// They must be owned by the validator to keep living while warnings are
// handled by the caller.
supplementalErrors.push_back(std::move(diagnostic));
}

void RaiseUnknownIdentifierError(const gd::String &message,
const ExpressionParserLocation &location) {
RaiseError(gd::ExpressionParserError::ErrorType::UnknownIdentifier, message,
Expand Down
Loading