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