From 67687850677bb34df37d6e9d1a2578d1198108d6 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 20 Jun 2019 03:10:30 -0400 Subject: Re-factored exceptions. --- .../lux/target/jvm/attribute/code/exception.lux | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 stdlib/source/lux/target/jvm/attribute/code/exception.lux (limited to 'stdlib/source/lux/target/jvm/attribute/code/exception.lux') diff --git a/stdlib/source/lux/target/jvm/attribute/code/exception.lux b/stdlib/source/lux/target/jvm/attribute/code/exception.lux new file mode 100644 index 000000000..6ec0a1773 --- /dev/null +++ b/stdlib/source/lux/target/jvm/attribute/code/exception.lux @@ -0,0 +1,51 @@ +(.module: + [lux #* + [abstract + ["." equivalence (#+ Equivalence)]] + [data + [format + [".F" binary (#+ Format)]]]] + ["." // #_ + ["#." label (#+ Label)] + ["//#" /// #_ + [constant (#+ Class)] + ["#." encoding (#+ U2)] + ["#." index (#+ Index)]]]) + +(type: #export Exception + {#start-pc Label + #end-pc Label + #handler-pc Label + #catch-type (Index Class)}) + +(def: #export equivalence + (Equivalence Exception) + ($_ equivalence.product + //label.equivalence + //label.equivalence + //label.equivalence + ////index.equivalence + )) + +## https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 +(def: #export length + Nat + ($_ n/+ + ## u2 start_pc; + ////encoding.u2-bytes + ## u2 end_pc; + ////encoding.u2-bytes + ## u2 handler_pc; + ////encoding.u2-bytes + ## u2 catch_type; + ////encoding.u2-bytes + )) + +(def: #export format + (Format Exception) + ($_ binaryF.and + //label.format + //label.format + //label.format + ////index.format + )) -- cgit v1.2.3