summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2004-11-30 18:40:50 +0000
committerpaltherr <paltherr@epfl.ch>2004-11-30 18:40:50 +0000
commitf9cc4a054b4266b1d11128fc394e100a6cb4eed9 (patch)
treebe82755f2c1fd18b63c3fbe61f0811edeadce018
parent6b243c5e3dd4652e9bc76b35f485df2efe43aed8 (diff)
downloadscala-f9cc4a054b4266b1d11128fc394e100a6cb4eed9.tar.gz
scala-f9cc4a054b4266b1d11128fc394e100a6cb4eed9.tar.bz2
scala-f9cc4a054b4266b1d11128fc394e100a6cb4eed9.zip
- Added method writeSymblFile
-rw-r--r--sources/scalac/backend/jvm/GenJVM.java38
1 files changed, 22 insertions, 16 deletions
diff --git a/sources/scalac/backend/jvm/GenJVM.java b/sources/scalac/backend/jvm/GenJVM.java
index 0f0991695b..3cb590fa79 100644
--- a/sources/scalac/backend/jvm/GenJVM.java
+++ b/sources/scalac/backend/jvm/GenJVM.java
@@ -1393,18 +1393,6 @@ class GenJVM {
return name;
}
- /**
- * Return the name of the file in which to store the given class.
- */
- protected String javaFileName(String className) {
- StringTokenizer tokens = new StringTokenizer(className, ".");
- File file = new File(global.outpath);
- while (tokens.hasMoreElements())
- file = new File(file, tokens.nextToken());
-
- return file.getPath() + ".class";
- }
-
/// Types
//////////////////////////////////////////////////////////////////////
@@ -1712,16 +1700,34 @@ class GenJVM {
/** Writes the given class to a file. */
protected void writeClassFile(JClass clazz) {
- String fileName = javaFileName(clazz.getName());
+ File file = getFile(clazz, ".class");
try {
- clazz.writeTo(fileName);
- global.operation("wrote " + fileName);
+ clazz.writeTo(file);
+ global.operation("wrote " + file);
} catch (IOException exception) {
if (global.debug) exception.printStackTrace();
- global.error("could not write file " + fileName);
+ global.error("could not write file " + file);
}
}
+ /** Writes the given pickle for given class to a file. */
+ protected void writeSymblFile(JClass clazz, Pickle pickle) {
+ File file = getFile(clazz, ".symbl");
+ try {
+ pickle.writeTo(file);
+ global.operation("wrote " + file);
+ } catch (IOException exception) {
+ if (global.debug) exception.printStackTrace();
+ global.error("could not write file " + file);
+ }
+ }
+
+ /** Returns the file with the given suffix for the given class. */
+ protected File getFile(JClass clazz, String suffix) {
+ String path = clazz.getName().replace('.', File.separatorChar);
+ return new File(global.outpath + File.separatorChar + path + suffix);
+ }
+
/// Misc.
//////////////////////////////////////////////////////////////////////