aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/CodeTools
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-05-24 00:12:23 +0100
committerJustin Clark-Casey (justincc)2014-05-24 00:12:23 +0100
commit9bae636ff0dc426e913e26c45b6936f16131f6d5 (patch)
treea1ff60ac9f051a25db48d722ccd26c0b933c6219 /OpenSim/Region/ScriptEngine/Shared/CodeTools
parentGet regression test TestUseUndeclaredVariable() functional again, though not ... (diff)
downloadopensim-SC-9bae636ff0dc426e913e26c45b6936f16131f6d5.zip
opensim-SC-9bae636ff0dc426e913e26c45b6936f16131f6d5.tar.gz
opensim-SC-9bae636ff0dc426e913e26c45b6936f16131f6d5.tar.bz2
opensim-SC-9bae636ff0dc426e913e26c45b6936f16131f6d5.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs30
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 6aa717d..8b8e038 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
162 m_braceCount++; 162 m_braceCount++;
163 163
164 // line number 164 // line number
165 m_CSharpLine += 3; 165 m_CSharpLine += 9;
166 166
167 // here's the payload 167 // here's the payload
168 retstr += GenerateLine(); 168 retstr += GenerateLine();
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs
index ab68793..badf82a 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
92 /// Test the C# compiler error message can be mapped to the correct 92 /// Test the C# compiler error message can be mapped to the correct
93 /// line/column in the LSL source when an undeclared variable is used. 93 /// line/column in the LSL source when an undeclared variable is used.
94 /// </summary> 94 /// </summary>
95 //[Test] 95 [Test]
96 public void TestUseUndeclaredVariable() 96 public void TestUseUndeclaredVariable()
97 { 97 {
98 TestHelpers.InMethod(); 98 TestHelpers.InMethod();
@@ -110,24 +110,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
110 CSCodeGenerator cg = new CSCodeGenerator(); 110 CSCodeGenerator cg = new CSCodeGenerator();
111 string output = cg.Convert(input); 111 string output = cg.Convert(input);
112 112
113 output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null); 113 output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null);
114 System.Console.WriteLine(output); 114// System.Console.WriteLine(output);
115 115
116 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap; 116 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap;
117 117
118 m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); 118 m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
119 119//
120 foreach (KeyValuePair<int, int> key in positionMap.Keys) 120// foreach (KeyValuePair<int, int> key in positionMap.Keys)
121 { 121// {
122 KeyValuePair<int, int> val = positionMap[key]; 122// KeyValuePair<int, int> val = positionMap[key];
123 123//
124 System.Console.WriteLine("{0},{1} => {2},{3}", key.Key, key.Value, val.Key, val.Value); 124// System.Console.WriteLine("{0},{1} => {2},{3}", key.Key, key.Value, val.Key, val.Value);
125 } 125// }
126 126//
127 foreach (CompilerError compErr in m_compilerResults.Errors) 127// foreach (CompilerError compErr in m_compilerResults.Errors)
128 { 128// {
129 System.Console.WriteLine("Error: {0},{1} => {2}", compErr.Line, compErr.Column, compErr); 129// System.Console.WriteLine("Error: {0},{1} => {2}", compErr.Line, compErr.Column, compErr);
130 } 130// }
131 131
132 Assert.AreEqual( 132 Assert.AreEqual(
133 new KeyValuePair<int, int>(5, 21), 133 new KeyValuePair<int, int>(5, 21),