Ejemplo n.º 1
0
 public override void Init(AstContext context, ParseTreeNode treeNode) {
   base.Init(context, treeNode);
   //child #0 is usually a keyword like "def"
   var nodes = treeNode.GetMappedChildNodes();
   NameNode = AddChild("Name", nodes[1]);
   Lambda = new LambdaNode(context, treeNode, nodes[2], nodes[3]);
   Lambda.Parent = this; 
   AsString = "<Function " + NameNode.AsString + ">";
   //Lamda will set treeNode.AstNode to itself, we need to set it back to "this" here
   treeNode.AstNode = this; //
 }
Ejemplo n.º 2
0
        public override void Init(AstContext context, ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);
            //child #0 is usually a keyword like "def"
            var nodes = treeNode.GetMappedChildNodes();

            NameNode      = AddChild("Name", nodes[1]);
            Lambda        = new LambdaNode(context, treeNode, nodes[2], nodes[3]); //node, params, body
            Lambda.Parent = this;
            AsString      = "<Function " + NameNode.AsString + ">";
            //Lamda will set treeNode.AstNode to itself, we need to set it back to "this" here
            treeNode.AstNode = this; //
        }
Ejemplo n.º 3
0
 public Closure(Scope parentScope, LambdaNode targetNode) {
   ParentScope = parentScope;
   Lamda = targetNode;
 }
Ejemplo n.º 4
0
 public Closure(Scope parentScope, LambdaNode targetNode)
 {
     CreatorScope = parentScope;
     Lamda        = targetNode;
 }