[backport:1.4] JS cstring null fixes (#16979)

* [backport:1.4] JS cstring null fixes
* fix JS move string
* make it look cleaner
This commit is contained in:
hlaaftana 2021-02-11 19:04:32 +03:00 • committed by GitHub
commit 81533a0014
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 69 additions and 8 deletions

View file

@ -14,4 +14,12 @@ block:
var x = "foo".cstring
var y: string
add(y, x)
doAssert y == "foo"
doAssert y == "foo"
block:
type Foo = object
a: string
var foo = Foo(a: "foo")
var y = move foo.a
doAssert foo.a.len == 0
doAssert y == "foo"