From ba4315636368e3059212eb13aec59bf19f69aefa Mon Sep 17 00:00:00 2001 From: hlaaftana Date: Wed, 2 Oct 2019 22:01:59 +0300 Subject: [PATCH] Sets need copying in JS (#11392) * Sets need copying in JS * Fixes #11353 * Add test for #11353 --- compiler/jsgen.nim | 2 +- tests/js/t11353.nim | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/js/t11353.nim diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index 0384120416..a19f357223 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -975,7 +975,7 @@ proc countJsParams(typ: PType): int = const nodeKindsNeedNoCopy = {nkCharLit..nkInt64Lit, nkStrLit..nkTripleStrLit, - nkFloatLit..nkFloat64Lit, nkCurly, nkPar, nkStringToCString, + nkFloatLit..nkFloat64Lit, nkPar, nkStringToCString, nkObjConstr, nkTupleConstr, nkBracket, nkCStringToString, nkCall, nkPrefix, nkPostfix, nkInfix, nkCommand, nkHiddenCallConv, nkCallStrLit} diff --git a/tests/js/t11353.nim b/tests/js/t11353.nim new file mode 100644 index 0000000000..c1bc0ad4bc --- /dev/null +++ b/tests/js/t11353.nim @@ -0,0 +1,14 @@ +discard """ + output: ''' +{} +{} +''' +""" + +proc foo() = + var bar: set[int16] = {} + echo bar + bar.incl(1) + +foo() +foo()