public ModuleDefn GetModule()
 {
     if (parent != null)
     {
         return(parent.GetModule());
     }
     else
     {
         return(null);
     }
 }
Exemple #2
0
        public static FunctionDefn CreateMethod(ParseNode x, HeronType parent)
        {
            ModuleDefn   module = parent.GetModule();
            FunctionDefn r      = new FunctionDefn(parent);

            r.annotations = CreateAnnotations(x);
            r.node        = x;
            ParseNode fundecl = x.GetChild("fundecl");

            r.name    = fundecl.GetChild("name").ToString();
            r.formals = CreateFormalArgs(fundecl.GetChild("arglist"));
            ParseNode rt = x.GetChild("typedecl");

            r.rettype = CreateTypeRef(rt);
            ParseNode codeblock = x.GetChild("codeblock");

            r.body = CreateCodeBlock(codeblock);
            return(r);
        }