Example #1
0
 public override void ExitModuleAttributes(VBAParser.ModuleAttributesContext context)
 {
     if (_currentScopeAttributes.Any() && !_attributes.ContainsKey(_currentScope))
     {
         _attributes.Add(_currentScope, _currentScopeAttributes);
     }
 }
Example #2
0
            public override void EnterModuleAttributes(VBAParser.ModuleAttributesContext context)
            {
                // note: using ModuleAttributesContext for module-scope

                if (_currentScopeDeclaration == null)
                {
                    // we're at the top of the module.
                    // everything we pick up between here and the module body, is module-scoped:
                    _currentScopeDeclaration = _state.DeclarationFinder.UserDeclarations(DeclarationType.Module)
                                               .SingleOrDefault(d => d.QualifiedName.QualifiedModuleName.Equals(CurrentModuleName));
                }
                else
                {
                    // DO NOT re-assign _currentScope here.
                    // we're at the end of the module and that attribute is actually scoped to the last procedure.
                    Debug.Assert(_currentScopeDeclaration != null); // deliberate no-op
                }
            }
Example #3
0
 public override void ExitModuleAttributes(VBAParser.ModuleAttributesContext context)
 {
     _attributes.Add(_currentScope, _currentScopeAttributes);
 }