mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-11 12:37:32 +03:00
103 lines
2.1 KiB
Plaintext
103 lines
2.1 KiB
Plaintext
(reset! echo-signature-after-bake true)
|
|
(reset! log-unloading-of-dylibs true)
|
|
|
|
(when (not carp-dev)
|
|
(do
|
|
;;(load-lisp (str carp-dir "lisp/glfw_test.carp"))
|
|
(load-lisp (str carp-dir "lisp/examples.carp"))
|
|
nil
|
|
))
|
|
|
|
(defn generic-call-2 [x]
|
|
(+ (id 10) (id x)))
|
|
|
|
(defn generic-call-2b [x]
|
|
(+ (id 10) (id x)))
|
|
|
|
(defn test-generic-call-2 []
|
|
(do (bake generic-call-2)
|
|
(assert-eq (signature generic-call-2) (list :fn '(:int) :int))))
|
|
|
|
|
|
|
|
;;(test-generic-call-2)
|
|
|
|
|
|
;; (defstruct Vec2
|
|
;; [x :float
|
|
;; y :float])
|
|
|
|
;; (def pos (Vec2 3.4 5.5))
|
|
|
|
;; (defstruct Person
|
|
;; [name :string
|
|
;; age :int])
|
|
|
|
;; (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))))
|
|
|
|
|
|
|
|
;; (defn fa [] 100)
|
|
;; (bake fa)
|
|
;; (assert-eq 100 (fa))
|
|
|
|
;; (defn fb [] (fa))
|
|
;; (bake fb)
|
|
;; (assert-eq 100 (fb))
|
|
|
|
;; (defn fc [] (fa))
|
|
;; (bake fc)
|
|
;; (assert-eq 100 (fc))
|
|
|
|
;; (defn fd [] (fc))
|
|
;; (bake fd)
|
|
;; (assert-eq 100 (fd))
|
|
|
|
;;(defn fa [] 200)
|
|
;;(bake fa)
|
|
|
|
|
|
|
|
(defn problematic [prob-f prob-a prob-b]
|
|
;;(println (ref (str )))
|
|
(prob-f (ref prob-a) (str prob-b))
|
|
)
|
|
|
|
;; (defn problematic [x y z]
|
|
;; (x z))
|
|
|
|
|
|
(def prob-ast (lambda-to-ast (code problematic)))
|
|
;; (def prob-asta (annotate-ast prob-ast))
|
|
|
|
;; (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
|
|
;; )))
|