diff options
author | Justin Clark-Casey (justincc) | 2013-03-13 00:19:37 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-03-13 00:19:37 +0000 |
commit | 0d25be3f8162fc4e99cd5abdaceb425a1f7370fe (patch) | |
tree | e005b69815f651f81c99d03ed2dfc25a698a9cf5 /OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |
parent | Add DisableInterRegionTeleportCancellation option in [EntityTransfer] section... (diff) | |
download | opensim-SC_OLD-0d25be3f8162fc4e99cd5abdaceb425a1f7370fe.zip opensim-SC_OLD-0d25be3f8162fc4e99cd5abdaceb425a1f7370fe.tar.gz opensim-SC_OLD-0d25be3f8162fc4e99cd5abdaceb425a1f7370fe.tar.bz2 opensim-SC_OLD-0d25be3f8162fc4e99cd5abdaceb425a1f7370fe.tar.xz |
Make C# scripts return correct error line and column numbers instead of failing because they have no linemap.
Adapted fix from http://opensimulator.org/mantis/view.php?id=6571
Thanks Nickel Briand
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 9d20c9e..b71afe3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -662,13 +662,18 @@ namespace SecondLife | |||
662 | { | 662 | { |
663 | string severity = CompErr.IsWarning ? "Warning" : "Error"; | 663 | string severity = CompErr.IsWarning ? "Warning" : "Error"; |
664 | 664 | ||
665 | KeyValuePair<int, int> lslPos; | 665 | KeyValuePair<int, int> errorPos; |
666 | 666 | ||
667 | // Show 5 errors max, but check entire list for errors | 667 | // Show 5 errors max, but check entire list for errors |
668 | 668 | ||
669 | if (severity == "Error") | 669 | if (severity == "Error") |
670 | { | 670 | { |
671 | lslPos = FindErrorPosition(CompErr.Line, CompErr.Column, m_lineMaps[assembly]); | 671 | // C# scripts will not have a linemap since theres no line translation involved. |
672 | if (!m_lineMaps.ContainsKey(assembly)) | ||
673 | errorPos = new KeyValuePair<int, int>(CompErr.Line, CompErr.Column); | ||
674 | else | ||
675 | errorPos = FindErrorPosition(CompErr.Line, CompErr.Column, m_lineMaps[assembly]); | ||
676 | |||
672 | string text = CompErr.ErrorText; | 677 | string text = CompErr.ErrorText; |
673 | 678 | ||
674 | // Use LSL type names | 679 | // Use LSL type names |
@@ -678,7 +683,7 @@ namespace SecondLife | |||
678 | // The Second Life viewer's script editor begins | 683 | // The Second Life viewer's script editor begins |
679 | // countingn lines and columns at 0, so we subtract 1. | 684 | // countingn lines and columns at 0, so we subtract 1. |
680 | errtext += String.Format("({0},{1}): {4} {2}: {3}\n", | 685 | errtext += String.Format("({0},{1}): {4} {2}: {3}\n", |
681 | lslPos.Key - 1, lslPos.Value - 1, | 686 | errorPos.Key - 1, errorPos.Value - 1, |
682 | CompErr.ErrorNumber, text, severity); | 687 | CompErr.ErrorNumber, text, severity); |
683 | hadErrors = true; | 688 | hadErrors = true; |
684 | } | 689 | } |