X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/tests/stress/class-syntax-tdz-in-loop.js?ds=inline diff --git a/tests/stress/class-syntax-tdz-in-loop.js b/tests/stress/class-syntax-tdz-in-loop.js new file mode 100644 index 0000000..6ab5e6d --- /dev/null +++ b/tests/stress/class-syntax-tdz-in-loop.js @@ -0,0 +1,30 @@ + +class A { + constructor() { } +} + +class B extends A { + constructor() { + for (var j = 0; j < 100; j++) { + if (j) + super(); + else + this; + } + } +} + +noInline(B); + +for (var i = 0; i < 10000; ++i) { + var exception = null; + try { + new B(); + } catch (e) { + exception = e; + if (!(e instanceof ReferenceError)) + throw "Exception thrown in iteration " + i + " was not a reference error"; + } + if (!exception) + throw "Exception not thrown for an unitialized this at iteration " + i; +}