aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEduardo Julian2015-10-27 14:44:26 -0400
committerEduardo Julian2015-10-27 14:44:26 -0400
commit95db55b06d4dc8dbd167ec6f47be4afccb88da92 (patch)
tree8486077ec5d21cc72e323c9e550e77e2a9b3c009 /src
parentafb338bc42d631caedf80d5dd7affb8f6d604f86 (diff)
- Storage instructions during pattern matching when doing aliasing now use the -1 index to signal no-op.
- Removed unnecessary debugging logging.
Diffstat (limited to 'src')
-rw-r--r--src/lux/analyser.clj15
-rw-r--r--src/lux/analyser/case.clj5
-rw-r--r--src/lux/analyser/lux.clj3
-rw-r--r--src/lux/compiler/case.clj10
4 files changed, 10 insertions, 23 deletions
diff --git a/src/lux/analyser.clj b/src/lux/analyser.clj
index ac1b5cb8e..29043e868 100644
--- a/src/lux/analyser.clj
+++ b/src/lux/analyser.clj
@@ -655,23 +655,10 @@
(str "@ " file "," line "," col "\n" msg))))
(defn ^:private analyse-basic-ast [analyse eval! compile-module compile-token exo-type token]
- ;; (prn 'analyse-basic-ast (&/show-ast token))
(|case token
[meta ?token]
(fn [state]
- (|case (try ((aba1 analyse eval! compile-module compile-token exo-type ?token) state)
- (catch Error e
- (prn 'analyse-basic-ast/Error-1 e)
- (prn 'analyse-basic-ast/Error-2 (&/show-ast token))
- (prn 'analyse-basic-ast/Error-3 (&type/show-type exo-type))
- (|case ((&type/deref+ exo-type) state)
- (&/$Right [_state _exo-type])
- (prn 'analyse-basic-ast/Error-4 (&type/show-type _exo-type))
-
- _
- (prn 'analyse-basic-ast/Error-4 'YOLO))
- (throw e))
- )
+ (|case ((aba1 analyse eval! compile-module compile-token exo-type ?token) state)
(&/$Right state* output)
(return* state* output)
diff --git a/src/lux/analyser/case.clj b/src/lux/analyser/case.clj
index 9fc10231f..7e5fd924b 100644
--- a/src/lux/analyser/case.clj
+++ b/src/lux/analyser/case.clj
@@ -126,9 +126,8 @@
(|case var??
(&/$Some var-analysis)
(|do [=kont (&env/with-alias name var-analysis
- kont)
- idx &env/next-local-idx]
- (return (&/T (&/V $StoreTestAC idx) =kont)))
+ kont)]
+ (return (&/T (&/V $StoreTestAC -1) =kont)))
_
(|do [=kont (&env/with-local name value-type
diff --git a/src/lux/analyser/lux.clj b/src/lux/analyser/lux.clj
index 0c76998c6..f7e138e45 100644
--- a/src/lux/analyser/lux.clj
+++ b/src/lux/analyser/lux.clj
@@ -537,10 +537,7 @@
(|do [=type (&&/analyse-1 analyse &type/Type ?type)
==type (eval! =type)
_ (&type/check exo-type ==type)
- ;; :let [_ (prn 'analyse-coerce/_0 (&/show-ast ?value) (&type/show-type ==type))]
=value (&&/analyse-1+ analyse ?value)
- ;; =value (&&/analyse-1* analyse ?value)
- ;; :let [_ (prn 'analyse-coerce/_1 (&/show-ast ?value) (&type/show-type ==type))]
_cursor &/cursor]
(return (&/|list (&&/|meta ==type _cursor
(&/V &&/$coerce (&/T =value =type ==type))
diff --git a/src/lux/compiler/case.clj b/src/lux/compiler/case.clj
index 20c90d661..61209b7fb 100644
--- a/src/lux/compiler/case.clj
+++ b/src/lux/compiler/case.clj
@@ -26,9 +26,13 @@
(defn ^:private compile-match [^MethodVisitor writer ?match $target $else]
(|case ?match
(&a-case/$StoreTestAC ?idx)
- (doto writer
- (.visitVarInsn Opcodes/ASTORE ?idx)
- (.visitJumpInsn Opcodes/GOTO $target))
+ (if (< ?idx 0)
+ (doto writer
+ (.visitInsn Opcodes/POP) ;; Basically, a No-Op
+ (.visitJumpInsn Opcodes/GOTO $target))
+ (doto writer
+ (.visitVarInsn Opcodes/ASTORE ?idx)
+ (.visitJumpInsn Opcodes/GOTO $target)))
(&a-case/$BoolTestAC ?value)
(doto writer