public SynModuleDecl Mutate(SynModuleDecl input, FsharpCoreOrchestrator iterator)
        {
            var castinput = input as SynModuleDecl.NestedModule;

            var visitedDeclarations = iterator.Mutate(castinput.decls);

            return(SynModuleDecl.NewNestedModule(castinput.moduleInfo, castinput.isRecursive, visitedDeclarations, castinput.isContinuing, castinput.range));
        }
        public SynModuleDecl Mutate(SynModuleDecl input, FsharpCoreOrchestrator iterator)
        {
            var castinput = input as SynModuleDecl.Let;

            var childlist = new List <SynBinding>();

            foreach (var binding in castinput.bindings)
            {
                childlist.Add(SynBinding.NewBinding(binding.accessibility, binding.kind, binding.mustInline, binding.isMutable, binding.attributes, binding.xmlDoc, binding.valData, binding.headPat, binding.returnInfo, iterator.Mutate(binding.expr), binding.range, binding.seqPoint));
            }
            return(SynModuleDecl.NewLet(castinput.isRecursive, ListModule.OfSeq(childlist), castinput.range));
        }
Example #3
0
        public SynExpr Mutate(SynExpr input, FsharpCoreOrchestrator iterator)
        {
            var castinput = input as SynExpr.Match;

            var list = castinput.clauses.ToList();

            foreach (var clause in castinput.clauses)
            {
                if (clause.pat.IsConst && ((Const)clause.pat).constant.IsBool)
                {
                    //inverts boolean, true -> false and false -> true
                    list[castinput.clauses.ToList().FindIndex(x => x.Equals(clause))] = SynMatchClause.NewClause(NewConst(NewBool(!((Bool)((Const)clause.pat).constant).Item), ((Const)clause.pat).Range), clause.whenExpr, clause.resultExpr, clause.range, clause.spInfo);
                }
            }
            return(SynExpr.NewMatch(castinput.matchSeqPoint, castinput.expr, ListModule.OfSeq(list), castinput.range));
        }
Example #4
0
        public SynExpr Mutate(SynExpr input, FsharpCoreOrchestrator iterator)
        {
            var castinput = input as SynExpr.IfThenElse;

            return(SynExpr.NewIfThenElse(iterator.Mutate(castinput.ifExpr), iterator.Mutate(castinput.thenExpr), iterator.Mutate(castinput.elseExpr.Value), castinput.spIfToThen, castinput.isFromErrorRecovery, castinput.ifToThenRange, castinput.range));
        }
 public T Mutate(T input, FsharpCoreOrchestrator iterator)
 {
     return(input);
 }