protected override AssociativeNode GetFunctionApplication(NodeModel model, List<AssociativeNode> inputAstNodes) { AssociativeNode rhs; string function = Definition.Name; switch (Definition.Type) { case FunctionType.Constructor: case FunctionType.StaticMethod: if (model.IsPartiallyApplied) { var functionNode = new IdentifierListNode { LeftNode = new IdentifierNode(Definition.ClassName), RightNode = new IdentifierNode(Definition.Name) }; rhs = CreateFunctionObject(model, functionNode, inputAstNodes); } else { model.AppendReplicationGuides(inputAstNodes); rhs = AstFactory.BuildFunctionCall( Definition.ClassName, Definition.Name, inputAstNodes); } break; case FunctionType.StaticProperty: var staticProp = new IdentifierListNode { LeftNode = new IdentifierNode(Definition.ClassName), RightNode = new IdentifierNode(Definition.Name) }; rhs = staticProp; break; case FunctionType.InstanceProperty: // Only handle getter here. Setter could be handled in CBN. if (model.IsPartiallyApplied) { var functionNode = new IdentifierListNode { LeftNode = new IdentifierNode(Definition.ClassName), RightNode = new IdentifierNode(Definition.Name) }; rhs = CreateFunctionObject(model, functionNode, inputAstNodes); } else { rhs = new NullNode(); if (inputAstNodes != null && inputAstNodes.Count >= 1) { var thisNode = inputAstNodes[0]; if (thisNode != null && !(thisNode is NullNode)) { var insProp = new IdentifierListNode { LeftNode = inputAstNodes[0], RightNode = new IdentifierNode(Definition.Name) }; rhs = insProp; } } } break; case FunctionType.InstanceMethod: if (model.IsPartiallyApplied) { var functionNode = new IdentifierListNode { LeftNode = new IdentifierNode(Definition.ClassName), RightNode = new IdentifierNode(Definition.Name) }; rhs = CreateFunctionObject(model, functionNode, inputAstNodes); } else { rhs = new NullNode(); model.AppendReplicationGuides(inputAstNodes); if (inputAstNodes != null && inputAstNodes.Count >= 1) { var thisNode = inputAstNodes[0]; inputAstNodes.RemoveAt(0); // remove this pointer if (thisNode != null && !(thisNode is NullNode)) { var memberFunc = new IdentifierListNode { LeftNode = thisNode, RightNode = AstFactory.BuildFunctionCall(function, inputAstNodes) }; rhs = memberFunc; } } } break; default: if (model.IsPartiallyApplied) { var functionNode = new IdentifierNode(function); rhs = CreateFunctionObject(model, functionNode, inputAstNodes); } else { model.AppendReplicationGuides(inputAstNodes); rhs = AstFactory.BuildFunctionCall(function, inputAstNodes); } break; } return rhs; }