⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 foreigncompiler.scala

📁 JAVA 语言的函数式编程扩展
💻 SCALA
字号:
/*                     __                                               *\**     ________ ___   / /  ___     Scala Ant Tasks                      ****    / __/ __// _ | / /  / _ |    (c) 2005-2008, LAMP/EPFL             ****  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **** /____/\___/_/ |_/____/_/ | |                                         ****                          |/                                          **\*                                                                      */package scala.tools.ant.sabbusimport java.io.Fileimport scala.tools.nsc._import scala.tools.nsc.reporters.ConsoleReporterclass ForeignCompiler {    private var argsBuffer: Array[String] = null  def args: Array[String] = argsBuffer  def args_=(a: Array[String]): Unit = {    argsBuffer = a    nsc  }    private val error: (String => Nothing) = { msg => throw new Exception(msg) }    private def settings = new scala.tools.nsc.Settings(error)    private lazy val reporter = new ConsoleReporter(settings)    private lazy val nsc: Global = {    try {      val command = new CompilerCommand(args.toList, settings, error, false)      new Global(command.settings, reporter)    }    catch {      case ex @ FatalError(msg) =>        throw new Exception(msg, ex)    }  }    def compile(files: Array[File]): Int = {    val command = new CompilerCommand(files.toList.map(_.toString), settings, error, true)    (new nsc.Run) compile command.files    reporter.ERROR.count << 16 | reporter.WARNING.count  }  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -