<commit_before>/*
 * Scala (https://www.scala-lang.org)
 *
 * Copyright EPFL and Lightbend, Inc.
 *
 * Licensed under Apache License 2.0
 * (http://www.apache.org/licenses/LICENSE-2.0).
 *
 * See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.
 */

package scala.tools.nsc
package symtab
package classfile

import java.lang.Float.floatToIntBits
import java.lang.Double.doubleToLongBits
import java.util.Arrays.fill

import scala.io.Codec
import scala.reflect.internal.pickling.{PickleBuffer, PickleFormat}
import scala.reflect.internal.util.shortClassOfInstance
import scala.collection.mutable
import PickleFormat._
import Flags._
import scala.annotation.tailrec
import scala.reflect.io.PlainFile

/**
 * Serialize a top-level module and/or class.
 *
 * @see [[PickleFormat]] for symbol table attribute format.
 *
 * @author <NAME>
 */
abstract class Pickler extends SubComponent {
  import global._

  val phaseName = "pickler"

  def newPhase(prev: Phase): StdPhase = new PicklePhase(prev)

  class PicklePhase(prev: Phase) extends StdPhase(prev) {
    import global.genBCode.postProcessor.classfileWriters.FileWriter
    private lazy val sigWriter: Option[FileWriter] =
      if (settings.YpickleWrite.isSetByUser && !settings.YpickleWrite.value.isEmpty)
        Some(FileWriter(global, new PlainFile(settings.YpickleWrite.value), None))
      else
        None

    def apply(unit: CompilationUnit): Unit = {
      def pickle(tree: Tree): Unit = {
        tree match {
          case PackageDef(_, stats) =>
            stats foreach pickle
          case ClassDef(_, _, _, _) | ModuleDef(_, _, _) =>
            val sym = tree.symbol
            def shouldPickle(sym: Symbol) = currentRun.compiles(sym) && !currentRun.symData.contains(sym)
            if (shouldPickle(sym)) {
              val pickle = initPickle(sym) { pickle =>
                def reserveDeclEntries(sym: Symbol): Unit = {
                  pickle.reserveEntry(sym)<commit_msg>Fix link to PickleFormat in Pickler<commit_after>/*
 * Scala (https://www.scala-lang.org)
 *
 * Copyright EPFL and Lightbend, Inc.
 *
 * Licensed under Apache License 2.0
 * (http://www.apache.org/licenses/LICENSE-2.0).
 *
 * See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.
 */

package scala.tools.nsc
package symtab
package classfile

import java.lang.Float.floatToIntBits
import java.lang.Double.doubleToLongBits
import java.util.Arrays.fill

import scala.io.Codec
import scala.reflect.internal.pickling.{PickleBuffer, PickleFormat}
import scala.reflect.internal.util.shortClassOfInstance
import scala.collection.mutable
import PickleFormat._
import Flags._
import scala.annotation.tailrec
import scala.reflect.io.PlainFile

/**
 * Serialize a top-level module and/or class.
 *
 * @see [[scala.reflect.internal.pickling.PickleFormat PickleFormat]] for symbol table attribute format.
 *
 * @author <NAME>
 */
abstract class Pickler extends SubComponent {
  import global._

  val phaseName = "pickler"

  def newPhase(prev: Phase): StdPhase = new PicklePhase(prev)

  class PicklePhase(prev: Phase) extends StdPhase(prev) {
    import global.genBCode.postProcessor.classfileWriters.FileWriter
    private lazy val sigWriter: Option[FileWriter] =
      if (settings.YpickleWrite.isSetByUser && !settings.YpickleWrite.value.isEmpty)
        Some(FileWriter(global, new PlainFile(settings.YpickleWrite.value), None))
      else
        None

    def apply(unit: CompilationUnit): Unit = {
      def pickle(tree: Tree): Unit = {
        tree match {
          case PackageDef(_, stats) =>
            stats foreach pickle
          case ClassDef(_, _, _, _) | ModuleDef(_, _, _) =>
            val sym = tree.symbol
            def shouldPickle(sym: Symbol) = currentRun.compiles(sym) && !currentRun.symData.contains(sym)
            if (shouldPickle(sym)) {
              val pickle = initPickle(sym) { pickle =>
                def reserveDeclEntries(sym: Symbol): Unit = {
                  pickle.reserveEntry(sym)
{'fraction_non_alphanumeric': 0.10232558139534884, 'fraction_numerical': 0.0019583843329253367, 'mean_word_length': 3.3421891604675875, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, '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': '3953882', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1203, 'n_words': 299}