Avoid preprocessing scripts on region restart just to generate the line
number map. Instead, write the map to a file for later use. That is not yet used, so currently runtime errors after a sim restart will have wrong line numbers0.6.5-rc1
parent
fcab3510b3
commit
eb6c1ae0c1
|
@ -300,14 +300,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||||
if (Script == String.Empty)
|
if (Script == String.Empty)
|
||||||
{
|
{
|
||||||
if (File.Exists(OutFile))
|
if (File.Exists(OutFile))
|
||||||
{
|
|
||||||
// m_log.DebugFormat("[Compiler] Returning existing assembly for {0}", asset);
|
|
||||||
return OutFile;
|
return OutFile;
|
||||||
}
|
|
||||||
|
|
||||||
throw new Exception("Cannot find script assembly and no script text present");
|
throw new Exception("Cannot find script assembly and no script text present");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't recompile if we already have it
|
||||||
|
//
|
||||||
|
if (File.Exists(OutFile) && File.Exists(OutFile+".text") && File.Exists(OutFile+".map"))
|
||||||
|
{
|
||||||
|
// TODO: Read .map file here
|
||||||
|
return OutFile;
|
||||||
|
}
|
||||||
|
|
||||||
enumCompileType l = DefaultCompileLanguage;
|
enumCompileType l = DefaultCompileLanguage;
|
||||||
|
|
||||||
if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture))
|
if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture))
|
||||||
|
@ -353,14 +358,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||||
m_positionMap = ((CSCodeGenerator) LSL_Converter).PositionMap;
|
m_positionMap = ((CSCodeGenerator) LSL_Converter).PositionMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check this late so the map is generated on sim start
|
|
||||||
//
|
|
||||||
if (File.Exists(OutFile) && File.Exists(OutFile+".text"))
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat("[Compiler] Returning existing assembly for {0}", asset);
|
|
||||||
return OutFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l == enumCompileType.yp)
|
if (l == enumCompileType.yp)
|
||||||
{
|
{
|
||||||
// Its YP, convert it to C#
|
// Its YP, convert it to C#
|
||||||
|
@ -646,6 +643,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||||
sfs.Write(buf, 0, buf.Length);
|
sfs.Write(buf, 0, buf.Length);
|
||||||
sfs.Close();
|
sfs.Close();
|
||||||
|
|
||||||
|
string posmap = String.Empty;
|
||||||
|
foreach (KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> kvp in m_positionMap)
|
||||||
|
{
|
||||||
|
KeyValuePair<int, int> k = kvp.Key;
|
||||||
|
KeyValuePair<int, int> v = kvp.Value;
|
||||||
|
posmap += String.Format("{0},{1},{2},{3}\n",
|
||||||
|
k.Key, k.Value, v.Key, v.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = enc.GetBytes(posmap);
|
||||||
|
|
||||||
|
FileStream mfs = File.Create(OutFile+".map");
|
||||||
|
mfs.Write(buf, 0, buf.Length);
|
||||||
|
mfs.Close();
|
||||||
|
|
||||||
return OutFile;
|
return OutFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue