summaryrefslogtreecommitdiff
path: root/sources/scalac/Global.java
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2004-03-21 04:31:47 +0000
committerpaltherr <paltherr@epfl.ch>2004-03-21 04:31:47 +0000
commitca196dd13c1008176b162d006838767e8b4d83b7 (patch)
tree813851163262df10d74c2f332647bcfaffc30a54 /sources/scalac/Global.java
parent92763237f37452a9325e94f63ad5b7faa4ac04ca (diff)
downloadscala-ca196dd13c1008176b162d006838767e8b4d83b7.tar.gz
scala-ca196dd13c1008176b162d006838767e8b4d83b7.tar.bz2
scala-ca196dd13c1008176b162d006838767e8b4d83b7.zip
- Replaced file String by an AbstractFile in So...
- Replaced file String by an AbstractFile in SourceFile
Diffstat (limited to 'sources/scalac/Global.java')
-rw-r--r--sources/scalac/Global.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/sources/scalac/Global.java b/sources/scalac/Global.java
index af9d69092f..c6885d6447 100644
--- a/sources/scalac/Global.java
+++ b/sources/scalac/Global.java
@@ -18,6 +18,8 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.*;
+import scala.tools.util.AbstractFile;
+import scala.tools.util.ByteArrayFile;
import scala.tools.util.Position;
import scala.tools.util.SourceFile;
@@ -261,13 +263,17 @@ public abstract class Global {
// parse files
List units = new ArrayList(files.length);
for (int i = 0; i < files.length; i++) {
- String file = files[i];
- try {
- units.add(new Unit(this, new SourceFile(file), console));
- } catch (FileNotFoundException e) {
- error("file " + file + " not found");
- } catch (IOException e) {
- error(e.getMessage());
+ String filename = files[i];
+ AbstractFile file = AbstractFile.open(null, filename);
+ if (file.exists()) {
+ try {
+ SourceFile source = new SourceFile(file);
+ units.add(new Unit(this, source, console));
+ } catch (IOException exception) {
+ error(exception.getMessage());
+ }
+ } else {
+ error("file '" + filename + "' not found");
}
}
this.units = (Unit[])units.toArray(new Unit[units.size()]);
@@ -283,7 +289,8 @@ public abstract class Global {
*/
public void compile(String filename, String input, boolean console) {
reporter.resetCounters();
- SourceFile source = new SourceFile(filename, input.getBytes());
+ ByteArrayFile file = new ByteArrayFile(filename, input.getBytes());
+ SourceFile source = new SourceFile(file);
units = new Unit[]{new Unit(this, source, console)};
compile();
}