Beispiel #1
0
 public static FunctionCallNode Call(AstNode function, ArgumentNode[] argumentNodes)
 {
     return(Call(null, function, argumentNodes));
 }
Beispiel #2
0
 public static FunctionCallNode Call(AstNode instance, AstNode function, ArgumentNode[] argumentNodes)
 {
     return(new FunctionCallNode(instance, function, _nodeIndex++, argumentNodes));
 }
Beispiel #3
0
 public static AssignNode Assign(AstNode left, AstNode right)
 {
     return(new AssignNode(left, right, _nodeIndex++));
 }
Beispiel #4
0
 public static IfElseNode IfElseThen(AstNode condition, AstNode ifTrue, AstNode ifFalse)
 {
     return(new IfElseNode(condition, ifTrue, ifFalse, _nodeIndex++));
 }
Beispiel #5
0
 public static LambdaNode Lambda(ParameterNode paremeterExpression, AstNode bodyExpression)
 {
     return(new LambdaNode(Parameters(new[] { paremeterExpression }), bodyExpression, true, _nodeIndex++));
 }
Beispiel #6
0
 public static ConditionalExpressionNode Conditional(AstNode condition, SyntaxToken questionToken, AstNode whenTrue, SyntaxToken colonToken, AstNode whenFalse)
 {
     return(new ConditionalExpressionNode(condition, whenTrue, whenFalse, _nodeIndex++));
 }
Beispiel #7
0
 public static MemberAccessNode MemberAccess(AstNode member, string declaringType, string memberType)
 {
     return(new MemberAccessNode(member, null, declaringType, memberType, _nodeIndex++));
 }
Beispiel #8
0
 public static CaseNode Case(AstNode test, AstNode body)
 {
     return(new CaseNode(test, body, _nodeIndex++));
 }
Beispiel #9
0
        public static ParameterNode Parameter(AstNode name)
        {
            var n = name.Value?.ToString();

            return(new ParameterNode(n, "any", _nodeIndex++));
        }
Beispiel #10
0
 public static ArgumentNode Argument(AstNode item, int argIndex)
 {
     return(new ArgumentNode(item, argIndex, _nodeIndex++));
 }
Beispiel #11
0
 public static FunctionNode Function(string name, string returnType, FunctionParametersNode argumentsExpression, AstNode bodyExpression)
 {
     return(new FunctionNode(name, XzaarType.GetType(returnType), argumentsExpression, bodyExpression, _nodeIndex++));
 }
Beispiel #12
0
 public static FunctionNode Function(string name, FunctionParametersNode argumentsExpression, AstNode bodyExpression)
 {
     return(new FunctionNode(name, argumentsExpression, bodyExpression, _nodeIndex++));
 }
Beispiel #13
0
 public static LambdaNode Lambda(FunctionParametersNode paremeterExpression, AstNode bodyExpression)
 {
     return(new LambdaNode(paremeterExpression, bodyExpression, false, _nodeIndex++));
 }
Beispiel #14
0
 public static ReturnNode Return(AstNode returnNode)
 {
     return(new ReturnNode(returnNode, _nodeIndex++));
 }
Beispiel #15
0
 public static MemberAccessNode MemberAccess(AstNode member, AstNode arrayIndexer)
 {
     return(new MemberAccessNode(member, arrayIndexer, "any", "any", _nodeIndex++));
 }
Beispiel #16
0
 public static CaseNode DefaultCase(AstNode body)
 {
     return(new CaseNode(null, body, _nodeIndex++));
 }
Beispiel #17
0
 public static MemberAccessChainNode MemberAccessChain(AstNode lastAccessorNode, MemberAccessNode memberAccessNode)
 {
     return(new MemberAccessChainNode(lastAccessorNode, memberAccessNode, memberAccessNode.MemberType, _nodeIndex++));
 }
Beispiel #18
0
 public static ForeachLoopNode Foreach(AstNode variableDefinition, AstNode sourceExpression, AstNode body)
 {
     if (body != null)
     {
         body.SortChildren();
     }
     return(new ForeachLoopNode(variableDefinition, sourceExpression, body, _nodeIndex++));
 }
Beispiel #19
0
 public void RemoveChild(AstNode node)
 {
     node.Parent = null;
     this.children.Remove(node);
 }