Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1398)

Unified Diff: test/mjsunit/regress/regress-91120.js

Issue 1571793002: Reland of Ship ES2015 sloppy-mode function hoisting, let, class (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | test/mjsunit/regress/regress-crbug-323936.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-91120.js
diff --git a/test/mjsunit/regress/regress-91120.js b/test/mjsunit/regress/regress-91120.js
index 117acac6cdcfbb3bd2fe28d84df8c547c7c49d42..73f545648aff8ba7bbdc88f42a8897d4f37c9129 100644
--- a/test/mjsunit/regress/regress-91120.js
+++ b/test/mjsunit/regress/regress-91120.js
@@ -25,24 +25,26 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// We intend that the function declaration for g inside catch is hoisted to
-// function f's scope. Invoke it before try/catch, in the try block, in the
-// catch block, after try/catch, and outside f, and verify that it has
-// access to the proper binding of x.
+// With ES2015 function hoisting semantics, functions are only "hoisted" out
+// of blocks by writing their values into var-scoped declarations. Therefore,
+// they access the catch binding when it syntactically appears so.
+// This is a potentially breaking change vs the old semantics, which would
+// return 'function' from g() everywhere.
+
var x = 'global';
function f() {
var x = 'function';
- assertEquals('function', g());
+ assertEquals(undefined, g);
try {
- assertEquals('function', g());
+ assertEquals(undefined, g);
throw 'catch';
} catch (x) {
function g() { return x; }
- assertEquals('function', g());
+ assertEquals('catch', g());
}
- assertEquals('function', g());
+ assertEquals('catch', g());
return g;
}
-assertEquals('function', f()());
+assertEquals('catch', f()());
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | test/mjsunit/regress/regress-crbug-323936.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698