Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions pixie/vm/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,13 +759,6 @@ def compile_yield(form, ctx):
compile_form(arg, ctx)
ctx.bytecode.append(code.YIELD)

def compile_in_ns(form, ctx):
affirm(rt.count(form) == 2, u"in-ns requires an argument")
arg = rt.first(rt.next(form))
NS_VAR.set_value(code._ns_registry.find_or_make(rt.name(arg)))
NS_VAR.deref().include_stdlib()
compile_fn_call(form, ctx)

def compile_local_macro(form, ctx):
form = rt.next(form)
binding = rt.first(form)
Expand Down Expand Up @@ -799,7 +792,6 @@ def compile_local_macro(form, ctx):
u"var": compile_var,
u"catch": compile_catch,
u"this-ns-name": compile_this_ns,
u"in-ns": compile_in_ns, # yes, this is both a function and a compiler special form.
u"yield": compile_yield,
u"local-macro": compile_local_macro}

Expand Down
14 changes: 8 additions & 6 deletions tests/pixie/tests/test-stdlib.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -488,21 +488,22 @@
(t/deftest test-ns
;; Create a namespace called foo
(in-ns :foo)
(def bar :humbug)
(defn baz [x y] (+ x y))
(eval '(def bar :humbug))
(eval '(defn baz [x y] (+ x y)))
;; Back into the text namespace
(in-ns :pixie.tests.test-stdlib)
(t/assert= (set (keys (ns-map 'foo)))
(t/assert= (set (keys (ns-map 'foo)))
#{'bar 'baz}))

(t/deftest test-ns-aliases
(in-ns :ns-to-require)
(in-ns :my-fake-ns)
(require ns-to-require :as some-alias)
(in-ns :pixie.tests.test-stdlib)
(t/assert= {'some-alias (the-ns 'ns-to-require)
'pixie.stdlib (the-ns 'pixie.stdlib)}
(ns-aliases (the-ns 'my-fake-ns))))
(t/assert= {'some-alias (the-ns 'ns-to-require)
'pixie.stdlib (the-ns 'pixie.stdlib)}
(ns-aliases (the-ns 'my-fake-ns))))


(t/deftest test-while
(t/assert= (while (pos? 0) true ) nil)
Expand Down Expand Up @@ -693,6 +694,7 @@
(t/assert-throws? RuntimeException
"proto must be a Protocol"
(satisfies? [IIndexed :also-not-a-proto] [1 2]))
(in-ns :pixie.tests.test-stdlib)
(defprotocol IFoo (foo [this]))
(extend-protocol IFoo
Number
Expand Down