(source, context)
| 203 | } |
| 204 | |
| 205 | mutate(source, context) { |
| 206 | let mutators = this.mutators.slice(); |
| 207 | let annotations = []; |
| 208 | if (random.choose(this.settings.SCRIPT_MUTATOR_SHUFFLE)){ |
| 209 | annotations.push(' Script mutator: using shuffled mutators'); |
| 210 | random.shuffle(mutators); |
| 211 | } |
| 212 | |
| 213 | if (random.choose(this.settings.SCRIPT_MUTATOR_EXTRA_MUTATIONS)){ |
| 214 | for (let i = random.randInt(1, MAX_EXTRA_MUTATIONS); i > 0; i--) { |
| 215 | let mutator = random.single(this.mutators); |
| 216 | mutators.push(mutator); |
| 217 | annotations.push(` Script mutator: extra ${mutator.constructor.name}`); |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | // We always remove certain closures first. |
| 222 | mutators.unshift(this.closures); |
| 223 | |
| 224 | // Try-catch wrapping should follow after error-prone mutations. |
| 225 | mutators.push(this.trycatch); |
| 226 | |
| 227 | // Non-error-prone mutations that should not get further arbitrarily mutated. |
| 228 | // It is ok to unicode escape, as we do next. |
| 229 | mutators.push(this.timeout); |
| 230 | |
| 231 | // This shouldn't get further mutated, because Babel functionality gets broken |
| 232 | // when identifier names are changed. |
| 233 | mutators.push(this.unicode); |
| 234 | |
| 235 | for (const mutator of mutators) { |
| 236 | mutator.mutate(source, context); |
| 237 | } |
| 238 | |
| 239 | for (const annotation of annotations.reverse()) { |
| 240 | sourceHelpers.annotateWithComment(source.ast, annotation); |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * Particular dependencies have precedence over others due to duplicate |
no test coverage detected