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

Issue 1318023004: Do not permit binding over catch parameters in for-of (Closed)

Created:
5 years, 3 months ago by Eric Caruso
Modified:
4 years, 4 months ago
Reviewers:
Dan Ehrenberg, rossberg
CC:
v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Do not permit binding over catch parameters in for-of This is banned by the ES6 spec (see sections 13.15.1 and B.3.5). When done inside an eval, throw a runtime SyntaxError. We should get an early SyntaxError otherwise. R=littledan@chromium.org LOG=N BUG=v8:4231

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+49 lines, -13 lines) Patch
M src/parser.h View 1 chunk +5 lines, -0 lines 0 comments Download
M src/parser.cc View 3 chunks +19 lines, -2 lines 0 comments Download
A + test/mjsunit/es6/try-catch-for-of.js View 1 chunk +25 lines, -11 lines 0 comments Download

Messages

Total messages: 3 (1 generated)
rossberg
Hm, I don't quite understand this CL. It seems to special-case for-loops, but there are ...
5 years, 3 months ago (2015-09-03 00:10:29 UTC) #2
Eric Caruso
5 years, 3 months ago (2015-09-03 00:31:20 UTC) #3
On 2015/09/03 00:10:29, rossberg wrote:
> Hm, I don't quite understand this CL. It seems to special-case for-loops, but
> there are many other constructs that could introduce conflicting bindings.
> Shouldn't these conflicts be detected in a more central place? Specifically, I
> think you want to invoke something similar to the existing
> CheckConflictingDeclarations in the function that parses the `catch` phrase.

We will also have to deal with let-/const-bindings, but the for-of case is
particularly awkward because B.3.5 specifies that var-/for-/for-in-bindings
are fine.

I wasn't sure if there was a better way to make sure for-of acts correctly given
those constraints.

Powered by Google App Engine
This is Rietveld 408576698