From a4e0eb58480a05e4c23a07d33965022125c539f2 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 7 Apr 2019 17:49:35 -0400 Subject: Updated the JVM compiler to the latest changes. --- stdlib/source/lux/host/jvm/loader.jvm.lux | 1 + stdlib/source/lux/tool/compiler/phase/macro.lux | 37 +------------------------ 2 files changed, 2 insertions(+), 36 deletions(-) (limited to 'stdlib/source') 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) -- cgit v1.2.3