diff --git a/test/serializer/optimized-functions/2248-repro.js b/test/serializer/optimized-functions/2248-repro.js new file mode 100644 index 000000000..2bf1954f7 --- /dev/null +++ b/test/serializer/optimized-functions/2248-repro.js @@ -0,0 +1,19 @@ +function fn(str, start) { + var size = str.length; + var posA = 0; + if (start > 0) { + for (; start > 0 && posA < size; start--) { + posA += 1 + str.charCodeAt(posA); + } + if (posA >= size) { + return posA; + } + } +} + +if (global.__optimize) __optimize(fn); + +global.inspect = function() { + let res1 = fn("abcdef", 1); + return res1; +};