Reviewers: adamk,
Description:
Stage sloppy let
Move the --harmony-sloppy-let flag to staging for further testing, and
update test262 for the new passing tests. Also increase the strictness
of the parser, even in sloppy mode, to disallow "new legacy compat" for
for (let x = 5 in {}) {}
which is now a SyntaxError.
BUG=v8:3305
LOG=Y
R=adamk
Please review this at https://codereview.chromium.org/1321013005/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+19, -67 lines):
M src/flag-definitions.h
M src/parser.cc
M test/test262-es6/test262-es6.status
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index
d75f8b66435144b4047f3f94cdde6d163cbfc069..8fc489863b4a08c30120cb08034b0b8e7e04b4c0
100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -193,7 +193,6 @@ DEFINE_BOOL(legacy_const, true, "legacy semantics for
const in sloppy mode")
V(harmony_regexps, "harmony regular expression extensions") \
V(harmony_proxies, "harmony proxies") \
V(harmony_sloppy_function, "harmony sloppy function block scoping") \
- V(harmony_sloppy_let, "harmony let in sloppy mode") \
V(harmony_unicode_regexps, "harmony unicode regexps") \
V(harmony_reflect, "harmony Reflect API") \
V(harmony_destructuring, "harmony destructuring") \
@@ -206,7 +205,8 @@ DEFINE_BOOL(legacy_const, true, "legacy semantics for
const in sloppy mode")
V(harmony_tostring, "harmony toString") \
V(harmony_concat_spreadable, "harmony isConcatSpreadable") \
V(harmony_rest_parameters, "harmony rest parameters") \
- V(harmony_sloppy, "harmony features in sloppy mode")
+ V(harmony_sloppy, "harmony features in sloppy mode") \
+ V(harmony_sloppy_let, "harmony let in sloppy mode")
// Features that are shipping (turned on by default, but internal flag
remains).
#define HARMONY_SHIPPING(V) \
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index
e6ef2e8ef3096f80195170585656a90630096adb..d993d20595de80567f267e8410dfe77edcbe450c
100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -3601,7 +3601,8 @@ Statement* Parser::ParseForStatement(ZoneList<const
AstRawString*>* labels,
return nullptr;
}
if (parsing_result.first_initializer_loc.IsValid() &&
- (is_strict(language_mode()) || mode ==
ForEachStatement::ITERATE)) {
+ (is_strict(language_mode()) || mode ==
ForEachStatement::ITERATE ||
+ IsLexicalVariableMode(parsing_result.descriptor.mode))) {
if (mode == ForEachStatement::ITERATE) {
ReportMessageAt(parsing_result.first_initializer_loc,
MessageTemplate::kForOfLoopInitializer);
Index: test/test262-es6/test262-es6.status
diff --git a/test/test262-es6/test262-es6.status
b/test/test262-es6/test262-es6.status
index
c3496a3a56b63401b71f891b40e0d07148e8151c..09c941543c70576c06bc31ee4b95504be971a0e9
100644
--- a/test/test262-es6/test262-es6.status
+++ b/test/test262-es6/test262-es6.status
@@ -74,40 +74,10 @@
###################### MISSING ES6 FEATURES #######################
- # Class, let, const in sloppy mode.
+ # Const is still interpreted as legacy const in sloppy mode
# https://code.google.com/p/v8/issues/detail?id=3305
- 'language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-1':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-1':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-2':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/leave/outermost-binding-updated-in-catch-block-nested-block-let-declaration-unseen-outside-of-block':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-1':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-2':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/leave/verify-context-in-finally-block': [PASS,
FAIL_SLOPPY],
- 'language/block-scope/leave/verify-context-in-for-loop-block': [PASS,
FAIL_SLOPPY],
- 'language/block-scope/leave/verify-context-in-labelled-block': [PASS,
FAIL_SLOPPY],
- 'language/block-scope/leave/verify-context-in-try-block': [PASS,
FAIL_SLOPPY],
- 'language/block-scope/leave/x-after-break-to-label': [PASS, FAIL_SLOPPY],
- 'language/block-scope/leave/x-before-continue': [PASS, FAIL_SLOPPY],
- 'language/block-scope/return-from/block-let': [PASS, FAIL_SLOPPY],
- 'language/block-scope/shadowing/catch-parameter-shadowing-let-declaration':
[PASS,
FAIL_SLOPPY],
'language/block-scope/shadowing/const-declaration-shadowing-catch-parameter':
[PASS,
FAIL_SLOPPY],
'language/block-scope/shadowing/const-declarations-shadowing-parameter-name-let-const-and-var-variables':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/shadowing/dynamic-lookup-from-closure': [PASS,
FAIL_SLOPPY],
- 'language/block-scope/shadowing/dynamic-lookup-in-and-through-block-contexts':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/shadowing/let-declaration-shadowing-catch-parameter':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/shadowing/let-declarations-shadowing-parameter-name-let-const-and-var':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/shadowing/lookup-from-closure': [PASS,
FAIL_SLOPPY],
- 'language/block-scope/shadowing/lookup-in-and-through-block-contexts':
[PASS, FAIL_SLOPPY],
- 'language/block-scope/shadowing/parameter-name-shadowing-parameter-name-let-const-and-var':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/syntax/for-in/acquire-properties-from-array':
[PASS, FAIL_SLOPPY],
- 'language/block-scope/syntax/for-in/acquire-properties-from-object':
[PASS, FAIL_SLOPPY],
- 'language/block-scope/syntax/for-in/mixed-values-in-iteration': [PASS,
FAIL_SLOPPY],
- 'language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-var':
[PASS,
FAIL_SLOPPY],
- 'language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-with-function-declaration':
[PASS,
FAIL_SLOPPY],
'language/statements/const/block-local-closure-get-before-initialization':
[PASS,
FAIL_SLOPPY],
'language/statements/const/block-local-use-before-initialization-in-declaration-statement':
[PASS,
FAIL_SLOPPY],
'language/statements/const/block-local-use-before-initialization-in-prior-statement':
[PASS,
FAIL_SLOPPY],
@@ -138,49 +108,30 @@
'language/statements/const/syntax/without-initializer-if-expression-statement-else-statement':
[PASS,
FAIL_SLOPPY],
'language/statements/const/syntax/without-initializer-label-statement':
[PASS, FAIL_SLOPPY],
'language/statements/const/syntax/without-initializer-while-expression-statement':
[PASS,
FAIL_SLOPPY],
- 'language/statements/continue/labeled-continue': [PASS, FAIL_SLOPPY],
- 'language/statements/continue/nested-let-bound-for-loops-inner-continue':
[PASS,
FAIL_SLOPPY],
- 'language/statements/continue/nested-let-bound-for-loops-labeled-continue':
[PASS,
FAIL_SLOPPY],
- 'language/statements/continue/nested-let-bound-for-loops-outer-continue':
[PASS,
FAIL_SLOPPY],
- 'language/statements/continue/no-label-continue': [PASS, FAIL_SLOPPY],
- 'language/statements/continue/shadowing-loop-variable-in-same-scope-as-continue':
[PASS,
FAIL_SLOPPY],
- 'language/statements/continue/simple-and-labeled': [PASS, FAIL_SLOPPY],
'language/statements/for-in/const-bound-names-fordecl-tdz-for-in':
[PASS, FAIL_SLOPPY],
'language/statements/for-in/const-fresh-binding-per-iteration-for-in':
[PASS, FAIL_SLOPPY],
- 'language/statements/for-in/let-bound-names-fordecl-tdz-for-in': [PASS,
FAIL_SLOPPY],
- 'language/statements/for-in/let-fresh-binding-per-iteration-for-in':
[PASS, FAIL_SLOPPY],
'language/statements/for-of/const-bound-names-fordecl-tdz-for-of':
[PASS, FAIL_SLOPPY],
'language/statements/for-of/const-fresh-binding-per-iteration-for-of':
[PASS, FAIL_SLOPPY],
- 'language/statements/for-of/let-bound-names-fordecl-tdz-for-of': [PASS,
FAIL_SLOPPY],
- 'language/statements/for-of/let-fresh-binding-per-iteration-for-of':
[PASS, FAIL_SLOPPY],
- 'language/statements/for/const-fresh-binding-per-iteration-for': [PASS,
FAIL_SLOPPY],
- 'language/statements/for/let-fresh-binding-per-iteration-for': [PASS,
FAIL_SLOPPY],
- 'language/statements/let/block-local-closure-get-before-initialization':
[PASS, FAIL_SLOPPY],
+
+ # Functions in blocks are var-declared and hoisted in sloppy mode
+ # https://code.google.com/p/v8/issues/detail?id=3305
+ 'language/block-scope/shadowing/dynamic-lookup-from-closure': [PASS,
FAIL_SLOPPY],
+ 'language/block-scope/shadowing/lookup-from-closure': [PASS,
FAIL_SLOPPY],
+ 'language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration':
[PASS,
FAIL_SLOPPY],
+ 'language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-var':
[PASS,
FAIL_SLOPPY],
+ 'language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-with-function-declaration':
[PASS,
FAIL_SLOPPY],
'language/statements/let/block-local-closure-set-before-initialization':
[PASS, FAIL_SLOPPY],
- 'language/statements/let/block-local-use-before-initialization-in-declaration-statement':
[PASS,
FAIL_SLOPPY],
- 'language/statements/let/block-local-use-before-initialization-in-prior-statement':
[PASS,
FAIL_SLOPPY],
- 'language/statements/let/function-local-closure-get-before-initialization':
[PASS,
FAIL_SLOPPY],
- 'language/statements/let/function-local-closure-set-before-initialization':
[PASS,
FAIL_SLOPPY],
- 'language/statements/let/function-local-use-before-initialization-in-declaration-statement':
[PASS,
FAIL_SLOPPY],
- 'language/statements/let/function-local-use-before-initialization-in-prior-statement':
[PASS,
FAIL_SLOPPY],
- 'language/statements/let/global-closure-get-before-initialization':
[PASS, FAIL_SLOPPY],
- 'language/statements/let/global-closure-set-before-initialization':
[PASS, FAIL_SLOPPY],
- 'language/statements/let/syntax/let': [PASS, FAIL_SLOPPY],
- 'language/statements/let/syntax/let-closure-inside-condition': [PASS,
FAIL_SLOPPY],
- 'language/statements/let/syntax/let-closure-inside-initialization':
[PASS, FAIL_SLOPPY],
- 'language/statements/let/syntax/let-closure-inside-next-expression':
[PASS, FAIL_SLOPPY],
- 'language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding':
[PASS,
FAIL_SLOPPY],
- 'language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding':
[PASS,
FAIL_SLOPPY],
- 'language/statements/let/syntax/let-outer-inner-let-bindings': [PASS,
FAIL_SLOPPY],
- 'language/statements/let/syntax/with-initialisers-in-statement-positions-case-expression-statement-list':
[PASS,
FAIL_SLOPPY],
- 'language/statements/let/syntax/with-initialisers-in-statement-positions-default-statement-list':
[PASS,
FAIL_SLOPPY],
- 'language/statements/let/syntax/without-initialisers-in-statement-positions-case-expression-statement-list':
[PASS,
FAIL_SLOPPY],
- 'language/statements/let/syntax/without-initialisers-in-statement-positions-default-statement-list':
[PASS,
FAIL_SLOPPY],
+
+ # https://code.google.com/p/v8/issues/detail?id=4405
+ 'language/block-scope/leave/outermost-binding-updated-in-catch-block-nested-block-let-declaration-unseen-outside-of-block':
[PASS,
FAIL],
# https://code.google.com/p/v8/issues/detail?id=3305
# This times out in sloppy mode because sloppy const assignment does not
throw.
'language/statements/const/syntax/const-invalid-assignment-next-expression-for':
[PASS,
FAIL, TIMEOUT],
+ # https://code.google.com/p/v8/issues/detail?id=4403
+ 'language/statements/let/syntax/identifier-let-disallowed-as-boundname':
[PASS, FAIL_SLOPPY],
+
# Number/Boolean.prototype is a plain object in ES6
# https://code.google.com/p/v8/issues/detail?id=4001
'built-ins/Boolean/prototype/S15.6.3.1_A1': [FAIL],
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.