Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 1.8
distribution: 'adopt'
java-version: '17'
- name: Setup sbt launcher
uses: sbt/setup-sbt@v1
- name: Run tests
run: sbt test
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ organization := "org.scala-lang.virtualized"

version := "0.0.1-SNAPSHOT"

scalaVersion := "2.12.8"
scalaVersion := "2.12.15"

val paradiseVersion = "2.1.0"
val paradiseVersion = "2.1.1"

//crossScalaVersions := Seq("2.12.1")

Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Project properties
sbt.version=1.2.8
sbt.version=1.10.0
12 changes: 6 additions & 6 deletions src/main/scala/lms/util/ScalaCompile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait ScalaCompile {

var compiler: Global = _
var reporter: ConsoleReporter = _
//var output: ByteArrayOutputStream = _
//var output: ByteArrayOutputStream = _

def setupCompiler() = {
/*
Expand Down Expand Up @@ -44,7 +44,7 @@ trait ScalaCompile {
}

var compileCount = 0

var dumpGeneratedCode = false

def nextClassName = "staged$" + compileCount
Expand All @@ -55,9 +55,9 @@ trait ScalaCompile {
def compile[A,B](className: String, source: String, staticData: List[(Class[_],Any)]): A=>B = {
if (this.compiler eq null)
setupCompiler()

compileCount += 1

// val source = new StringWriter()
// val writer = new PrintWriter(source)
// val staticData = codegen.emitSource(f, className, writer)
Expand All @@ -76,7 +76,7 @@ trait ScalaCompile {
//compiler.genJVM.outputDir = fileSystem

run.compileSources(List(new util.BatchSourceFile("<stdin>", source.toString)))
reporter.printSummary()
reporter.finish()

if (!reporter.hasErrors)
println("compilation: ok")
Expand All @@ -91,7 +91,7 @@ trait ScalaCompile {

val cls: Class[_] = loader.loadClass(className)
val cons = cls.getConstructor(staticData.map(_._1):_*)

val obj: A=>B = cons.newInstance(staticData.map(_._2.asInstanceOf[AnyRef]):_*).asInstanceOf[A=>B]
obj
}
Expand Down