aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--new-luxc/source/luxc/lang/translation/js/statement.jvm.lux47
-rw-r--r--stdlib/source/lux/tool/compiler/phase/extension/statement.lux7
2 files changed, 4 insertions, 50 deletions
diff --git a/new-luxc/source/luxc/lang/translation/js/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/js/statement.jvm.lux
deleted file mode 100644
index 21e52fe28..000000000
--- a/new-luxc/source/luxc/lang/translation/js/statement.jvm.lux
+++ /dev/null
@@ -1,47 +0,0 @@
-(.module:
- lux
- (lux (control [monad #+ do])
- [macro]
- (data text/format))
- (luxc (lang [".L" module]
- (host [js #+ JS Expression Statement])))
- [//]
- (// [".T" runtime]
- [".T" reference]
- [".T" eval]))
-
-(def: #export (translate-def name expressionT expressionJS metaV)
- (-> Text Type Expression Code (Meta Any))
- (do macro.Monad<Meta>
- [current-module macro.current-module-name
- #let [def-name [current-module name]]]
- (case (macro.get-identifier-ann (name-of #.alias) metaV)
- (#.Some real-def)
- (do @
- [[realT realA realV] (macro.find-def real-def)
- _ (moduleL.define def-name [realT metaV realV])]
- (wrap []))
-
- _
- (do @
- [_ (//.save-definition def-name expressionJS)
- expressionV (evalT.eval (referenceT.global def-name))
- _ (moduleL.define def-name [expressionT metaV expressionV])
- _ (if (macro.type? metaV)
- (case (macro.declared-tags metaV)
- #.Nil
- (wrap [])
-
- tags
- (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV)))
- (wrap []))
- #let [_ (log! (format "DEF " (%name def-name)))]]
- (wrap []))
- )))
-
-(def: #export (translate-program programJS)
- (-> Expression (Meta Statement))
- (macro.fail "translate-program NOT IMPLEMENTED YET")
- ## (hostT.save (format "var " (referenceT.variable +0) " = " runtimeT.lux//program-args "();"
- ## "(" programJS ")(null);"))
- )
diff --git a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux
index c5ae87050..29602faf7 100644
--- a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux
+++ b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux
@@ -91,16 +91,17 @@
(//.lift macro.current-module-name))
#let [full-name [current-module short-name]]
[_ annotationsT annotationsV] (evaluate! Code annotationsC)
- #let [annotationsV (:coerce Code annotationsV)]
+ #let [annotationsV (:coerce Code annotationsV)
+ type-definition? (macro.type? annotationsV)]
[value//type valueT valueN valueV] (define! full-name
- (if (macro.type? annotationsV)
+ (if type-definition?
(#.Some Type)
#.None)
valueC)
_ (statement.lift-analysis
(do @
[_ (module.define short-name [value//type annotationsV valueV])]
- (if (macro.type? annotationsV)
+ (if type-definition?
(case (macro.declared-tags annotationsV)
#.Nil
(wrap [])