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; // }
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; // }
public Closure(Scope parentScope, LambdaNode targetNode) { ParentScope = parentScope; Lamda = targetNode; }
public Closure(Scope parentScope, LambdaNode targetNode) { CreatorScope = parentScope; Lamda = targetNode; }