Skip to content

Commit

Permalink
Fix export of class name with dashes, #526 (#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude authored May 7, 2024
1 parent 751ee69 commit 6497300
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## v.0.7.108

- [#492](https://github.com/squint-cljs/squint/issues/492): defclass static methods and fields
- [#526](https://github.com/squint-cljs/squint/issues/526): Fix export of class name with dashes

## v0.7.107

Expand Down
2 changes: 1 addition & 1 deletion src/squint/compiler_common.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ break;}" body)

(defmethod emit-special 'squint.defclass/defclass* [_ env form]
(let [name (second form)]
(swap! *public-vars* conj name)
(swap! *public-vars* conj (munge* name))
(defclass/emit-class env
emit
(fn [async body-fn]
Expand Down
4 changes: 2 additions & 2 deletions test/squint/compiler_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1704,8 +1704,8 @@
(deftest defclass-test
(async done
#_(println (jss! (str (fs/readFileSync "test-resources/defclass_test.cljs"))))
(is (str/includes? (compiler/compile-string "(defclass Foo (constructor [this]))")
"export { Foo }"))
(is (str/includes? (compiler/compile-string "(defclass Foo-bar (constructor [this]))")
"export { Foo_bar }"))
(is (str/includes? (:javascript (compiler/compile-string* "(defclass Foo (constructor [this]))" {:repl true
:context :return}))
"return Foo"))
Expand Down

0 comments on commit 6497300

Please sign in to comment.