Ejemplo n.º 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);
        }
Ejemplo n.º 2
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);
        }