Better error handling when variable is not found
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
73142afa8a
commit
bae3e92577
|
@ -406,7 +406,7 @@ namespace Porygon::Binder {
|
||||||
if (scope == -1) {
|
if (scope == -1) {
|
||||||
this->_scriptData->Diagnostics->LogError(Diagnostics::DiagnosticCode::VariableNotFound,
|
this->_scriptData->Diagnostics->LogError(Diagnostics::DiagnosticCode::VariableNotFound,
|
||||||
expression->GetStartPosition(),
|
expression->GetStartPosition(),
|
||||||
expression->GetLength());
|
expression->GetLength(), {key.GetDebugString()});
|
||||||
return new BoundBadExpression(expression->GetStartPosition(), expression->GetLength());
|
return new BoundBadExpression(expression->GetStartPosition(), expression->GetLength());
|
||||||
}
|
}
|
||||||
auto var = this->_scope->GetVariable(scope, key);
|
auto var = this->_scope->GetVariable(scope, key);
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Porygon::Diagnostics {
|
||||||
{DiagnosticCode ::NoBinaryOperationFound, "No binary operation found for these operands and operator."},
|
{DiagnosticCode ::NoBinaryOperationFound, "No binary operation found for these operands and operator."},
|
||||||
{DiagnosticCode ::NoUnaryOperationFound, "No unary operation found for this operand and operator."},
|
{DiagnosticCode ::NoUnaryOperationFound, "No unary operation found for this operand and operator."},
|
||||||
{DiagnosticCode ::CantAssignVariable, "Something went wrong while assigning variable."},
|
{DiagnosticCode ::CantAssignVariable, "Something went wrong while assigning variable."},
|
||||||
{DiagnosticCode ::VariableNotFound, "Variable not found."},
|
{DiagnosticCode ::VariableNotFound, "Variable '{0}' not found."},
|
||||||
{DiagnosticCode ::ExpressionIsNotAFunction, "Called expression is not a function."},
|
{DiagnosticCode ::ExpressionIsNotAFunction, "Called expression is not a function."},
|
||||||
{DiagnosticCode ::CantIndex, "Unable to index type {0} with {1}."},
|
{DiagnosticCode ::CantIndex, "Unable to index type {0} with {1}."},
|
||||||
{DiagnosticCode ::InvalidReturnType, "Invalid return type."},
|
{DiagnosticCode ::InvalidReturnType, "Invalid return type."},
|
||||||
|
|
Loading…
Reference in New Issue