コード例 #1
0
 public override bool Visit(CallableDeclaration node)
 {
     Visit((Declaration)node);
     TraverseSetParent(node, node.Type);
     TraverseSetParent(node, node.Directives);
     return(true);
 }
コード例 #2
0
        public override bool Visit(DeclarationList node)
        {
            CallableDeclaration insideFunction = declEnv.GetDeclaringRoutine();
            Section             outside        = insideFunction.declaringSection;

            for (int i = node.nodes.Count - 1; i >= 0; i--)
            {
                if (insideFunction != null && node.nodes[i] is CallableDeclaration)
                {
                    string name = node.nodes[i].ToString();
                    Console.WriteLine("Nesting: " + name);
                    CallableDeclaration decl = node.nodes[i] as CallableDeclaration;

                    string oldname = decl.name;
                    string newname = insideFunction.name + "_" + decl.name;
                    replacements[oldname] = newname;
                    decl.name             = newname;

                    node.nodes.RemoveAt(i);
                    if (!outside.decls.Contains(decl))
                    {
                        outside.decls.AddStart(decl);
                    }

                    traverse(decl);

                    //replacements.Remove(oldname);
                }
                else
                {
                    traverse(node.nodes[i]);
                }
            }
            return(true);
        }
コード例 #3
0
ファイル: CppCodegen.cs プロジェクト: thecocce/multipascal
        public override bool Visit(CallableDeclaration node)
        {
            ProceduralType pp = node.type as ProceduralType;

            traverse(pp.funcret);
            string name = node.name as string;

            outputCode(name, false, false);
            outputCode("(", false, false);

            DeclarationList p = [email protected];
            int             i = 0;

            foreach (ParamDeclaration pd in p)
            {
                if (i > 0)
                {
                    outputCode(", ", false, false);
                }
                traverse(pd);
                i++;
            }
            outputCode(")", false, true);
            traverse(node.Directives);
            return(true);
        }
コード例 #4
0
ファイル: TypeImporter.cs プロジェクト: ermshiperete/reko
        public SerializedType VisitCallableDeclaration(CallableDeclaration cd)
        {
            var dtRet = cd.ReturnType != null
                ? cd.ReturnType.Accept(this)
                : new VoidType_v1();

            var parameters = new List <Argument_v1>();

            foreach (var pc in cd.Parameters)
            {
                if (pc.Type == null)
                {
                    parameters.Add(new Argument_v1 {
                        Name = "..."
                    });
                }
                else
                {
                    var dt = pc.Type.Accept(this);
                    if (pc.ByReference)
                    {
                        dt = new ReferenceType_v1 {
                            Referent = dt, Size = 4
                        };
                    }
                    foreach (var n in pc.ParameterNames)
                    {
                        var p = new Argument_v1 {
                            Name = n, Type = dt
                        };
                        parameters.Add(p);
                    }
                }
            }
            return(new SerializedSignature
            {
                Arguments = parameters.ToArray(),
                ReturnValue = new Argument_v1 {
                    Type = dtRet
                }
            });
        }
コード例 #5
0
 public virtual T Visit(CallableDeclaration node)
 {
     return(Visit((Declaration)node));
 }
コード例 #6
0
ファイル: ConstantEvaluator.cs プロジェクト: zan00789/reko
 public Constant VisitCallableDeclaration(CallableDeclaration cd)
 {
     throw new NotImplementedException();
 }
コード例 #7
0
 public SerializedType VisitCallableDeclaration(CallableDeclaration cd)
 {
     return(DoCallableType(cd.Parameters, cd.ReturnType));
 }