private Automaton ToAutomatonAllowMutate( IDictionary <string, Automaton> automata, IAutomatonProvider automatonProvider, bool minimize) { bool @bool = false; if (allowMutation) { @bool = RegExp.SetAllowMutate(true); // This is not thead safe. } Automaton a = this.ToAutomaton(automata, automatonProvider, minimize); if (allowMutation) { RegExp.SetAllowMutate(@bool); } return(a); }