public ILSLTreePreePass EnterEventScope(LSLParser.EventHandlerContext context,
                                                LSLParsedEventHandlerSignature eventSig)
        {
            _parameterScopeVariables.Clear();
            CurrentFunctionBodySignature = null;
            CurrentFunctionContext       = null;

            CurrentEventHandlerSignature = eventSig;
            CurrentEventHandlerContext   = context;

            if (eventSig.ParameterListNode != null)
            {
                //define all the parameters in the local scope, they are not considered constant in the analysis
                foreach (var parameter in eventSig.ParameterListNode.Parameters)
                {
                    //parameter references are implicitly not constant
                    var parameterRef = LSLVariableDeclarationNode.CreateParameter(parameter);


                    _parameterScopeVariables.Add(parameter.Name, parameterRef);
                }
            }

            return(DoLabelCollectorPrePass(context));
        }
Example #2
0
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="parameterList" /> or <paramref name="code" /> is
        ///     <c>null</c>.
        /// </exception>
        internal LSLEventHandlerNode(LSLParser.EventHandlerContext context, LSLParameterListNode parameterList,
                                     LSLCodeScopeNode code)
        {
            if (parameterList == null)
            {
                throw new ArgumentNullException("parameterList");
            }

            if (code == null)
            {
                throw new ArgumentNullException("code");
            }

            Name = context.handler_name.Text;

            Code               = code;
            Code.Parent        = this;
            Code.CodeScopeType = LSLCodeScopeType.EventHandler;

            ParameterList        = parameterList;
            ParameterList.Parent = this;


            SourceRange     = new LSLSourceCodeRange(context);
            SourceRangeName = new LSLSourceCodeRange(context.handler_name);

            SourceRangesAvailable = true;
        }
        private LSLLabelCollectorPrePass DoLabelCollectorPrePass(
            LSLParser.EventHandlerContext context)
        {
            var r = new LSLLabelCollectorPrePass(this, ValidatorStrategies);

            r.Visit(context);
            return(r);
        }
Example #4
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="LSLParser.eventHandler"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitEventHandler([NotNull] LSLParser.EventHandlerContext context)
 {
 }
Example #5
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="LSLParser.eventHandler"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitEventHandler([NotNull] LSLParser.EventHandlerContext context)
 {
     return(VisitChildren(context));
 }