Inheritance: Rubberduck.Parsing.Symbols.Declaration
Example #1
0
        public override void EnterConstSubStmt(VBAParser.ConstSubStmtContext context)
        {
            var parent        = (VBAParser.ConstStmtContext)context.Parent;
            var accessibility = GetMemberAccessibility(parent.visibility());

            var asTypeClause = context.asTypeClause();
            var asTypeName   = asTypeClause == null
                ? Tokens.Variant
                : asTypeClause.type().GetText();

            var identifier  = context.ambiguousIdentifier();
            var name        = identifier.GetText();
            var value       = context.valueStmt().GetText();
            var declaration = new ValuedDeclaration(new QualifiedMemberName(_qualifiedName, name), _currentScope, asTypeName, accessibility, DeclarationType.Constant, value, context, identifier.GetSelection());

            _declarations.Add(declaration);
        }
        public override void EnterConstSubStmt(VBAParser.ConstSubStmtContext context)
        {
            var parent = (VBAParser.ConstStmtContext)context.Parent;
            var accessibility = GetMemberAccessibility(parent.visibility());

            var asTypeClause = context.asTypeClause();
            var asTypeName = asTypeClause == null
                ? Tokens.Variant
                : asTypeClause.type().GetText();

            var identifier = context.ambiguousIdentifier();
            if (identifier == null)
            {
                return;
            }
            var name = identifier.GetText();
            var value = context.valueStmt().GetText();
            var declaration = new ValuedDeclaration(new QualifiedMemberName(_qualifiedName, name), _parentDeclaration, _currentScope, asTypeName, accessibility, DeclarationType.Constant, value, context, identifier.GetSelection());

            OnNewDeclaration(declaration);
        }