public static T Clone <T>(T node) where T : INode { var cloner = new AstCloner(); var clone = cloner.Visit(node); cloner.UpdateReferences(clone); return((T)clone); }
public static NativeMethodInvocationExpression AppendToArray(IParseTree context, IExpression array, IExpression value) { return(new NativeMethodInvocationExpression( context, nativeMethodName: "Append To Array", returnType: AstCloner.Clone((GenericType)array.Type), readsState: false, changesState: false, modifiesControlFlow: false, children: new INode[] { array, value }.Where(x => x != null))); }
public static NativeMethodInvocationExpression EmptyArray(IParseTree context, Root root, ITypeNode type) { return(new NativeMethodInvocationExpression( context, nativeMethodName: "Empty Array", returnType: new GenericType(context, new [] { new ReferenceType(context, root.ListDeclaration), AstCloner.Clone(type) }), readsState: false, changesState: false, modifiesControlFlow: false, children: new INode[0])); }