public IfCastNode(VariableNode name, ITypeNode declare, IEvaluableNode cond, IScopeNode then) { Name = name; Declare = declare; Condition = cond; Then = then; }
public static ITypeNode ExpressionToType(IEvaluableNode expr) { return(expr switch { VariableNode v => new TypeNode { Name = v.Name }, ITypeNode t => t, _ => throw new SyntaxErrorException("not type"), });
public OutputDataPin(Type type, IEvaluableNode <IEvaluableInputDataPin, IEvaluableOutputDataPin> node) { this.node = node; Type = type; }
public static BlockNode ToStatementBlock(IEvaluableNode expr) => ToBlock(expr.Cast <IStatementNode>());
public static IfCastNode CreateIfCastNode(VariableNode name, ITypeNode declare, IEvaluableNode cond, IScopeNode then) => new IfCastNode(name, declare, cond, then).R(cond);
public static IfNode CreateIfNode(IEvaluableNode cond, IScopeNode then) => new IfNode(cond, then).R(cond);
public LetPropertyNode(IEvaluableNode recv, VariableNode name, IEvaluableNode e) { Reciever = recv; Name = name; Expression = e; }
public SpecializationNode(IEvaluableNode expr) { Expression = expr; }
public static LetNode CreateLetNode(VariableNode v, IEvaluableNode e) => new LetNode(v, e).R(v);
public static FunctionCallNode CreateFunctionCallNode(IEvaluableNode expr, params IEvaluableNode[] args) => new FunctionCallNode(expr).Return(x => x.Arguments.AddRange(args)).R(expr);
public static PropertyNode CreatePropertyNode(IEvaluableNode left, VariableNode right) => new PropertyNode(left, right);
public LetNode(VariableNode v, IEvaluableNode e) { Var = v; Expression = e; }
public PropertyNode(IEvaluableNode left, VariableNode right) { Left = left; Right = right; }
public FunctionCallNode(IEvaluableNode expr) { Expression = expr; }
public static LetPropertyNode CreateLetNode(IEvaluableNode left, VariableNode right, IEvaluableNode e) => new LetPropertyNode(left, right, e).R(right);
public IfNode(IEvaluableNode cond, IScopeNode then) { Condition = cond; Then = then; }
public static LambdaExpressionNode ToLambdaExpression(IEvaluableNode expr) => new LambdaExpressionNode().Return(x => x.Statements.Add(new ImplicitReturn(expr)));
public ImplicitReturn(IEvaluableNode e) { Expression = e; }
public static IEnumerable <IEvaluableNode> PropertyToList(IEvaluableNode expr) => expr is PropertyNode p?PropertyToList(p.Left).Concat(p.Right) : new List <IEvaluableNode>()