1 /** 2 Copyright: Copyright (c) 2018, Joakim Brännström. All rights reserved. 3 License: MPL-2 4 Author: Joakim Brännström (joakim.brannstrom@gmx.com) 5 6 This Source Code Form is subject to the terms of the Mozilla Public License, 7 v.2.0. If a copy of the MPL was not distributed with this file, You can obtain 8 one at http://mozilla.org/MPL/2.0/. 9 */ 10 module dextool.plugin.mutate.backend.mutation_type.aors; 11 12 import dextool.plugin.mutate.backend.type; 13 import dextool.plugin.mutate.backend.analyze.ast; 14 15 Mutation.Kind aorsMutations(Kind operand) @safe { 16 Mutation.Kind rval; 17 switch (operand) with (Mutation.Kind) { 18 case Kind.OpAdd: 19 rval = aorsSub; 20 break; 21 case Kind.OpDiv: 22 rval = aorsMul; 23 break; 24 case Kind.OpMod: 25 rval = aorsDiv; 26 break; 27 case Kind.OpMul: 28 rval = aorsDiv; 29 break; 30 case Kind.OpSub: 31 rval = aorsAdd; 32 break; 33 case Kind.OpAssignAdd: 34 rval = aorsSubAssign; 35 break; 36 case Kind.OpAssignDiv: 37 rval = aorsMulAssign; 38 break; 39 case Kind.OpAssignMod: 40 rval = aorsDivAssign; 41 break; 42 case Kind.OpAssignMul: 43 rval = aorsDivAssign; 44 break; 45 case Kind.OpAssignSub: 46 rval = aorsAddAssign; 47 break; 48 default: 49 } 50 51 return rval; 52 } 53 54 immutable Mutation.Kind[] aorsMutationsAll; 55 immutable Mutation.Kind[] aorsAssignMutationsAll; 56 57 shared static this() { 58 with (Mutation.Kind) { 59 aorsMutationsAll = [aorsMul, aorsDiv, aorsAdd, aorsSub]; 60 aorsAssignMutationsAll = [ 61 aorsMulAssign, aorsDivAssign, aorsAddAssign, aorsSubAssign 62 ]; 63 } 64 }