Ship ES2015 restrictions on function declaration locations
Function declarations were previously permitted by V8 in many locations which no ECMAScript specification allowed; the ECMAScript 2015 spec enumerates a few locations (in blocks, as well as after labels and in conditionals when in sloppy mode). This patch ships the flag to restrict the usage of function declarations to those contexts. R=adamk LOG=Y BUG=v8:4824 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_chromium_rel_ng;tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1799233003 Cr-Commit-Position: refs/heads/master@{#34828}
This commit is contained in:
parent
042f09a95c
commit
f9db79ebdb
@ -214,8 +214,6 @@ DEFINE_IMPLICATION(es_staging, harmony_tailcalls)
|
||||
V(harmony_object_values_entries, "harmony Object.values / Object.entries") \
|
||||
V(harmony_object_own_property_descriptors, \
|
||||
"harmony Object.getOwnPropertyDescriptors()") \
|
||||
V(harmony_restrictive_declarations, \
|
||||
"harmony limitations on sloppy mode function declarations")
|
||||
|
||||
// Features that are shipping (turned on by default, but internal flag remains).
|
||||
#define HARMONY_SHIPPING(V) \
|
||||
@ -230,6 +228,8 @@ DEFINE_IMPLICATION(es_staging, harmony_tailcalls)
|
||||
V(harmony_proxies, "harmony proxies") \
|
||||
V(harmony_reflect, "harmony Reflect API") \
|
||||
V(harmony_regexp_subclass, "harmony regexp subclassing") \
|
||||
V(harmony_restrictive_declarations, \
|
||||
"harmony limitations on sloppy mode function declarations") \
|
||||
V(harmony_species, "harmony Symbol.species")
|
||||
|
||||
// Once a shipping feature has proved stable in the wild, it will be dropped
|
||||
|
@ -25,6 +25,8 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Flags: --no-harmony-restrictive-declarations
|
||||
|
||||
function foo(f) { eval(f); }
|
||||
|
||||
// Ensure that compiling a declaration of a function does not crash.
|
||||
|
@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-sloppy --harmony-sloppy-function --harmony-sloppy-let
|
||||
// Flags: --no-harmony-restrictive-declarations
|
||||
|
||||
// At some point, this code led to DCHECK errors in debug mode
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-sloppy --harmony-sloppy-function
|
||||
// Flags: --no-harmony-restrictive-declarations
|
||||
|
||||
// Previously, this caused a CHECK fail in debug mode
|
||||
// https://code.google.com/p/chromium/issues/detail?id=542099
|
||||
|
@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-sloppy --harmony-sloppy-function
|
||||
// Flags: --no-harmony-restrictive-declarations
|
||||
|
||||
(function() {
|
||||
var x = {a: 1}
|
||||
|
@ -21,6 +21,8 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Flags: --no-harmony-restrictive-declarations
|
||||
|
||||
description(
|
||||
"This test checks that the following expressions or statements are valid ECMASCRIPT code or should throw parse error"
|
||||
);
|
||||
|
@ -21,6 +21,8 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Flags: --no-harmony-restrictive-declarations
|
||||
|
||||
description(
|
||||
"This test checks that function declarations are treated as statements."
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user