public override object VisitPFunDecl(PParser.PFunDeclContext context) { // FUN name=Iden var fun = (Function)nodesToDeclarations.Get(context); // LPAREN funParamList? RPAREN var paramList = context.funParamList() != null ? (Variable[])Visit(context.funParamList()) : new Variable[0]; fun.Signature.Parameters.AddRange(paramList); // (COLON type)? fun.Signature.ReturnType = ResolveType(context.type()); // annotationSet? if (context.annotationSet() != null) { throw new NotImplementedException("function annotations"); } // functionBody // handled in later phase. return(fun); }
public override object VisitPFunDecl(PParser.PFunDeclContext context) { string symbolName = context.name.GetText(); Function decl = CurrentScope.Put(symbolName, context); nodesToDeclarations.Put(context, decl); return(VisitChildrenWithNewScope(decl, context)); }
public override object VisitPFunDecl(PParser.PFunDeclContext context) { // FUN name=Iden Function fun = (Function)nodesToDeclarations.Get(context); // LPAREN funParamList? RPAREN Variable[] paramList = context.funParamList() != null ? (Variable[])Visit(context.funParamList()) : new Variable[0]; fun.Signature.Parameters.AddRange(paramList); // (COLON type)? fun.Signature.ReturnType = ResolveType(context.type()); // functionBody // handled in later phase. return(fun); }
public override object VisitPFunDecl(PParser.PFunDeclContext context) { return(Visit(context.functionBody())); }