aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
authorEduardo Julian2022-11-11 15:59:22 -0400
committerEduardo Julian2022-11-11 15:59:22 -0400
commit4c765d22bd0a2e5271bf350745ed29f66bfbb96a (patch)
tree1c2572154f828dae537eb2f528b7743f70bb6744 /stdlib/source
parentcb572295c9a73330531e07f3f6a92b3bb2434514 (diff)
Added SourceFile annotations to functions when compiling for the JVM.
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux6
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/program.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux492
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/attribute.lux26
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/class.lux25
-rw-r--r--stdlib/source/test/lux/meta/extension.lux2
10 files changed, 294 insertions, 269 deletions
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux
index 3cd840518..170753ca1 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux
@@ -2424,7 +2424,7 @@
(list#each ..class_name interfaces)
fields
methods
- sequence.empty))))
+ (list)))))
(def constant::modifier
(Modifier field.Field)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux
index 6d67ae206..a51e62ed5 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux
@@ -696,7 +696,7 @@
(list#each ..class_name interfaces)
fields
methods
- sequence.empty))))
+ (list)))))
(def (mock_value valueT)
(-> (Type Value) (Bytecode Any))
@@ -914,7 +914,7 @@
(list#each ..class_name interfaces)
(list#each ..field_definition fields)
(list#each product.right methods)
- sequence.empty))
+ (list)))
_ (..save_class! name bytecode all_dependencies)]
(in declaration.no_requirements)))]))
@@ -956,7 +956,7 @@
(list#each ..class_name supers)
(list)
(list#each ..method_declaration method_declarations)
- sequence.empty))
+ (list)))
artifact_id (generation.learn_custom name unit.none)
.let [artifact [name bytecode]]
_ (generation.execute! artifact)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux
index cbd08f066..5f51dcaba 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux
@@ -1341,7 +1341,7 @@
(foreign.variables total_environment)
(list.partial (..with_anonymous_init class total_environment super_class inputsTI)
methods!)
- (sequence.sequence)))
+ (list)))
.let [artifact [anonymous_class_name bytecode]]
_ (//////generation.execute! artifact)
_ (//////generation.save! artifact_id {.#None} artifact)]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function.lux
index e7fa794d8..76640103d 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function.lux
@@ -20,6 +20,7 @@
["_" bytecode (.only Label Bytecode) (.use "[1]#[0]" monad)]
["[0]" version]
["[0]" modifier (.only Modifier) (.use "[1]#[0]" monoid)]
+ ["[0]" attribute]
["[0]" field (.only Field)]
["[0]" method (.only Method)]
["[0]" class (.only Class)]
@@ -114,6 +115,7 @@
(generate archive bodyS)))
.let [function_class (//runtime.class_name function_context)]
[fields methods instance] (..with generate archive @begin function_class environment arity bodyG)
+ module generation.module
class (phase.lifted (class.class version.v6_0
..modifier
(name.internal function_class)
@@ -121,7 +123,7 @@
(..internal /abstract.class) (list)
fields
methods
- (sequence.sequence)))
+ (list (attribute.source_file module))))
.let [bytecode [function_class (\\format.result class.format class)]]
_ (generation.execute! bytecode)
_ (generation.save! (product.right function_context) {.#None} bytecode)]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux
index a7f0a8444..ea6b16da0 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux
@@ -129,7 +129,7 @@
valueG
(_.putstatic (type.class bytecode_name (list)) //value.field :value:)
_.return)}))
- (sequence.sequence))]
+ (list))]
(io.run! (do [! (try.with io.monad)]
[bytecode (at ! each (\\format.result class.format)
(io.io bytecode))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/program.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/program.lux
index 097959d4c..de928bd0b 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/program.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/program.lux
@@ -165,4 +165,4 @@
(list)
(list)
(list main)
- (sequence.sequence)))]))
+ (list)))]))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux
index c1ffb137b..9966acbd6 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux
@@ -160,14 +160,14 @@
$right? _.aload_1
$value _.aload_2]
(method.method ..modifier ..variant::name
- .false ..variant::type
- (list)
- {.#Some (all _.composite
- new_variant ... A[3]
- (..set! ..variant_lefts $lefts) ... A[3]
- (..set! ..variant_right? $right?) ... A[3]
- (..set! ..variant_value $value) ... A[3]
- _.areturn)})))
+ .false ..variant::type
+ (list)
+ {.#Some (all _.composite
+ new_variant ... A[3]
+ (..set! ..variant_lefts $lefts) ... A[3]
+ (..set! ..variant_right? $right?) ... A[3]
+ (..set! ..variant_value $value) ... A[3]
+ _.areturn)})))
(def .public left_right? _.aconst_null)
(def .public right_right? ..unit)
@@ -222,15 +222,15 @@
(def decode_frac::method
(method.method ..modifier ..decode_frac::name
- .false ..decode_frac::type
- (list)
- {.#Some
- (..risky
- (all _.composite
- _.aload_0
- (_.invokestatic //type.frac "parseDouble" (type.method [(list) (list //type.text) type.double (list)]))
- (//value.wrap type.double)
- ))}))
+ .false ..decode_frac::type
+ (list)
+ {.#Some
+ (..risky
+ (all _.composite
+ _.aload_0
+ (_.invokestatic //type.frac "parseDouble" (type.method [(list) (list //type.text) type.double (list)]))
+ (//value.wrap type.double)
+ ))}))
(def .public log!
(Bytecode Any)
@@ -259,12 +259,12 @@
(def (failure name message)
(-> Text Text (Resource Method))
(method.method ..modifier name
- .false ..failure::type
- (list)
- {.#Some
- (all _.composite
- (..illegal_state_exception message)
- _.athrow)}))
+ .false ..failure::type
+ (list)
+ {.#Some
+ (all _.composite
+ (..illegal_state_exception message)
+ _.athrow)}))
(def pm_failure::name "pm_failure")
(def .public pm_failure (..procedure ..pm_failure::name ..failure::type))
@@ -281,19 +281,19 @@
(def push::method
(method.method ..modifier ..push::name
- .false ..push::type
- (list)
- {.#Some
- (let [new_stack_frame! (all _.composite
- _.iconst_2
- (_.anewarray //type.value))
- $head _.aload_1
- $tail _.aload_0]
- (all _.composite
- new_stack_frame!
- (..set! ..stack_head $head)
- (..set! ..stack_tail $tail)
- _.areturn))}))
+ .false ..push::type
+ (list)
+ {.#Some
+ (let [new_stack_frame! (all _.composite
+ _.iconst_2
+ (_.anewarray //type.value))
+ $head _.aload_1
+ $tail _.aload_0]
+ (all _.composite
+ new_stack_frame!
+ (..set! ..stack_head $head)
+ (..set! ..stack_tail $tail)
+ _.areturn))}))
(def when::name "when")
(def when::type (type.method [(list) (list //type.variant //type.lefts //type.right?) //type.value (list)]))
@@ -301,80 +301,80 @@
(def when::method
(method.method ..modifier ..when::name
- .false ..when::type
- (list)
- {.#Some
- (do _.monad
- [@loop _.new_label
- @perfect_match! _.new_label
- @lefts_match! _.new_label
- @maybe_nested _.new_label
- @mismatch! _.new_label
- .let [$variant _.aload_0
- $lefts _.iload_1
- $right? _.aload_2
-
- ::lefts (all _.composite
- (..get ..variant_lefts)
- (//value.unwrap type.int))
- ::right? (..get ..variant_right?)
- ::value (..get ..variant_value)
-
- not_found _.aconst_null
-
- super_nested_lefts (all _.composite
- _.swap
- _.isub
- (_.int (i32.i32 (.i64 +1)))
- _.isub)
- super_nested (all _.composite
- ... lefts, sumT
- super_nested_lefts ... super_lefts
- $variant ::right? ... super_lefts, super_right
- $variant ::value ... super_lefts, super_right, super_value
- ..variant)
-
- update_$variant (all _.composite
- $variant ::value
- (_.checkcast //type.variant)
- _.astore_0)
- update_$lefts (all _.composite
- _.isub
- (_.int (i32.i32 (.i64 +1)))
- _.isub)
- again (is (-> Label (Bytecode Any))
- (function (_ @)
- (all _.composite
- ... lefts, sumT
- update_$variant ... lefts, sumT
- update_$lefts ... sub_lefts
- (_.goto @))))]]
- (all _.composite
- $lefts
- (_.set_label @loop)
- $variant ::lefts
- _.dup2 (_.if_icmpeq @lefts_match!)
- _.dup2 (_.if_icmpgt @maybe_nested)
- $right? (_.ifnull @mismatch!) ... lefts, sumT
- super_nested ... super_variant
- _.areturn
- (_.set_label @lefts_match!) ... lefts, sumT
- $right? ... lefts, sumT, wants_right?
- $variant ::right? ... lefts, sumT, wants_right?, is_right?
- (_.if_acmpeq @perfect_match!) ... lefts, sumT
- (_.set_label @mismatch!) ... lefts, sumT
- ... _.pop2
- not_found
- _.areturn
- (_.set_label @maybe_nested) ... lefts, sumT
- $variant ::right? ... lefts, sumT, right?
- (_.ifnull @mismatch!) ... lefts, sumT
- (again @loop)
- (_.set_label @perfect_match!) ... lefts, sumT
- ... _.pop2
- $variant ::value
- _.areturn
- ))}))
+ .false ..when::type
+ (list)
+ {.#Some
+ (do _.monad
+ [@loop _.new_label
+ @perfect_match! _.new_label
+ @lefts_match! _.new_label
+ @maybe_nested _.new_label
+ @mismatch! _.new_label
+ .let [$variant _.aload_0
+ $lefts _.iload_1
+ $right? _.aload_2
+
+ ::lefts (all _.composite
+ (..get ..variant_lefts)
+ (//value.unwrap type.int))
+ ::right? (..get ..variant_right?)
+ ::value (..get ..variant_value)
+
+ not_found _.aconst_null
+
+ super_nested_lefts (all _.composite
+ _.swap
+ _.isub
+ (_.int (i32.i32 (.i64 +1)))
+ _.isub)
+ super_nested (all _.composite
+ ... lefts, sumT
+ super_nested_lefts ... super_lefts
+ $variant ::right? ... super_lefts, super_right
+ $variant ::value ... super_lefts, super_right, super_value
+ ..variant)
+
+ update_$variant (all _.composite
+ $variant ::value
+ (_.checkcast //type.variant)
+ _.astore_0)
+ update_$lefts (all _.composite
+ _.isub
+ (_.int (i32.i32 (.i64 +1)))
+ _.isub)
+ again (is (-> Label (Bytecode Any))
+ (function (_ @)
+ (all _.composite
+ ... lefts, sumT
+ update_$variant ... lefts, sumT
+ update_$lefts ... sub_lefts
+ (_.goto @))))]]
+ (all _.composite
+ $lefts
+ (_.set_label @loop)
+ $variant ::lefts
+ _.dup2 (_.if_icmpeq @lefts_match!)
+ _.dup2 (_.if_icmpgt @maybe_nested)
+ $right? (_.ifnull @mismatch!) ... lefts, sumT
+ super_nested ... super_variant
+ _.areturn
+ (_.set_label @lefts_match!) ... lefts, sumT
+ $right? ... lefts, sumT, wants_right?
+ $variant ::right? ... lefts, sumT, wants_right?, is_right?
+ (_.if_acmpeq @perfect_match!) ... lefts, sumT
+ (_.set_label @mismatch!) ... lefts, sumT
+ ... _.pop2
+ not_found
+ _.areturn
+ (_.set_label @maybe_nested) ... lefts, sumT
+ $variant ::right? ... lefts, sumT, right?
+ (_.ifnull @mismatch!) ... lefts, sumT
+ (again @loop)
+ (_.set_label @perfect_match!) ... lefts, sumT
+ ... _.pop2
+ $variant ::value
+ _.areturn
+ ))}))
(def projection_type (type.method [(list) (list //type.tuple //type.offset) //type.value (list)]))
@@ -413,61 +413,61 @@
left_projection::method
(method.method ..modifier ..left_projection::name
- .false ..projection_type
- (list)
- {.#Some
- (do _.monad
- [@loop _.new_label
- @recursive _.new_label
- .let [::left (all _.composite
- $lefts
- _.aaload)]]
- (all _.composite
- (_.set_label @loop)
- $lefts $last_right (_.if_icmpge @recursive)
- $tuple ::left
- _.areturn
- (_.set_label @recursive)
- ... Recursive
- (recur @loop)))})
+ .false ..projection_type
+ (list)
+ {.#Some
+ (do _.monad
+ [@loop _.new_label
+ @recursive _.new_label
+ .let [::left (all _.composite
+ $lefts
+ _.aaload)]]
+ (all _.composite
+ (_.set_label @loop)
+ $lefts $last_right (_.if_icmpge @recursive)
+ $tuple ::left
+ _.areturn
+ (_.set_label @recursive)
+ ... Recursive
+ (recur @loop)))})
right_projection::method
(method.method ..modifier ..right_projection::name
- .false ..projection_type
- (list)
- {.#Some
- (do _.monad
- [@loop _.new_label
- @not_tail _.new_label
- @slice _.new_label
- .let [$right (all _.composite
- $lefts
- _.iconst_1
- _.iadd)
- $::nested (all _.composite
- $tuple
- _.swap
- _.aaload)
- super_nested (all _.composite
- $tuple
- $right
- $tuple::size
- (_.invokestatic (type.class "java.util.Arrays" (list)) "copyOfRange"
- (type.method [(list) (list //type.tuple //type.index //type.index) //type.tuple (list)])))]]
- (all _.composite
- (_.set_label @loop)
- $last_right $right
- _.dup2 (_.if_icmpne @not_tail)
- ... _.pop
- $::nested
- _.areturn
- (_.set_label @not_tail)
- (_.if_icmpgt @slice)
- ... Must recurse
- (recur @loop)
- (_.set_label @slice)
- super_nested
- _.areturn))})]
+ .false ..projection_type
+ (list)
+ {.#Some
+ (do _.monad
+ [@loop _.new_label
+ @not_tail _.new_label
+ @slice _.new_label
+ .let [$right (all _.composite
+ $lefts
+ _.iconst_1
+ _.iadd)
+ $::nested (all _.composite
+ $tuple
+ _.swap
+ _.aaload)
+ super_nested (all _.composite
+ $tuple
+ $right
+ $tuple::size
+ (_.invokestatic (type.class "java.util.Arrays" (list)) "copyOfRange"
+ (type.method [(list) (list //type.tuple //type.index //type.index) //type.tuple (list)])))]]
+ (all _.composite
+ (_.set_label @loop)
+ $last_right $right
+ _.dup2 (_.if_icmpne @not_tail)
+ ... _.pop
+ $::nested
+ _.areturn
+ (_.set_label @not_tail)
+ (_.if_icmpgt @slice)
+ ... Must recurse
+ (recur @loop)
+ (_.set_label @slice)
+ super_nested
+ _.areturn))})]
[left_projection::method
right_projection::method]))
@@ -493,63 +493,63 @@
(def try::method
(method.method ..modifier ..try::name
- .false ..try::type
- (list)
- {.#Some
- (do _.monad
- [@try _.new_label
- @handler _.new_label
- .let [$unsafe ..this
-
- ^StringWriter (type.class "java.io.StringWriter" (list))
- string_writer (all _.composite
- (_.new ^StringWriter)
- _.dup
- (_.invokespecial ^StringWriter "<init>" (type.method [(list) (list) type.void (list)])))
-
- ^PrintWriter (type.class "java.io.PrintWriter" (list))
- print_writer (all _.composite
- ... WTW
- (_.new ^PrintWriter) ... WTWP
- _.dup_x1 ... WTPWP
- _.swap ... WTPPW
- ..true ... WTPPWZ
- (_.invokespecial ^PrintWriter "<init>" (type.method [(list) (list (type.class "java.io.Writer" (list)) type.boolean) type.void (list)]))
- ... WTP
- )
- unsafe_application (all _.composite
- $unsafe
- ..unit
- ..apply)
- stack_trace (all _.composite
- ... T
- string_writer ... TW
- _.dup_x1 ... WTW
- print_writer ... WTP
- (_.invokevirtual //type.error "printStackTrace" (type.method [(list) (list ^PrintWriter) type.void (list)])) ... W
- (_.invokevirtual ^StringWriter "toString" (type.method [(list) (list) //type.text (list)])) ... S
- )]]
- (all _.composite
- (_.try @try @handler @handler //type.error)
- (_.set_label @try)
- unsafe_application
- ..right_injection
- _.areturn
- (_.set_label @handler) ... T
- stack_trace ... S
- ..left_injection
- _.areturn
- ))}))
+ .false ..try::type
+ (list)
+ {.#Some
+ (do _.monad
+ [@try _.new_label
+ @handler _.new_label
+ .let [$unsafe ..this
+
+ ^StringWriter (type.class "java.io.StringWriter" (list))
+ string_writer (all _.composite
+ (_.new ^StringWriter)
+ _.dup
+ (_.invokespecial ^StringWriter "<init>" (type.method [(list) (list) type.void (list)])))
+
+ ^PrintWriter (type.class "java.io.PrintWriter" (list))
+ print_writer (all _.composite
+ ... WTW
+ (_.new ^PrintWriter) ... WTWP
+ _.dup_x1 ... WTPWP
+ _.swap ... WTPPW
+ ..true ... WTPPWZ
+ (_.invokespecial ^PrintWriter "<init>" (type.method [(list) (list (type.class "java.io.Writer" (list)) type.boolean) type.void (list)]))
+ ... WTP
+ )
+ unsafe_application (all _.composite
+ $unsafe
+ ..unit
+ ..apply)
+ stack_trace (all _.composite
+ ... T
+ string_writer ... TW
+ _.dup_x1 ... WTW
+ print_writer ... WTP
+ (_.invokevirtual //type.error "printStackTrace" (type.method [(list) (list ^PrintWriter) type.void (list)])) ... W
+ (_.invokevirtual ^StringWriter "toString" (type.method [(list) (list) //type.text (list)])) ... S
+ )]]
+ (all _.composite
+ (_.try @try @handler @handler //type.error)
+ (_.set_label @try)
+ unsafe_application
+ ..right_injection
+ _.areturn
+ (_.set_label @handler) ... T
+ stack_trace ... S
+ ..left_injection
+ _.areturn
+ ))}))
(def throw::method
(method.method ..modifier ..throw::name
- .false ..throw::type
- (list)
- {.#Some
- (all _.composite
- _.aload_0
- _.athrow
- )}))
+ .false ..throw::type
+ (list)
+ {.#Some
+ (all _.composite
+ _.aload_0
+ _.athrow
+ )}))
(def reflection
(All (_ category)
@@ -586,7 +586,7 @@
..try::method
..throw::method))
- sequence.empty))]
+ (list)))]
(do ////.monad
[_ (generation.execute! [class bytecode])
_ (generation.save! ..artifact_id {.#None} [class bytecode])]
@@ -599,36 +599,36 @@
//function/arity.maximum)
(list#each (function (_ arity)
(method.method method.public ..apply::name
- .false (..apply::type arity)
- (list)
- {.#Some
- (let [previous_inputs (|> arity
- list.indices
- (monad.each _.monad _.aload))]
- (all _.composite
- previous_inputs
- (_.invokevirtual //function.class ..apply::name (..apply::type (-- arity)))
- (_.checkcast //function.class)
- (_.aload arity)
- (_.invokevirtual //function.class ..apply::name (..apply::type //function/arity.minimum))
- _.areturn))})))
+ .false (..apply::type arity)
+ (list)
+ {.#Some
+ (let [previous_inputs (|> arity
+ list.indices
+ (monad.each _.monad _.aload))]
+ (all _.composite
+ previous_inputs
+ (_.invokevirtual //function.class ..apply::name (..apply::type (-- arity)))
+ (_.checkcast //function.class)
+ (_.aload arity)
+ (_.invokevirtual //function.class ..apply::name (..apply::type //function/arity.minimum))
+ _.areturn))})))
(list.partial (method.method (modifier#composite method.public method.abstract)
- ..apply::name
- .false (..apply::type //function/arity.minimum)
- (list)
- {.#None})))
+ ..apply::name
+ .false (..apply::type //function/arity.minimum)
+ (list)
+ {.#None})))
<init>::method (method.method method.public "<init>"
- .false //function.init
- (list)
- {.#Some
- (let [$partials _.iload_1]
- (all _.composite
- ..this
- (_.invokespecial ^Object "<init>" (type.method [(list) (list) type.void (list)]))
- ..this
- $partials
- (_.putfield //function.class //function/count.field //function/count.type)
- _.return))})
+ .false //function.init
+ (list)
+ {.#Some
+ (let [$partials _.iload_1]
+ (all _.composite
+ ..this
+ (_.invokespecial ^Object "<init>" (type.method [(list) (list) type.void (list)]))
+ ..this
+ $partials
+ (_.putfield //function.class //function/count.field //function/count.type)
+ _.return))})
modifier (is (Modifier Class)
(all modifier#composite
class.public
@@ -648,7 +648,7 @@
(name.internal (..reflection ^Object)) (list)
(list partial_count)
(list.partial <init>::method apply::method+)
- sequence.empty))]
+ (list)))]
(do ////.monad
[_ (generation.execute! [class bytecode])
... _ (generation.save! //function.artifact_id {.#None} [class bytecode])
diff --git a/stdlib/source/library/lux/meta/target/jvm/attribute.lux b/stdlib/source/library/lux/meta/target/jvm/attribute.lux
index 21578c4e5..f3410723a 100644
--- a/stdlib/source/library/lux/meta/target/jvm/attribute.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/attribute.lux
@@ -61,7 +61,8 @@
(Variant
{#Constant (Info (Constant Any))}
{#Code (Info <Code>)}
- {#Signature (Info (Index UTF8))})))
+ {#Signature (Info (Index UTF8))}
+ {#Source_File (Info (Index UTF8))})))
(type .public Code
<Code>)
@@ -75,6 +76,7 @@
(info_equivalence /constant.equivalence)
(info_equivalence (/code.equivalence equivalence))
(info_equivalence //index.equivalence)
+ (info_equivalence //index.equivalence)
))))
(def common_attribute_length
@@ -93,7 +95,8 @@
(|> length //unsigned.value (n.+ ..common_attribute_length))])
([#Constant]
[#Code]
- [#Signature])))
+ [#Signature]
+ [#Source_File])))
... TODO: Inline ASAP
(def (constant' index @name)
@@ -137,6 +140,22 @@
[it (|> it //signature.signature //pool.utf8)]
(at ! each (signature' it) (//pool.utf8 "Signature"))))
+... TODO: Inline ASAP
+(def (source_file' it @name)
+ (-> (Index UTF8) (Index UTF8)
+ Attribute)
+ {#Source_File [#name @name
+ ... https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.10
+ #length (|> //index.length //unsigned.u4 try.trusted)
+ #info it]})
+
+(def .public (source_file it)
+ (-> Text
+ (Resource Attribute))
+ (do [! //pool.monad]
+ [it (//pool.utf8 it)]
+ (at ! each (source_file' it) (//pool.utf8 "SourceFile"))))
+
(def .public (format it)
(Format Attribute)
(when it
@@ -147,4 +166,7 @@
((info_format (/code.format format)) it)
{#Signature it}
+ ((info_format //index.format) it)
+
+ {#Source_File it}
((info_format //index.format) it)))
diff --git a/stdlib/source/library/lux/meta/target/jvm/class.lux b/stdlib/source/library/lux/meta/target/jvm/class.lux
index 1a5b3a1d8..ba01154b6 100644
--- a/stdlib/source/library/lux/meta/target/jvm/class.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/class.lux
@@ -94,22 +94,23 @@
Internal (Maybe (Signature Inheritance)) Internal (List Internal)
(List (Resource Field))
(List (Resource Method))
- (Sequence Attribute)
+ (List (Resource Attribute))
(Try Class))
(do try.monad
- [[pool [@this @super @interfaces] =fields =methods @signature]
+ [[pool [@this @super @interfaces] fields methods attributes @signature]
(<| (state.result' //pool.empty)
(do [! //pool.monad]
[classes (install_classes this super interfaces)
- =fields (monad.all ! fields)
- =methods (monad.all ! methods)
+ fields (monad.all ! fields)
+ methods (monad.all ! methods)
+ attributes (monad.all ! attributes)
@signature (when signature
{.#Some signature}
(at ! each (|>> {.#Some}) (//attribute.signature signature))
{.#None}
(in {.#None}))]
- (in [classes =fields =methods @signature])))]
+ (in [classes fields methods attributes @signature])))]
(in [#magic //magic.code
#minor_version //version.default_minor
#major_version version
@@ -118,14 +119,14 @@
#this @this
#super @super
#interfaces @interfaces
- #fields (sequence.of_list =fields)
- #methods (sequence.of_list =methods)
- #attributes (when @signature
- {.#Some @signature}
- (sequence.suffix @signature attributes)
+ #fields (sequence.of_list fields)
+ #methods (sequence.of_list methods)
+ #attributes (sequence.of_list (when @signature
+ {.#Some @signature}
+ {.#Item @signature attributes}
- {.#None}
- attributes)])))
+ {.#None}
+ attributes))])))
(def .public (format class)
(Format Class)
diff --git a/stdlib/source/test/lux/meta/extension.lux b/stdlib/source/test/lux/meta/extension.lux
index cdcf0879d..ab58d17b3 100644
--- a/stdlib/source/test/lux/meta/extension.lux
+++ b/stdlib/source/test/lux/meta/extension.lux
@@ -176,7 +176,7 @@
(list)
(list)
(list)
- sequence.empty)))
+ (list))))
@.js (js.comment commentary
(js.statement (js.string commentary)))
@.python (python.comment commentary