Commit e2ab84e8 authored by Jesse McGrew's avatar Jesse McGrew
Browse files

Fixed the FORM inside a SEGMENT not having its source line set during parsing.

[ZILF-117]
parent b59953b4ea01
......@@ -70,6 +70,12 @@ namespace Zilf.Interpreter.Values
public override int GetHashCode() => form.GetHashCode();
public override ISourceLine? SourceLine
{
get => Form.SourceLine;
set => Form.SourceLine = value;
}
#region IStructure Members
public ZilObject? GetFirst() => form.GetFirst();
......
......@@ -31,5 +31,7 @@ namespace Zilf.Language
public string FileName { get; }
public int Line { get; }
public override string ToString() => SourceInfo;
}
}
\ No newline at end of file
......@@ -26,5 +26,7 @@ namespace Zilf.Language
}
public string SourceInfo { get; }
public override string ToString() => SourceInfo;
}
}
\ No newline at end of file
......@@ -17,6 +17,7 @@
*/
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Text.RegularExpressions;
using Zilf.Interpreter;
using Zilf.Interpreter.Values;
using Zilf.Language;
......@@ -425,6 +426,15 @@ namespace Zilf.Tests.Interpreter
ZilString.FromString("!<FOO>"));
}
[TestMethod]
public void Error_During_SEGMENT_Evaluation_Should_Include_Source_Line()
{
var ctx = new Context();
TestHelpers.Evaluate(ctx, "<DEFINE SPLICE-ELEMS () <ERROR FOO>>");
TestHelpers.EvalAndCatch<InterpreterError>(ctx, "[!<SPLICE-ELEMS>]",
ex => Regex.Match(ex.Diagnostic?.StackTrace ?? "", @"^\s*in SPLICE-ELEMS called at .*:\d+$").Success);
}
[TestMethod]
public void FUNCTION_Parameter_Atoms_Should_Not_Be_Bound_While_Arguments_Are_Being_Evaluated()
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment