summaryrefslogtreecommitdiff
path: root/ghc/compiler/javaGen/PrintJava.lhs
diff options
context:
space:
mode:
authorandy <unknown>2000-05-24 07:31:44 +0000
committerandy <unknown>2000-05-24 07:31:44 +0000
commit3b24089dc380e2ff268182b42ebc51164db9ab90 (patch)
tree8d05b4255973bd9de78f232bb1e89d6785af910b /ghc/compiler/javaGen/PrintJava.lhs
parent60a202ee6cb40a0c1e86ed32738ea6d021cae316 (diff)
downloadhaskell-3b24089dc380e2ff268182b42ebc51164db9ab90.tar.gz
[project @ 2000-05-24 07:31:44 by andy]
Adding a field to the Method constructor, to allow methods to say what they might raise. This is needed to actually compile generated code. Also, the generated code now imports haskell.runtime.*
Diffstat (limited to 'ghc/compiler/javaGen/PrintJava.lhs')
-rw-r--r--ghc/compiler/javaGen/PrintJava.lhs9
1 files changed, 6 insertions, 3 deletions
diff --git a/ghc/compiler/javaGen/PrintJava.lhs b/ghc/compiler/javaGen/PrintJava.lhs
index e71e527a47..5608595496 100644
--- a/ghc/compiler/javaGen/PrintJava.lhs
+++ b/ghc/compiler/javaGen/PrintJava.lhs
@@ -39,7 +39,7 @@ decl = \d ->
{ Import n -> importDecl (hcat (punctuate dot (map text n)))
; Field mfs t n e -> field (modifiers mfs) (typ t) (name n) e
; Constructor mfs n as ss -> constructor (modifiers mfs) (name n) (parameters as) (statements ss)
- ; Method mfs t n as ss -> method (modifiers mfs) (typ t) (name n) (parameters as) (statements ss)
+ ; Method mfs t n as ts ss -> method (modifiers mfs) (typ t) (name n) (parameters as) (throws ts) (statements ss)
; Comment s -> comment s
; Interface mfs n is ms -> interface (modifiers mfs) (name n) (extends is) (decls ms)
; Class mfs n x is ms -> clazz (modifiers mfs) (name n) (extends x) (implements is) (decls ms)
@@ -61,8 +61,8 @@ constructor = \mfs -> \n -> \as -> \ss ->
$$ indent ss
$$ text "}"
-method = \mfs -> \t -> \n -> \as -> \ss ->
- mfs <+> t <+> n <+> parens (hsep (punctuate comma as)) <+> text "{"
+method = \mfs -> \t -> \n -> \as -> \ts -> \ss ->
+ mfs <+> t <+> n <+> parens (hsep (punctuate comma as)) <+> ts <+> text "{"
$$ indent ss
$$ text "}"
@@ -96,6 +96,9 @@ extends xs = text "extends" <+> hsep (punctuate comma (map name xs))
implements [] = empty
implements xs = text "implements" <+> hsep (punctuate comma (map name xs))
+throws [] = empty
+throws xs = text "throws" <+> hsep (punctuate comma (map name xs))
+
name ns = text ns
parameters as = map parameter as