Example #1
0
        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);
        }
Example #2
0
 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)));
 }
Example #3
0
 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]));
 }