<commit_before>package scala.meta.internal
package interpreter

import scala.util.matching._
import scala.meta._
import scala.meta.semantic._
import scala.meta.internal.{ ast => m }
import scala.meta.dialects.Scala211

import scala.collection.immutable.ListMap
import scala.meta.internal.interpreter.Environment._
import org.scalameta._
import org.scalameta.invariants._

object Interpreter {

  def eval(term: Term)(implicit c: Context): Any = eval(term, Map[Term.Name, Any]())

  def eval(term: Term, env0: Map[Term.Name, Any])(implicit c: Context): Any = {
    def typeOf(v: Any): Type = {
      if (v == null) return t"Null"
      def loadModule(root: Term.Name, parts: List[String]): Term.Name = parts match {
        case Nil => 
          root
        case name :: rest => 
          val children = root.members.filter(m => (m.isPackage || m.isObject) && m.name.toString == name)
          if (children.isEmpty) sys.error(s"typeOf(${v.getClass}) has failed: $name not found in $root")
          val child = children.head.asInstanceOf[Member.Term]
          loadModule(child.name, rest)
      }
      val init :+ last = v.getClass.getName.split(Array('.', '$')).toList
      loadModule(q"_root_", init).classes(last).name
    }
    val frame0 = ListMap(env0.map{ case (k, v) => (k.asInstanceOf[TName], Object(v, typeOf(v))) }.toList: _*)
    val env1 = Env(List(frame0), ListMap[m.Term.Name, Object]())
    val (Object(v, tpe, fields), env2) = eval(term, env1)
    v
  }<commit_msg>exposes the runtime classpath > compiletime classpath issue<commit_after>package scala.meta.internal
package interpreter

import scala.util.matching._
import scala.meta._
import scala.meta.semantic._
import scala.meta.internal.{ ast => m }
import scala.meta.dialects.Scala211

import scala.collection.immutable.ListMap
import scala.meta.internal.interpreter.Environment._
import org.scalameta._
import org.scalameta.invariants._

object Interpreter {

  def eval(term: Term)(implicit c: Context): Any = eval(term, Map[Term.Name, Any]())

  def eval(term: Term, env0: Map[Term.Name, Any])(implicit c: Context): Any = {
    def typeOf(v: Any): Type = {
      if (v == null) return t"Null"
      if (v.isInstanceOf[Context]) return t"Context"
      def loadModule(root: Term.Name, parts: List[String]): Term.Name = parts match {
        case Nil => 
          root
        case name :: rest => 
          val children = root.members.filter(m => (m.isPackage || m.isObject) && m.name.toString == name)
          if (children.isEmpty) sys.error(s"typeOf(${v.getClass}) has failed: $name not found in $root")
          val child = children.head.asInstanceOf[Member.Term]
          loadModule(child.name, rest)
      }
      val init :+ last = v.getClass.getName.split(Array('.', '$')).toList
      loadModule(q"_root_", init).classes(last).name
    }
    val frame0 = ListMap(env0.map{ case (k, v) => (k.asInstanceOf[TName], Object(v, typeOf(v))) }.toList: _*)
    val env1 = Env(List(frame0), ListMap[m.Term.Name, Object]())
    val (Object(v, tpe, fields), env2) = eval(term, env1)
    v
  }
{'fraction_non_alphanumeric': 0.14829268292682926, 'fraction_numerical': 0.0065040650406504065, 'mean_word_length': 3.413199426111908, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '3023117', 'n_tokens_mistral': 1041, 'n_tokens_neox': 1027, 'n_words': 248}