diff options
author | Lex Spoon <lex@lexspoon.org> | 2006-05-19 13:12:40 +0000 |
---|---|---|
committer | Lex Spoon <lex@lexspoon.org> | 2006-05-19 13:12:40 +0000 |
commit | 953466de7c48dacde62c3c5e03d1f79dce547a7e (patch) | |
tree | df0600bc2d81a7bbf80429d3d4698c11b6adda80 /src | |
parent | a31e6c4000afaf023d7029b2e771e9b6242c8dbd (diff) | |
download | scala-953466de7c48dacde62c3c5e03d1f79dce547a7e.tar.gz scala-953466de7c48dacde62c3c5e03d1f79dce547a7e.tar.bz2 scala-953466de7c48dacde62c3c5e03d1f79dce547a7e.zip |
added compileSources()
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/Interpreter.scala | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala index 64945ce5f2..b05222e577 100644 --- a/src/compiler/scala/tools/nsc/Interpreter.scala +++ b/src/compiler/scala/tools/nsc/Interpreter.scala @@ -183,15 +183,20 @@ class Interpreter(val settings: Settings, reporter: Reporter, out: PrintWriter) cr.compileSources(List(new SourceFile(PlainFile.fromFile(jfile)))) } - /** Compile a string. Returns true if there are no - * compilation errors, or false otherwise. */ - def compileString(code: String): Boolean = { + /** Compile an nsc SourceFile. Returns true if there are + * no compilation errors, or false othrewise. */ + def compileSources(sources: List[SourceFile]): Boolean = { val cr = new compiler.Run reporter.reset - cr.compileSources(List(new SourceFile("<script>", code.toCharArray))) + cr.compileSources(sources) return (reporter.errors == 0) } + /** Compile a string. Returns true if there are no + * compilation errors, or false otherwise. */ + def compileString(code: String): Boolean = + compileSources(List(new SourceFile("<script>", code.toCharArray))) + /** build a request from the user. "tree" is "line" after being parsed */ private def buildRequest(trees: List[Tree], line: String, lineName: String): Request = { trees match { |