From a81434a890d70e7146c440c59caadc701c6099b3 Mon Sep 17 00:00:00 2001 From: Bung Date: Thu, 12 Nov 2020 01:41:49 +0800 Subject: Fix 14127 js from int to int casting (#15918) * fix #14127 from int to int casting * add test for #14127 * use template for test, also test uint2int * move to tests/types/t14127_cast_number.nim targets:c cpp js --- compiler/jsgen.nim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'compiler') diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index d124ae5fe..87021de11 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -2406,8 +2406,7 @@ proc genCast(p: PProc, n: PNode, r: var TCompRes) = r.res = "($1 $2)" % [r.res, trimmer] elif toInt: if fromInt: - let trimmer = unsignedTrimmer(dest.size) - r.res = "($1 $2)" % [r.res, trimmer] + return elif fromUint: if src.size == 4 and dest.size == 4: # XXX prevent multi evaluations -- cgit 1.4.1-2-gfad0