aboutsummaryrefslogtreecommitdiff
path: root/src/lux/analyser/base.clj
diff options
context:
space:
mode:
authorEduardo Julian2015-04-16 22:41:15 -0400
committerEduardo Julian2015-04-16 22:41:15 -0400
commit61f70deb6d4e8ad2f9e06122c3591a075c5b1bbc (patch)
tree2a412a10ca838878918edcf1015b8918890b69f1 /src/lux/analyser/base.clj
parent12aed842461ecc596c07227dcefce36d440e2c85 (diff)
- |do bindings are now based on pattern matching (that way, tuple destructuring can be done at do).
- Patterns are no longer put inside a MatchAC structure, but are instead just moved around as lists. - Code outside of &type can no longer create/delete type-vars directly, but must now rely on with-var & with-vars to manage the life-cycle of type-vars. - Simplified pattern-matching analysis at lux/analyser/case. - The LEFT_APP optimization in check* has been replicated on the other side as RIGHT_APP, to attempt to improve performance of pattern-matching.
Diffstat (limited to 'src/lux/analyser/base.clj')
-rw-r--r--src/lux/analyser/base.clj27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/lux/analyser/base.clj b/src/lux/analyser/base.clj
index 35c12c3e0..9acd37028 100644
--- a/src/lux/analyser/base.clj
+++ b/src/lux/analyser/base.clj
@@ -1,7 +1,7 @@
(ns lux.analyser.base
(:require [clojure.core.match :as M :refer [match matchv]]
clojure.core.match.array
- (lux [base :as & :refer [|do return fail]]
+ (lux [base :as & :refer [|let |do return fail]]
[type :as &type])))
;; [Resources]
@@ -36,22 +36,9 @@
[_]
(fail "[Analyser Error] Can't expand to other than 2 elements.")))))
-(defn with-var [k]
- (|do [=var &type/create-var
- =ret (k =var)]
- (matchv ::M/objects [=ret]
- [["Expression" [?expr ?type]]]
- (|do [id (&type/var-id =var)
- =type (&type/clean id ?type)
- :let [_ (prn 'with-var/CLEANING id)]
- _ (&type/delete-var id)]
- (return (&/V "Expression" (&/T ?expr =type))))
-
- [_]
- (assert false (pr-str '&&/with-var (aget =ret 0))))))
-
-(defmacro with-vars [vars body]
- (reduce (fn [b v]
- `(with-var (fn [~v] ~b)))
- body
- (reverse vars)))
+(defn resolved-ident [ident]
+ (|let [[?module ?name] ident]
+ (|do [module* (if (= "" ?module)
+ &/get-module-name
+ (return ?module))]
+ (return (&/ident->text (&/T module* ?name))))))