<commit_before>"use strict";

var t = require("babel-types");
var convertComments = require("./convertComments");

module.exports = function(ast, traverse, code) {
  var state = { source: code };

  // Monkey patch visitor keys in order to be able to traverse the estree nodes
  t.VISITOR_KEYS.Property = t.VISITOR_KEYS.ObjectProperty;
  t.VISITOR_KEYS.MethodDefinition = [
    "key",
    "value",
    "decorators",
    "returnType",
    "typeParameters",
  ];

  traverse(ast, astTransformVisitor, null, state);

  delete t.VISITOR_KEYS.Property;
  delete t.VISITOR_KEYS.MethodDefinition;
};

var astTransformVisitor = {
  noScope: true,
  enter(path) {
    var node = path.node;

    // private var to track original node type
    node._babelType = node.type;

    if (node.innerComments) {
      node.trailingComments = node.innerComments;
      delete node.innerComments;
    }

    if (node.trailingComments) {
      convertComments(node.trailingComments);
    }

    if (node.leadingComments) {
      convertComments(node.leadingComments);
    }
  },
  exit(path) {
    var node = path.node;

    if (path.isJSXText()) {
      node.type = "Literal";
    }

    // TODO estree plugin bug
    if (node.type === "Property") {
      if (!node.shorthand) node.shorthand = false;
    }

    if (
      path.isRestElement() &&<commit_msg>Remove already fixed workaround (babel/babel-eslint#508)<commit_after>"use strict";

var t = require("babel-types");
var convertComments = require("./convertComments");

module.exports = function(ast, traverse, code) {
  var state = { source: code };

  // Monkey patch visitor keys in order to be able to traverse the estree nodes
  t.VISITOR_KEYS.Property = t.VISITOR_KEYS.ObjectProperty;
  t.VISITOR_KEYS.MethodDefinition = [
    "key",
    "value",
    "decorators",
    "returnType",
    "typeParameters",
  ];

  traverse(ast, astTransformVisitor, null, state);

  delete t.VISITOR_KEYS.Property;
  delete t.VISITOR_KEYS.MethodDefinition;
};

var astTransformVisitor = {
  noScope: true,
  enter(path) {
    var node = path.node;

    // private var to track original node type
    node._babelType = node.type;

    if (node.innerComments) {
      node.trailingComments = node.innerComments;
      delete node.innerComments;
    }

    if (node.trailingComments) {
      convertComments(node.trailingComments);
    }

    if (node.leadingComments) {
      convertComments(node.leadingComments);
    }
  },
  exit(path) {
    var node = path.node;

    if (path.isJSXText()) {
      node.type = "Literal";
    }

    if (
      path.isRestElement() &&
{'fraction_non_alphanumeric': 0.12263787119166988, 'fraction_numerical': 0.0011569610489780178, 'mean_word_length': 3.072213500784929, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '672230', 'n_tokens_mistral': 879, 'n_tokens_neox': 821, 'n_words': 185}