2016-01-25 18:55:56 +03:00
|
|
|
(reset! echo-signature-after-bake true)
|
2016-03-02 13:14:49 +03:00
|
|
|
(reset! log-unloading-of-dylibs true)
|
2016-01-25 18:55:56 +03:00
|
|
|
|
|
|
|
(when (not carp-dev)
|
2016-01-29 19:40:46 +03:00
|
|
|
(do
|
|
|
|
;;(load-lisp (str carp-dir "lisp/glfw_test.carp"))
|
2016-02-11 12:56:26 +03:00
|
|
|
(load-lisp (str carp-dir "lisp/examples.carp"))
|
2016-01-29 19:40:46 +03:00
|
|
|
nil
|
|
|
|
))
|
2016-01-22 17:25:37 +03:00
|
|
|
|
2016-03-02 13:14:49 +03:00
|
|
|
(defn generic-call-2 [x]
|
|
|
|
(+ (id 10) (id x)))
|
2016-02-10 13:50:28 +03:00
|
|
|
|
2016-03-02 13:14:49 +03:00
|
|
|
(defn generic-call-2b [x]
|
|
|
|
(+ (id 10) (id x)))
|
2016-02-19 13:37:01 +03:00
|
|
|
|
2016-03-02 13:14:49 +03:00
|
|
|
(defn test-generic-call-2 []
|
|
|
|
(do (bake generic-call-2)
|
|
|
|
(assert-eq (signature generic-call-2) (list :fn '(:int) :int))))
|
2016-02-26 11:51:44 +03:00
|
|
|
|
2016-03-02 15:33:33 +03:00
|
|
|
|
|
|
|
|
2016-03-02 13:14:49 +03:00
|
|
|
;;(test-generic-call-2)
|
2016-02-27 02:58:15 +03:00
|
|
|
|
|
|
|
|
2016-03-02 13:14:49 +03:00
|
|
|
;; (defstruct Vec2
|
|
|
|
;; [x :float
|
|
|
|
;; y :float])
|
2016-02-27 02:58:15 +03:00
|
|
|
|
2016-03-02 13:14:49 +03:00
|
|
|
;; (def pos (Vec2 3.4 5.5))
|
2016-02-28 13:19:21 +03:00
|
|
|
|
2016-03-02 13:14:49 +03:00
|
|
|
;; (defstruct Person
|
|
|
|
;; [name :string
|
|
|
|
;; age :int])
|
2016-02-29 01:18:12 +03:00
|
|
|
|
2016-03-02 13:14:49 +03:00
|
|
|
;; (defn me [] (Person "erik" 29))
|
|
|
|
|
|
|
|
;; ;;(bake me)
|
|
|
|
|
|
|
|
;; (def me-ast (lambda-to-ast (code me)))
|
|
|
|
;; (def me-deps (find-func-deps me-ast false))
|
|
|
|
;; (def me-con (gencon me-deps))
|
|
|
|
;; (def me-typed (infer-types me-deps nil))
|
|
|
|
|
|
|
|
;; ;;(def me-con (gencon me-ast))
|
|
|
|
|
|
|
|
;; (bake me)
|
|
|
|
|
|
|
|
;; (defn peeps []
|
|
|
|
;; [(me) (Person "Klabbe" 53)])
|
|
|
|
|
|
|
|
;; ;;(bake peeps)
|
|
|
|
|
|
|
|
;; ;; (println (str (map #name (peeps))))
|
|
|
|
;; ;; (println (str (map #age (peeps))))
|
2016-02-29 01:18:12 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
2016-03-02 21:15:08 +03:00
|
|
|
;; (defn fa [] 100)
|
|
|
|
;; (bake fa)
|
|
|
|
;; (assert-eq 100 (fa))
|
2016-03-02 15:33:33 +03:00
|
|
|
|
2016-03-02 21:15:08 +03:00
|
|
|
;; (defn fb [] (fa))
|
|
|
|
;; (bake fb)
|
|
|
|
;; (assert-eq 100 (fb))
|
2016-03-02 15:33:33 +03:00
|
|
|
|
2016-03-02 21:15:08 +03:00
|
|
|
;; (defn fc [] (fa))
|
|
|
|
;; (bake fc)
|
|
|
|
;; (assert-eq 100 (fc))
|
2016-03-02 15:33:33 +03:00
|
|
|
|
2016-03-02 21:15:08 +03:00
|
|
|
;; (defn fd [] (fc))
|
|
|
|
;; (bake fd)
|
|
|
|
;; (assert-eq 100 (fd))
|
2016-03-02 15:33:33 +03:00
|
|
|
|
2016-03-02 21:15:08 +03:00
|
|
|
;;(defn fa [] 200)
|
|
|
|
;;(bake fa)
|
2016-03-02 15:33:33 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
2016-03-02 21:15:08 +03:00
|
|
|
(defn problematic [prob-f prob-a prob-b]
|
2016-03-02 22:41:56 +03:00
|
|
|
;;(println (ref (str )))
|
|
|
|
(prob-f (ref prob-a) (str prob-b))
|
|
|
|
)
|
|
|
|
|
|
|
|
;; (defn problematic [x y z]
|
|
|
|
;; (x z))
|
|
|
|
|
2016-03-02 15:33:33 +03:00
|
|
|
|
2016-03-02 21:15:08 +03:00
|
|
|
(def prob-ast (lambda-to-ast (code problematic)))
|
|
|
|
;; (def prob-asta (annotate-ast prob-ast))
|
2016-03-02 16:33:05 +03:00
|
|
|
|
2016-03-02 22:41:56 +03:00
|
|
|
;; (println (str (let [ast-func-deps (find-func-deps prob-ast '())
|
|
|
|
;; ast-typed (infer-types ast-func-deps '())
|
|
|
|
;; ast-named (generate-names (copy {}) ast-typed)
|
|
|
|
;; ast-lifetimes (calculate-lifetimes ast-named)
|
|
|
|
;; _ (println (str ast-lifetimes))
|
|
|
|
;; ;;ast-generics (visit-generic-funcs ast-lifetimes)
|
|
|
|
;; ]
|
|
|
|
;; ;;ast-lifetimes
|
|
|
|
;; ;;ast-generics
|
|
|
|
;; nil
|
|
|
|
;; )))
|