diff options
author | Eduardo Julian | 2018-08-09 23:39:17 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-08-09 23:39:17 -0400 |
commit | 84d7f9ccef221e9797929813af1094b335ba26e9 (patch) | |
tree | 428eb540e900d4e2bb29371361894d54389a0d66 /new-luxc/source/luxc/lang/macro.lux | |
parent | 2ab2c4dc219e5d3667f4f2626166dfc782052fe3 (diff) |
- Fixes for eval.
- Macro-expansion during analysis.
Diffstat (limited to 'new-luxc/source/luxc/lang/macro.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/macro.lux | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/new-luxc/source/luxc/lang/macro.lux b/new-luxc/source/luxc/lang/macro.lux deleted file mode 100644 index 17ed2436b..000000000 --- a/new-luxc/source/luxc/lang/macro.lux +++ /dev/null @@ -1,35 +0,0 @@ -(.module: - lux - (lux (control [monad #+ do]) - (data ["e" error]) - [macro] - [host]) - (luxc (lang [".L" host] - (translation (jvm [".T" common]))))) - -(for {"JVM" (as-is (host.import: java/lang/reflect/Method - (invoke [Object (Array Object)] #try Object)) - (host.import: (java/lang/Class c) - (getMethod [String (Array (Class Object))] #try Method)) - (host.import: java/lang/Object) - (def: _object-class (Class Object) (host.class-for Object)) - (def: _apply-args - (Array (Class Object)) - (|> (host.array (Class Object) +2) - (host.array-write +0 _object-class) - (host.array-write +1 _object-class))) - (def: #export (expand macro inputs) - (-> Macro (List Code) (Meta (List Code))) - (do macro.Monad<Meta> - [class (commonT.load-class hostL.function-class)] - (function (_ compiler) - (do e.Monad<Error> - [apply-method (Class::getMethod ["apply" _apply-args] class) - output (Method::invoke [(:coerce Object macro) - (|> (host.array Object +2) - (host.array-write +0 (:coerce Object inputs)) - (host.array-write +1 (:coerce Object compiler)))] - apply-method)] - (:coerce (e.Error [Lux (List Code)]) - output)))))) - }) |