Example #1
0
        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);
        }
Example #2
0
        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));
        }
Example #3
0
        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);
        }
Example #4
0
 public override object VisitPFunDecl(PParser.PFunDeclContext context)
 {
     return(Visit(context.functionBody()));
 }