If the LSL state_entry() event definition contains any parameters, then generate syntax error as seen on the LL grid

This is done through the parser and so generates the same syntax error message if any parameters are wrongly specified for this event.
We were already enforcing event names in the parser.
This is only for state_entry so far as an initial test of the approach - appears to work correctly.
varregion
Justin Clark-Casey (justincc) 2013-11-02 00:39:12 +00:00
parent 7faf286d00
commit 2b069a3b1e
4 changed files with 7761 additions and 7540 deletions

View File

@ -610,6 +610,7 @@ namespace SecondLife
results = CScodeProvider.CompileAssemblyFromSource( results = CScodeProvider.CompileAssemblyFromSource(
parameters, Script); parameters, Script);
} }
// Deal with an occasional segv in the compiler. // Deal with an occasional segv in the compiler.
// Rarely, if ever, occurs twice in succession. // Rarely, if ever, occurs twice in succession.
// Line # == 0 and no file name are indications that // Line # == 0 and no file name are indications that
@ -647,15 +648,19 @@ namespace SecondLife
"language type \"" + lang.ToString() + "\""); "language type \"" + lang.ToString() + "\"");
} }
// Check result // foreach (Type type in results.CompiledAssembly.GetTypes())
// Go through errors // {
// foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static))
// {
// m_log.DebugFormat("[COMPILER]: {0}.{1}", type.FullName, method.Name);
// }
// }
// //
// WARNINGS AND ERRORS // WARNINGS AND ERRORS
// //
bool hadErrors = false; bool hadErrors = false;
string errtext = String.Empty; string errtext = String.Empty;
if (results.Errors.Count > 0) if (results.Errors.Count > 0)
{ {
foreach (CompilerError CompErr in results.Errors) foreach (CompilerError CompErr in results.Errors)

View File

@ -27,12 +27,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection;
using log4net;
using Tools; using Tools;
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
{ {
public class LSL2CSCodeTransformer public class LSL2CSCodeTransformer
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private SYMBOL m_astRoot = null; private SYMBOL m_astRoot = null;
private static Dictionary<string, string> m_datatypeLSL2OpenSim = null; private static Dictionary<string, string> m_datatypeLSL2OpenSim = null;
@ -78,6 +82,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
/// <param name="s">The current node to transform.</param> /// <param name="s">The current node to transform.</param>
private void TransformNode(SYMBOL s) private void TransformNode(SYMBOL s)
{ {
// m_log.DebugFormat("[LSL2CSCODETRANSFORMER]: Tranforming node {0}", s);
// make sure to put type lower in the inheritance hierarchy first // make sure to put type lower in the inheritance hierarchy first
// ie: since IdentConstant and StringConstant inherit from Constant, // ie: since IdentConstant and StringConstant inherit from Constant,
// put IdentConstant and StringConstant before Constant // put IdentConstant and StringConstant before Constant
@ -103,10 +109,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
// We need to check for that here. // We need to check for that here.
if (null != s.kids[i]) if (null != s.kids[i])
{ {
// m_log.Debug("[LSL2CSCODETRANSFORMER]: Moving down level");
if (!(s is Assignment || s is ArgumentDeclarationList) && s.kids[i] is Declaration) if (!(s is Assignment || s is ArgumentDeclarationList) && s.kids[i] is Declaration)
AddImplicitInitialization(s, i); AddImplicitInitialization(s, i);
TransformNode((SYMBOL) s.kids[i]); TransformNode((SYMBOL) s.kids[i]);
// m_log.Debug("[LSL2CSCODETRANSFORMER]: Moving up level");
} }
} }
} }

View File

@ -762,6 +762,7 @@ default
public void TestIfStatement() public void TestIfStatement()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// TestHelpers.EnableLogging();
string input = @"// let's test if statements string input = @"// let's test if statements

File diff suppressed because it is too large Load Diff