public override void ExitModuleAttributes(VBAParser.ModuleAttributesContext context) { if (_currentScopeAttributes.Any() && !_attributes.ContainsKey(_currentScope)) { _attributes.Add(_currentScope, _currentScopeAttributes); } }
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 } }
public override void ExitModuleAttributes(VBAParser.ModuleAttributesContext context) { _attributes.Add(_currentScope, _currentScopeAttributes); }