diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index 8625f2fe1d..65706cdfaf 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -1149,7 +1149,7 @@ template isIndirect(x: PSym): bool = let v = x ({sfAddrTaken, sfGlobal} * v.flags != {} and #(mapType(v.typ) != etyObject) and - {sfImportc, sfVolatile, sfExportc} * v.flags == {} and + {sfImportc, sfExportc} * v.flags == {} and v.kind notin {skProc, skFunc, skConverter, skMethod, skIterator, skConst, skTemp, skLet}) @@ -1235,7 +1235,7 @@ proc genProcForSymIfNeeded(p: PProc, s: PSym) = proc genCopyForParamIfNeeded(p: PProc, n: PNode) = let s = n.sym - if p.prc == s.owner or needsNoCopy(p, n): + if p.prc == s.owner or needsNoCopy(p, n): return var owner = p.up while true: @@ -1597,8 +1597,7 @@ proc createVar(p: PProc, typ: PType, indirect: bool): Rope = internalError(p.config, "createVar: " & $t.kind) result = nil -template returnType: untyped = - ~"" +template returnType: untyped = ~"" proc genVarInit(p: PProc, v: PSym, n: PNode) = var diff --git a/tests/js/tbasicenum.nim b/tests/js/tbasicenum.nim deleted file mode 100644 index a9e9ce2dac..0000000000 --- a/tests/js/tbasicenum.nim +++ /dev/null @@ -1,10 +0,0 @@ -discard """ - output: "ABCDC" -""" - -type - MyEnum = enum - A,B,C,D -# trick the optimizer with an seq: -var x = @[A,B,C,D] -echo x[0],x[1],x[2],x[3],MyEnum(2) \ No newline at end of file diff --git a/tests/js/tbasics.nim b/tests/js/tbasics.nim new file mode 100644 index 0000000000..0c8d33e7fd --- /dev/null +++ b/tests/js/tbasics.nim @@ -0,0 +1,37 @@ +discard """ + output: '''ABCDC +1 +14 +ok''' +""" + +type + MyEnum = enum + A,B,C,D +# trick the optimizer with an seq: +var x = @[A,B,C,D] +echo x[0],x[1],x[2],x[3],MyEnum(2) + +# bug #10651 + +var xa: seq[int] +var ya = @[1,2] +xa &= ya +echo xa[0] + +proc test = + var yup: seq[int] + try: + yup.add 14 + echo yup.pop + finally: + discard + +test() + +when true: + var a: seq[int] + + a.setLen(0) + + echo "ok" \ No newline at end of file