summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-03-18 11:39:00 +0000
committerpaltherr <paltherr@epfl.ch>2003-03-18 11:39:00 +0000
commited5dbe847501f9bf44eba6056c537b4ce48b50e7 (patch)
tree34a07cfeca424b4fd3c0fdd8a49c4aa2318596b2 /sources
parent3307717e4e7dc1faf45accd775e5947db3652cd7 (diff)
downloadscala-ed5dbe847501f9bf44eba6056c537b4ce48b50e7.tar.gz
scala-ed5dbe847501f9bf44eba6056c537b4ce48b50e7.tar.bz2
scala-ed5dbe847501f9bf44eba6056c537b4ce48b50e7.zip
- Forced loading of scala.Interpreter with siris
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/tools/scalai/Interpreter.java9
-rw-r--r--sources/scalac/Global.java4
2 files changed, 10 insertions, 3 deletions
diff --git a/sources/scala/tools/scalai/Interpreter.java b/sources/scala/tools/scalai/Interpreter.java
index 53a36980ab..607b21cf0a 100644
--- a/sources/scala/tools/scalai/Interpreter.java
+++ b/sources/scala/tools/scalai/Interpreter.java
@@ -114,7 +114,8 @@ public class Interpreter {
if (program.length > 0) load(lfiles = program);
if (global.reporter.errors() == 0 && main != null) call(main, args);
// Compute something to start compiler and force loading of Predef
- // !!! if (interactive && program.length == 0 && main == null) eval("null");
+ if (interactive && program.length == 0 && main == null)
+ load("module $init$ {}");
if (interactive) while (handle(read()));
global.stop("total");
if (!interactive) global.reporter.printSummary();
@@ -233,6 +234,12 @@ public class Interpreter {
return interpret(true);
}
+ public boolean load(String input) {
+ if (input.trim().length() == 0) return true;
+ global.compile(input + ";", false);
+ return interpret(false);
+ }
+
public boolean load(String[] files) {
if (files.length == 0) return true;
global.compile(files, false);
diff --git a/sources/scalac/Global.java b/sources/scalac/Global.java
index 69ec937055..79384493c7 100644
--- a/sources/scalac/Global.java
+++ b/sources/scalac/Global.java
@@ -325,6 +325,8 @@ public class Global {
private List imports = new ArrayList();
private void fix1() {
+ // make sure that Interpreter.scala is compiled
+ SHOW_DEFINITION();
for (int i = 0; i < units.length; i++) {
if (units[i].console) fix1(units[i]);
}
@@ -335,8 +337,6 @@ public class Global {
}
private void fix1(Unit unit) {
- // make sure that Interpreter.scala is compiled
- SHOW_DEFINITION();
unit.body = new Tree[] {
make.ModuleDef(0, 0, Name.fromString(CONSOLE_S+module), Tree.Empty,
make.Template(0, new Tree[]{