Better error handling when variable is not found
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2019-09-12 18:25:18 +02:00
parent 73142afa8a
commit bae3e92577
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 2 additions and 2 deletions

View File

@ -406,7 +406,7 @@ namespace Porygon::Binder {
if (scope == -1) {
this->_scriptData->Diagnostics->LogError(Diagnostics::DiagnosticCode::VariableNotFound,
expression->GetStartPosition(),
expression->GetLength());
expression->GetLength(), {key.GetDebugString()});
return new BoundBadExpression(expression->GetStartPosition(), expression->GetLength());
}
auto var = this->_scope->GetVariable(scope, key);

View File

@ -11,7 +11,7 @@ namespace Porygon::Diagnostics {
{DiagnosticCode ::NoBinaryOperationFound, "No binary operation found for these operands and operator."},
{DiagnosticCode ::NoUnaryOperationFound, "No unary operation found for this operand and operator."},
{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 ::CantIndex, "Unable to index type {0} with {1}."},
{DiagnosticCode ::InvalidReturnType, "Invalid return type."},