private FunctionInfo ExitMethod(GoParser.IFunctionContext context) { string identifer = context.IDENTIFIER().GetText(); GoParser.SignatureContext signatureContext = context.signature(); if (!Signatures.TryGetValue(signatureContext, out Signature signature)) { signatureContext = context.signature(); Signatures.TryGetValue(signatureContext, out signature); } return(new FunctionInfo { Signature = new FunctionSignature { Name = identifer, Signature = signature, Comments = CheckForCommentsRight(signatureContext), IsPromoted = false }, Variables = new Dictionary <string, VariableInfo>(m_variables), HasDefer = m_hasDefer, HasPanic = m_hasPanic, HasRecover = m_hasRecover }); }
public override void ExitSignature(GoParser.SignatureContext context) { Parameters.TryGetValue(context.parameters(), out List <ParameterInfo> parameters); Signatures[context] = new Signature { Parameters = parameters?.ToArray() ?? new ParameterInfo[0], Result = Result?.ToArray() ?? new ParameterInfo[0] }; }
public override void EnterSignature(GoParser.SignatureContext context) { Result = new List <ParameterInfo>(new[] { new ParameterInfo { Name = "", Type = TypeInfo.VoidType, IsVariadic = false } }); }