Fix issues where reported LSL compiler error line numbers do not match the script.

This is probably due to changes in the layout of the generated script preamble (using statements etc, ) in c8afc852 (Jan 17 2013).
Re-enabled existing regression test that exercises at least one case of this.
bullet-2.82
Justin Clark-Casey (justincc) 2014-05-24 00:12:23 +01:00
parent cf95b65c10
commit 9bae636ff0
2 changed files with 16 additions and 16 deletions

View File

@ -162,7 +162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
m_braceCount++;
// line number
m_CSharpLine += 3;
m_CSharpLine += 9;
// here's the payload
retstr += GenerateLine();

View File

@ -92,7 +92,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
/// Test the C# compiler error message can be mapped to the correct
/// line/column in the LSL source when an undeclared variable is used.
/// </summary>
//[Test]
[Test]
public void TestUseUndeclaredVariable()
{
TestHelpers.InMethod();
@ -110,24 +110,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null);
System.Console.WriteLine(output);
output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null);
// System.Console.WriteLine(output);
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap;
m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
foreach (KeyValuePair<int, int> key in positionMap.Keys)
{
KeyValuePair<int, int> val = positionMap[key];
System.Console.WriteLine("{0},{1} => {2},{3}", key.Key, key.Value, val.Key, val.Value);
}
foreach (CompilerError compErr in m_compilerResults.Errors)
{
System.Console.WriteLine("Error: {0},{1} => {2}", compErr.Line, compErr.Column, compErr);
}
//
// foreach (KeyValuePair<int, int> key in positionMap.Keys)
// {
// KeyValuePair<int, int> val = positionMap[key];
//
// System.Console.WriteLine("{0},{1} => {2},{3}", key.Key, key.Value, val.Key, val.Value);
// }
//
// foreach (CompilerError compErr in m_compilerResults.Errors)
// {
// System.Console.WriteLine("Error: {0},{1} => {2}", compErr.Line, compErr.Column, compErr);
// }
Assert.AreEqual(
new KeyValuePair<int, int>(5, 21),