diff options
author | Eduardo Julian | 2017-07-03 18:15:46 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-07-03 18:15:46 -0400 |
commit | fbd8a37baf6d50d62716d69b451d4ac58b872283 (patch) | |
tree | 78f6798fb416d57500b83cc04ad3ece368c8add5 /luxc | |
parent | 65c182755954f64fd112284a5336ba05547a4283 (diff) |
- Error messages on the JVM now include the stack-trace.
Diffstat (limited to '')
-rw-r--r-- | luxc/src/lux/compiler/jvm/rt.clj | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/luxc/src/lux/compiler/jvm/rt.clj b/luxc/src/lux/compiler/jvm/rt.clj index 63a5e1935..b2670b9ef 100644 --- a/luxc/src/lux/compiler/jvm/rt.clj +++ b/luxc/src/lux/compiler/jvm/rt.clj @@ -841,7 +841,24 @@ (.visitEnd)) _ (let [$from (new Label) $to (new Label) - $handler (new Label)] + $handler (new Label) + make-string-writerI (fn [_method_] + (doto _method_ + (.visitTypeInsn Opcodes/NEW "java/io/StringWriter") + (.visitInsn Opcodes/DUP) + (.visitMethodInsn Opcodes/INVOKESPECIAL "java/io/StringWriter" "<init>" "()V"))) + make-print-writerI (fn [_method_] + (doto _method_ + ;; W + (.visitTypeInsn Opcodes/NEW "java/io/PrintWriter") ;; WP + (.visitInsn Opcodes/SWAP) ;; PW + (.visitInsn Opcodes/DUP2) ;; PWPW + (.visitInsn Opcodes/POP) ;; PWP + (.visitInsn Opcodes/SWAP) ;; PPW + (.visitLdcInsn true) ;; PPW? + (.visitMethodInsn Opcodes/INVOKESPECIAL "java/io/PrintWriter" "<init>" "(Ljava/io/Writer;Z)V") + ;; P + ))] (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_STATIC) "runTry" "(Llux/Function;)[Ljava/lang/Object;" nil nil) (.visitCode) (.visitTryCatchBlock $from $to $handler "java/lang/Throwable") @@ -853,10 +870,15 @@ (.visitInsn Opcodes/ARETURN) (.visitLabel $to) (.visitLabel $handler) ;; T - (.visitLdcInsn (->> #'&/$Left meta ::&/idx int)) ;; TI - (.visitInsn Opcodes/ACONST_NULL) ;; TI? - swap2x1 ;; I?T - (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/Object" "toString" "()Ljava/lang/String;") ;; I?S + make-string-writerI ;; TW + (.visitInsn Opcodes/DUP2) ;; TWTW + make-print-writerI ;; TWTP + (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/Throwable" "printStackTrace" "(Ljava/io/PrintWriter;)V") ;; TW + (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/io/StringWriter" "toString" "()Ljava/lang/String;") ;; TS + (.visitInsn Opcodes/SWAP) (.visitInsn Opcodes/POP) ;; S + (.visitLdcInsn (->> #'&/$Left meta ::&/idx int)) ;; SI + (.visitInsn Opcodes/ACONST_NULL) ;; SI? + swap2x1 ;; I?S (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") (.visitInsn Opcodes/ARETURN) (.visitMaxs 0 0) |