summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-03-13 11:57:37 +0000
committerpaltherr <paltherr@epfl.ch>2003-03-13 11:57:37 +0000
commit6656a7bed7d59570af5cbbcbad9e0b16ddf19ff8 (patch)
treea44f81bd131750ca40b7afd10a5d8a37c24289b8 /sources
parent766aece3147dcd211b5e46c92df2552ff5b87892 (diff)
downloadscala-6656a7bed7d59570af5cbbcbad9e0b16ddf19ff8.tar.gz
scala-6656a7bed7d59570af5cbbcbad9e0b16ddf19ff8.tar.bz2
scala-6656a7bed7d59570af5cbbcbad9e0b16ddf19ff8.zip
- Moved field "console" from class Sourcefile i...
- Moved field "console" from class Sourcefile into class Unit
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/tools/scalai/EntryPointCompiler.java2
-rw-r--r--sources/scalac/Global.java6
-rw-r--r--sources/scalac/Unit.java11
-rw-r--r--sources/scalac/ast/parser/Sourcefile.java8
-rw-r--r--sources/scalac/symtab/SourceCompleter.java2
5 files changed, 15 insertions, 14 deletions
diff --git a/sources/scala/tools/scalai/EntryPointCompiler.java b/sources/scala/tools/scalai/EntryPointCompiler.java
index 7609cce21e..4ad414597f 100644
--- a/sources/scala/tools/scalai/EntryPointCompiler.java
+++ b/sources/scala/tools/scalai/EntryPointCompiler.java
@@ -81,7 +81,7 @@ public class EntryPointCompiler {
int pos = Position.NOPOS;
global.units = new Unit[1];
- global.units[0] = new Unit(global, new Sourcefile((byte[])null,false));
+ global.units[0] = new Unit(global, new Sourcefile((byte[])null),false);
global.units[0].body = new Tree[1];
global.units[0].body[0] = global.treeGen.Apply(
global.treeGen.mkRef(pos, module.thisType(), method),
diff --git a/sources/scalac/Global.java b/sources/scalac/Global.java
index 233b413ec1..05184bb250 100644
--- a/sources/scalac/Global.java
+++ b/sources/scalac/Global.java
@@ -228,7 +228,7 @@ public class Global {
for (int i = 0; i < files.length; i++) {
String file = files[i];
try {
- units.add(new Unit(this, new Sourcefile(file, console)));
+ units.add(new Unit(this, new Sourcefile(file), console));
} catch (FileNotFoundException e) {
error("file " + file + " not found");
} catch (IOException e) {
@@ -243,8 +243,8 @@ public class Global {
*/
public void compile(String input, boolean console) {
reporter.resetCounters();
- Sourcefile source = new Sourcefile(input.getBytes(), console);
- units = new Unit[]{new Unit(this, source)};
+ Sourcefile source = new Sourcefile(input.getBytes());
+ units = new Unit[]{new Unit(this, source, console)};
compile();
}
diff --git a/sources/scalac/Unit.java b/sources/scalac/Unit.java
index f9a3ec81c6..2d78439bc8 100644
--- a/sources/scalac/Unit.java
+++ b/sources/scalac/Unit.java
@@ -26,11 +26,15 @@ public class Unit {
/** the global compilation environment
*/
- public Global global;
+ public final Global global;
/** the associated source code file
*/
- public Sourcefile source;
+ public final Sourcefile source;
+
+ /** does this unit come from the interpreter console
+ */
+ public final boolean console;
/** the content of the compilation unit in tree form
*/
@@ -56,9 +60,10 @@ public class Unit {
*/
public int notes;
- public Unit(Global global, Sourcefile source) {
+ public Unit(Global global, Sourcefile source, boolean console) {
this.global = global;
this.source = source;
+ this.console = console;
}
/*
public void print(String message) {
diff --git a/sources/scalac/ast/parser/Sourcefile.java b/sources/scalac/ast/parser/Sourcefile.java
index 91277f9ac8..517e0dd5dd 100644
--- a/sources/scalac/ast/parser/Sourcefile.java
+++ b/sources/scalac/ast/parser/Sourcefile.java
@@ -35,7 +35,6 @@ public class Sourcefile {
/** the filename
*/
- public final boolean console;
protected String filename;
public String shortname;
public String pathname;
@@ -83,8 +82,7 @@ public class Sourcefile {
/** constructors
*/
- public Sourcefile(String filename, boolean console) throws IOException, FileNotFoundException {
- this.console = console;
+ public Sourcefile(String filename) throws IOException, FileNotFoundException {
if (filename == null) {
this.filename = "(sourcefile not available)";
this.shortname = "?";
@@ -111,7 +109,6 @@ public class Sourcefile {
}
public Sourcefile(AbstractFile abs) throws IOException, FileNotFoundException {
- this.console = false;
if (filename == null) {
this.filename = "(sourcefile not available)";
this.shortname = "?";
@@ -135,8 +132,7 @@ public class Sourcefile {
files[id = numIds++] = shortname;
}
- public Sourcefile(byte[] input, boolean console) {
- this.console = console;
+ public Sourcefile(byte[] input) {
if (input == null) {
this.filename = "(sourcefile not available)";
this.shortname = "?";
diff --git a/sources/scalac/symtab/SourceCompleter.java b/sources/scalac/symtab/SourceCompleter.java
index 1656f2029f..def4a80c9e 100644
--- a/sources/scalac/symtab/SourceCompleter.java
+++ b/sources/scalac/symtab/SourceCompleter.java
@@ -36,7 +36,7 @@ public class SourceCompleter extends Type.LazyType {
try {
String fname = filename;
long msec = System.currentTimeMillis();
- Unit unit = new Unit(global, new Sourcefile(filename, false));
+ Unit unit = new Unit(global, new Sourcefile(filename), false);
filename = null;
global.PHASE.PARSER.createPhase(global).apply(unit);
((Analyzer)global.PHASE.ANALYZER.createPhase(global)).lateEnter(unit, c);