<commit_before>import BinaryOpPatcher from './BinaryOpPatcher.js';

export default class FloorDivideOpPatcher extends BinaryOpPatcher {
  /**
   * LEFT '//' RIGHT
   */
  patchAsExpression() {
    let operator = this.getOperatorToken();
    // `a // b` → `Math.floor(a // b`
    //             ^^^^^^^^^^^
    this.insert(this.contentStart, 'Math.floor(');

    // Patch LEFT and RIGHT.
    super.patchAsExpression();

    // `Math.floor(a // b` → `Math.floor(a // b)`
    //                                         ^
    this.insert(this.contentEnd, ')');
    // `Math.floor(a // b)` → `Math.floor(a / b)`
    //               ^^                     ^
    this.overwrite(operator.start, operator.end, '/');
  }
}<commit_msg>Patch parts of `FloorDivideOp` in source order.<commit_after>import BinaryOpPatcher from './BinaryOpPatcher.js';

export default class FloorDivideOpPatcher extends BinaryOpPatcher {
  /**
   * LEFT '//' RIGHT
   */
  patchAsExpression() {
    let operator = this.getOperatorToken();

    // `a // b` → `Math.floor(a // b`
    //             ^^^^^^^^^^^
    this.insert(this.contentStart, 'Math.floor(');

    this.left.patch();

    // `Math.floor(a // b)` → `Math.floor(a / b)`
    //               ^^                     ^
    this.overwrite(operator.start, operator.end, '/');

    this.right.patch();

    // `Math.floor(a // b` → `Math.floor(a // b)`
    //                                         ^
    this.insert(this.contentEnd, ')');
  }
}
{'fraction_non_alphanumeric': 0.18453188602442333, 'fraction_numerical': 0.0, 'mean_word_length': 1.7365491651205938, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2644435', 'n_tokens_mistral': 481, 'n_tokens_neox': 454, 'n_words': 85}