Пример #1
0
 public override void DoVisit(AST_LambdaDecl node)
 {
     Console.Write("(LMBD ");
     Console.Write(node.symbol.name);
     if (node.upvals.Count > 0)
     {
         Console.Write(" USE:");
     }
     for (int i = 0; i < node.upvals.Count; ++i)
     {
         Console.Write(" " + node.upvals[i].name);
     }
     VisitChildren(node);
     Console.Write(")");
 }
Пример #2
0
        public override void DoVisit(AST_LambdaDecl ast)
        {
            var lmbd_op = Emit(Opcodes.Lambda, new int[] { 0 /*patched later*/ });

            //skipping lambda opcode
            Emit(Opcodes.InitFrame, new int[] { ast.local_vars_num + 1 /*cargs bits*/ });
            VisitChildren(ast);
            Emit(Opcodes.Return, null, ast.last_line_num);
            AddOffsetFromTo(lmbd_op, Peek());

            foreach (var p in ast.upvals)
            {
                Emit(Opcodes.UseUpval, new int[] { (int)p.upsymb_idx, (int)p.symb_idx });
            }
        }
Пример #3
0
 public abstract void DoVisit(AST_LambdaDecl ast);