示例#1
0
 // FuncDef
 public override bool Walk(FuncDef node)
 {
     if (node == scope)
     {
         foreach (Expr e in node.parameters)
         {
             e.Walk(fdef);
         }
         return(true);
     }
     else
     {
         Define(node.name);
         return(false);
     }
 }
示例#2
0
            public static SignatureInfo Get(FuncDef fd, CodeGen cg)
            {
                int first = 0;

                Type[] paramTypes;
                Name[] paramNames;
                Slot   contextSlot = null;

                if (fd.IsClosure)
                {
                    contextSlot = cg.EnvironmentSlot;
                }
                else
                {
                    contextSlot = cg.ContextSlot;
                }

                if (contextSlot != null)
                {
                    first      = 1;     // Skip the first argument
                    paramTypes = new Type[fd.parameters.Length + 1];
                    paramNames = new Name[fd.parameters.Length + 1];

                    paramTypes[0] = contextSlot.Type;
                    paramNames[0] = Name.Make("$env");

                    for (int i = 1; i < paramTypes.Length; i++)
                    {
                        paramTypes[i] = typeof(object);
                        paramNames[i] = makeName(fd.parameters[i - 1]);
                    }
                }
                else
                {
                    paramTypes = CompilerHelpers.MakeRepeatedArray(typeof(object), fd.parameters.Length);
                    paramNames = makeNames(fd.parameters);
                }

                return(new SignatureInfo(paramTypes, paramNames, first > 0, contextSlot));
            }
示例#3
0
 public GenExpr(FuncDef func, CallExpr call)
 {
     this.func = func;
     this.call = call;
 }
示例#4
0
 public LambdaExpr(FuncDef func)
 {
     this.func = func;
 }
示例#5
0
 public override void PostWalk(FuncDef node)
 {
     Debug.Assert(current == node);
     current = current.parent;
 }
 public virtual void PostWalk(FuncDef node)
 {
 }
 // FuncDef
 public virtual bool Walk(FuncDef node)
 {
     return(false);
 }
 // FuncDef
 public virtual bool Walk(FuncDef node)
 {
     return(true);
 }
示例#9
0
 public override bool Walk(FuncDef node)
 {
     // Do not recurse into nested functions
     return(node == func);
 }
示例#10
0
 private YieldLabelBuilder(FuncDef func, CodeGen cg)
 {
     this.func      = func;
     this.cg        = cg;
     this.topYields = new YieldTarget[func.yieldCount];
 }