diff options
author | paltherr <paltherr@epfl.ch> | 2004-11-30 18:13:07 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2004-11-30 18:13:07 +0000 |
commit | 6d35dedf60e93ead05e90003d1b9d888246b4d6a (patch) | |
tree | b6d00b51324464179ebde171bf012898008c474a /sources | |
parent | 74d2ffc0b95d80e937a7da8a5c206d09de7944e5 (diff) | |
download | scala-6d35dedf60e93ead05e90003d1b9d888246b4d6a.tar.gz scala-6d35dedf60e93ead05e90003d1b9d888246b4d6a.tar.bz2 scala-6d35dedf60e93ead05e90003d1b9d888246b4d6a.zip |
- Added method writeClassFile
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scalac/backend/jvm/GenJVM.java | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/sources/scalac/backend/jvm/GenJVM.java b/sources/scalac/backend/jvm/GenJVM.java index 2a7c4f5c52..d711b1de81 100644 --- a/sources/scalac/backend/jvm/GenJVM.java +++ b/sources/scalac/backend/jvm/GenJVM.java @@ -1357,13 +1357,7 @@ class GenJVM { } addScalaAttr(mirrorClass, pickle); - try { - String fileName = javaFileName(mirrorName); - mirrorClass.writeTo(fileName); - global.operation("wrote " + fileName); - } catch (java.io.IOException e) { - throw global.fail(e.getMessage()); - } + writeClassFile(mirrorClass); } /** @@ -1650,13 +1644,7 @@ class GenJVM { else addScalaAttr(clazz, pickle); - try { - String fileName = javaFileName(clazz.getName()); - clazz.writeTo(fileName); - global.operation("wrote " + fileName); - } catch (java.io.IOException e) { - throw global.fail(e.getMessage()); - } + writeClassFile(clazz); } /** @@ -1718,6 +1706,21 @@ class GenJVM { global.log("leaving method"); } + /// I/O + ////////////////////////////////////////////////////////////////////// + + /** Writes the given class to a file. */ + protected void writeClassFile(JClass clazz) { + String fileName = javaFileName(clazz.getName()); + try { + clazz.writeTo(fileName); + global.operation("wrote " + fileName); + } catch (IOException exception) { + if (global.debug) exception.printStackTrace(); + global.error("could not write file " + fileName); + } + } + /// Misc. ////////////////////////////////////////////////////////////////////// |