diff options
author | Eduardo Julian | 2017-11-01 13:36:15 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-11-01 13:36:15 -0400 |
commit | 88006e957373bbd72ec68897474303964885fc68 (patch) | |
tree | a34f88ea0921f56737c8881345245e11e7c8b546 /new-luxc/source/luxc/lang/analysis | |
parent | 012f6bd41e527479dddbccbdab10daa78fd9a0fd (diff) |
- Minor refactorings.
- Fixed some bugs.
- Enabled macro-expansion for statements.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/analysis/case.lux | 2 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/analysis/expression.lux | 32 |
2 files changed, 3 insertions, 31 deletions
diff --git a/new-luxc/source/luxc/lang/analysis/case.lux b/new-luxc/source/luxc/lang/analysis/case.lux index 1e40e38f1..f68733d7f 100644 --- a/new-luxc/source/luxc/lang/analysis/case.lux +++ b/new-luxc/source/luxc/lang/analysis/case.lux @@ -165,7 +165,7 @@ (do @ [nextA next] (wrap [(list) nextA])) - matches)] + (list;reverse matches))] (wrap [(` ("lux case tuple" [(~@ memberP+)])) thenA]))) diff --git a/new-luxc/source/luxc/lang/analysis/expression.lux b/new-luxc/source/luxc/lang/analysis/expression.lux index de0e49dbc..12256a4bf 100644 --- a/new-luxc/source/luxc/lang/analysis/expression.lux +++ b/new-luxc/source/luxc/lang/analysis/expression.lux @@ -11,6 +11,7 @@ [host]) (luxc ["&" base] [";L" host] + (host [";H" macro]) (lang ["la" analysis] (translation [";T" common])) ["&;" module]) @@ -21,35 +22,6 @@ [";A" structure] [";A" procedure])) -(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 - (getClass [] (Class Object)) - (toString [] String)) - (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: (call-macro macro inputs) - (-> Macro (List Code) (Meta (List Code))) - (do meta;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 [(:! Object macro) - (|> (host;array Object +2) - (host;array-write +0 (:! Object inputs)) - (host;array-write +1 (:! Object compiler)))] - apply-method)] - (:! (e;Error [Compiler (List Code)]) - output)))))) - }) - (exception: #export Macro-Expression-Must-Have-Single-Expansion) (exception: #export Unrecognized-Syntax) @@ -119,7 +91,7 @@ (if (meta;macro? def-anns) (do @ [expansion (function [compiler] - (case (call-macro (:! Macro def-value) args compiler) + (case (macroH;expand (:! Macro def-value) args compiler) (#e;Success [compiler' output]) (#e;Success [compiler' output]) |