private string GetSignature(VBAParser.FunctionStmtContext context) { if (context == null) { return(null); } var @static = context.STATIC() == null ? string.Empty : context.STATIC().GetText() + ' '; var keyword = context.FUNCTION().GetText() + ' '; var args = context.argList() == null ? "()" : context.argList().GetText() + ' '; var asTypeClause = context.asTypeClause() == null ? string.Empty : context.asTypeClause().GetText(); var visibility = context.visibility() == null ? string.Empty : context.visibility().GetText() + ' '; return(visibility + @static + keyword + context.functionName().identifier().GetText() + args + asTypeClause); }
public override void EnterFunctionStmt(VBAParser.FunctionStmtContext context) { var accessibility = GetProcedureAccessibility(context.visibility()); var identifier = context.functionName().identifier(); if (identifier == null) { return; } var name = Identifier.GetName(identifier); var asTypeClause = context.asTypeClause(); var asTypeName = asTypeClause == null ? Tokens.Variant : asTypeClause.type().GetText(); var typeHint = Identifier.GetTypeHintValue(identifier); var isArray = asTypeClause != null && asTypeClause.type().LPAREN() != null; var declaration = CreateDeclaration( name, asTypeName, accessibility, DeclarationType.Function, context, context.functionName().identifier().GetSelection(), isArray, asTypeClause, typeHint); AddDeclaration(declaration); SetCurrentScope(declaration, name); }
public ProcedureNode(VBAParser.FunctionStmtContext context, string scope, string localScope) : this(context, scope, localScope, VBProcedureKind.Function, context.visibility(), context.ambiguousIdentifier(), () => context.asTypeClause()) { _argsListContext = context.argList(); _staticNode = context.STATIC(); _keyword = context.FUNCTION(); _asTypeClauseContext = context.asTypeClause(); }
public static string Signature(this VBAParser.FunctionStmtContext context) { var visibility = context.visibility(); var visibilityText = visibility == null ? string.Empty : visibility.GetText(); var identifierText = context.ambiguousIdentifier().GetText(); var argsText = context.argList().GetText(); var asType = context.asTypeClause(); var asTypeText = asType == null ? string.Empty : asType.GetText(); return((visibilityText + ' ' + Tokens.Function + ' ' + identifierText + argsText + ' ' + asTypeText).Trim()); }
public override void EnterFunctionStmt(VBAParser.FunctionStmtContext context) { var accessibility = GetProcedureAccessibility(context.visibility()); var name = context.ambiguousIdentifier().GetText(); var asTypeClause = context.asTypeClause(); var asTypeName = asTypeClause == null ? Tokens.Variant : asTypeClause.type().GetText(); var declaration = CreateDeclaration(name, asTypeName, accessibility, DeclarationType.Function, context, context.ambiguousIdentifier().GetSelection()); _declarations.Add(declaration); SetCurrentScope(name); }