public override void ExitVariableListStmt([NotNull] VBAParser.VariableListStmtContext context)
 {
     if (context.variableSubStmt().Length > 1)
     {
         _contexts.Add(new QualifiedContext <ParserRuleContext>(CurrentModuleName, context));
     }
 }
Exemplo n.º 2
0
 public override void ExitVariableListStmt([NotNull] VBAParser.VariableListStmtContext context)
 {
     if (context.variableSubStmt().Length > 1)
     {
         SaveContext(context);
     }
 }
        private static RewriterInfo GetRewriterInfo(VBAParser.VariableSubStmtContext variable, VBAParser.VariableListStmtContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context), @"Context is null. Expecting a VBAParser.VariableListStmtContext instance.");
            }

            var items     = context.variableSubStmt();
            var itemIndex = items.ToList().IndexOf(variable);
            var count     = items.Length;

            if (context.Parent.Parent is VBAParser.ModuleDeclarationsElementContext element)
            {
                return(GetModuleVariableRemovalInfo(variable, element, count, itemIndex, items));
            }

            if (context.Parent is VBAParser.VariableStmtContext)
            {
                return(GetLocalVariableRemovalInfo(variable, context, count, itemIndex, items));
            }

            return(RewriterInfo.None);
        }