implement temporal dead zone for default parameters - fixes #169

This commit is contained in:
Sebastian McKenzie
2014-11-16 14:32:03 +11:00
parent 00483917f0
commit a1895b4bb4
7 changed files with 69 additions and 8 deletions

View File

@@ -1,8 +1,8 @@
"use strict";
var t = function (t, f) {
if (f === undefined) f = 5;
if (t === undefined) t = "foo";
if (f === undefined) f = 5;
return t + " bar " + f;
};

View File

@@ -0,0 +1 @@
function foo(a=b, b) {}

View File

@@ -0,0 +1,3 @@
{
"throws": "Temporal dead zone - accessing a variable before it's initialized"
}

View File

@@ -0,0 +1,4 @@
assert.equal((function(a, b=a++){
function b(){}
return a;
})(1), 2);

View File

@@ -0,0 +1 @@
function foo(a=a) {}

View File

@@ -0,0 +1,3 @@
{
"throws": "Temporal dead zone - accessing a variable before it's initialized"
}