aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux/host/jvm/loader.jvm.lux1
-rw-r--r--stdlib/source/lux/tool/compiler/phase/macro.lux37
2 files changed, 2 insertions, 36 deletions
diff --git a/stdlib/source/lux/host/jvm/loader.jvm.lux b/stdlib/source/lux/host/jvm/loader.jvm.lux
index 9227b6c69..0ca92fa23 100644
--- a/stdlib/source/lux/host/jvm/loader.jvm.lux
+++ b/stdlib/source/lux/host/jvm/loader.jvm.lux
@@ -28,6 +28,7 @@
(exception: #export (unknown {class Text} {known-classes (List Text)})
(ex.report ["Class" class]
["Known classes" (|> known-classes
+ (list.sort (:: text.order <))
(list;map (|>> (format text.new-line text.tab)))
(text.join-with ""))]))
diff --git a/stdlib/source/lux/tool/compiler/phase/macro.lux b/stdlib/source/lux/tool/compiler/phase/macro.lux
index dbc201ca3..ddbde68ad 100644
--- a/stdlib/source/lux/tool/compiler/phase/macro.lux
+++ b/stdlib/source/lux/tool/compiler/phase/macro.lux
@@ -11,8 +11,7 @@
[collection
[array (#+ Array)]
["." list ("#;." functor)]]]
- ["." macro]
- ["." host (#+ import:)]]
+ ["." macro]]
["." //])
(exception: #export (expansion-failed {macro Name} {inputs (List Code)} {error Text})
@@ -30,43 +29,9 @@
(list;map (|>> %code (format text.new-line text.tab)))
(text.join-with ""))]))
-(import: #long java/lang/reflect/Method
- (invoke [java/lang/Object (Array java/lang/Object)] #try java/lang/Object))
-
-(import: #long (java/lang/Class c)
- (getMethod [java/lang/String (Array (java/lang/Class java/lang/Object))] #try java/lang/reflect/Method))
-
-(import: #long java/lang/Object
- (getClass [] (java/lang/Class java/lang/Object)))
-
-(def: _object-class
- (java/lang/Class java/lang/Object)
- (host.class-for java/lang/Object))
-
-(def: _apply-args
- (Array (java/lang/Class java/lang/Object))
- (|> (host.array (java/lang/Class java/lang/Object) 2)
- (host.array-write 0 _object-class)
- (host.array-write 1 _object-class)))
-
(type: #export Expander
(-> Macro (List Code) Lux (Error (Error [Lux (List Code)]))))
-(def: #export (jvm macro inputs lux)
- Expander
- (do error.monad
- [apply-method (|> macro
- (:coerce java/lang/Object)
- (java/lang/Object::getClass)
- (java/lang/Class::getMethod "apply" _apply-args))]
- (:coerce (Error (Error [Lux (List Code)]))
- (java/lang/reflect/Method::invoke
- (:coerce java/lang/Object macro)
- (|> (host.array java/lang/Object 2)
- (host.array-write 0 (:coerce java/lang/Object inputs))
- (host.array-write 1 (:coerce java/lang/Object lux)))
- apply-method))))
-
(def: #export (expand expander name macro inputs)
(-> Expander Name Macro (List Code) (Meta (List Code)))
(function (_ state)