From 9bae636ff0dc426e913e26c45b6936f16131f6d5 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 24 May 2014 00:12:23 +0100 Subject: [PATCH] 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. --- .../Shared/CodeTools/CSCodeGenerator.cs | 2 +- .../Shared/CodeTools/Tests/CompilerTest.cs | 30 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index 6aa717db03..8b8e038951 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs @@ -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(); diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs index ab68793252..badf82adc1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs @@ -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. /// - //[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> positionMap = cg.PositionMap; m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); - - foreach (KeyValuePair key in positionMap.Keys) - { - KeyValuePair 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 key in positionMap.Keys) +// { +// KeyValuePair 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(5, 21),