aboutsummaryrefslogtreecommitdiff
path: root/luxc
diff options
context:
space:
mode:
authorEduardo Julian2018-07-31 22:54:35 -0400
committerEduardo Julian2018-07-31 22:54:35 -0400
commit428965131e17d101a16e3ca60b3412101e216cd1 (patch)
tree2b74c5241ee117aa581f4ee7301fc1e5f1bfa6a8 /luxc
parent97ab1f076ac08992d6b64cd77bc0bef97b3fc50a (diff)
Now implementing box functionality in stdlib instead of the compiler.
Diffstat (limited to 'luxc')
-rw-r--r--luxc/src/lux/analyser/proc/common.clj39
-rw-r--r--luxc/src/lux/compiler/jvm/proc/common.clj48
2 files changed, 0 insertions, 87 deletions
diff --git a/luxc/src/lux/analyser/proc/common.clj b/luxc/src/lux/analyser/proc/common.clj
index ca0447548..f382c2ff3 100644
--- a/luxc/src/lux/analyser/proc/common.clj
+++ b/luxc/src/lux/analyser/proc/common.clj
@@ -233,50 +233,11 @@
(return (&/|list (&&/|meta exo-type _cursor
(&&/$proc (&/T ["io" "current-time"]) (&/|list) (&/|list)))))))
-(defn ^:private analyse-box-new [analyse exo-type ?values]
- (&type/with-var
- (fn [$var]
- (|do [:let [(&/$Cons ?init (&/$Nil)) ?values]
- =init (&&/analyse-1 analyse $var ?init)
- _ (&type/check exo-type (&/$UnivQ (&/|list) (&type/Box (&/$Parameter 1) $var)))
- _cursor &/cursor]
- (return (&/|list (&&/|meta exo-type _cursor
- (&&/$proc (&/T ["box" "new"]) (&/|list =init) (&/|list)))))))))
-
-(defn ^:private analyse-box-read [analyse exo-type ?values]
- (&type/with-var
- (fn [threadT]
- (&type/with-var
- (fn [valueT]
- (|do [:let [(&/$Cons boxC (&/$Nil)) ?values]
- boxA (&&/analyse-1 analyse (&type/Box threadT valueT) boxC)
- _ (&type/check exo-type valueT)
- _cursor &/cursor]
- (return (&/|list (&&/|meta exo-type _cursor
- (&&/$proc (&/T ["box" "read"]) (&/|list boxA) (&/|list)))))))))))
-
-(defn ^:private analyse-box-write [analyse exo-type ?values]
- (&type/with-var
- (fn [threadT]
- (&type/with-var
- (fn [valueT]
- (|do [:let [(&/$Cons valueC (&/$Cons boxC (&/$Nil))) ?values]
- boxA (&&/analyse-1 analyse (&type/Box threadT valueT) boxC)
- valueA (&&/analyse-1 analyse valueT valueC)
- _ (&type/check exo-type &type/Any)
- _cursor &/cursor]
- (return (&/|list (&&/|meta exo-type _cursor
- (&&/$proc (&/T ["box" "write"]) (&/|list valueA boxA) (&/|list)))))))))))
-
(defn analyse-proc [analyse exo-type proc ?values]
(try (case proc
"lux is" (analyse-lux-is analyse exo-type ?values)
"lux try" (analyse-lux-try analyse exo-type ?values)
- "lux box new" (analyse-box-new analyse exo-type ?values)
- "lux box read" (analyse-box-read analyse exo-type ?values)
- "lux box write" (analyse-box-write analyse exo-type ?values)
-
"lux io log" (analyse-io-log analyse exo-type ?values)
"lux io error" (analyse-io-error analyse exo-type ?values)
"lux io exit" (analyse-io-exit analyse exo-type ?values)
diff --git a/luxc/src/lux/compiler/jvm/proc/common.clj b/luxc/src/lux/compiler/jvm/proc/common.clj
index 3f10bade1..444db63e3 100644
--- a/luxc/src/lux/compiler/jvm/proc/common.clj
+++ b/luxc/src/lux/compiler/jvm/proc/common.clj
@@ -374,47 +374,6 @@
&&/wrap-long)]]
(return nil)))
-(defn ^:private compile-box-new [compile ?values special-args]
- (|do [:let [(&/$Cons initS (&/$Nil)) ?values]
- ^MethodVisitor *writer* &/get-writer
- :let [_ (doto *writer*
- (.visitLdcInsn (int 1))
- (.visitTypeInsn Opcodes/ANEWARRAY "java/lang/Object"))]
- :let [_ (doto *writer*
- (.visitInsn Opcodes/DUP)
- (.visitLdcInsn (int 0)))]
- _ (compile initS)
- :let [_ (doto *writer*
- (.visitInsn Opcodes/AASTORE))]]
- (return nil)))
-
-(defn ^:private compile-box-read [compile ?values special-args]
- (|do [:let [(&/$Cons boxS (&/$Nil)) ?values
- ;; (&/$Nil) special-args
- ]
- ^MethodVisitor *writer* &/get-writer
- _ (compile boxS)
- :let [_ (doto *writer*
- (.visitTypeInsn Opcodes/CHECKCAST "[Ljava/lang/Object;")
- (.visitLdcInsn (int 0))
- (.visitInsn Opcodes/AALOAD))]]
- (return nil)))
-
-(defn ^:private compile-box-write [compile ?values special-args]
- (|do [:let [(&/$Cons valueS (&/$Cons boxS (&/$Nil))) ?values
- ;; (&/$Nil) special-args
- ]
- ^MethodVisitor *writer* &/get-writer
- _ (compile boxS)
- :let [_ (doto *writer*
- (.visitTypeInsn Opcodes/CHECKCAST "[Ljava/lang/Object;")
- (.visitLdcInsn (int 0)))]
- _ (compile valueS)
- :let [_ (doto *writer*
- (.visitInsn Opcodes/AASTORE)
- (.visitLdcInsn &/unit-tag))]]
- (return nil)))
-
(defn compile-proc [compile category proc ?values special-args]
(case category
"lux"
@@ -480,12 +439,5 @@
"decode" (compile-frac-decode compile ?values special-args)
)
- "box"
- (case proc
- "new" (compile-box-new compile ?values special-args)
- "read" (compile-box-read compile ?values special-args)
- "write" (compile-box-write compile ?values special-args)
- )
-
;; else
(&/fail-with-loc (str "[Compiler Error] Unknown procedure: " [category proc]))))