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

Issue 2048703002: change most cases of variable redeclaration from TypeError to SyntaxError (Closed)

Created:
4 years, 6 months ago by jwolfe
Modified:
4 years, 6 months ago
Reviewers:
adamk
CC:
v8-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

change most cases of variable redeclaration from TypeError to SyntaxError. Code like `let a; eval("var a;");` should throw a SyntaxError, not a TypeError (this caused a test262 failure.). However, the code `eval("function NaN() {}");` should actually throw a TypeError. This patch changes most cases of redeclaration errors from TypeError to SyntaxError. See the test mjsunit/regress/redeclaration-error-types for a thorough analysis with spec references. The relevant sections of the spec are ES#sec-globaldeclarationinstantiation and ES#sec-evaldeclarationinstantiation BUG=v8:4955 LOG=y Committed: https://crrev.com/2b787561763d0f7e8dab698652715a742cf78291 Cr-Commit-Position: refs/heads/master@{#36940}

Patch Set 1 #

Total comments: 11

Patch Set 2 : typo #

Patch Set 3 : add example comment to get formatting review #

Patch Set 4 : incorporating comments into code #

Total comments: 7

Patch Set 5 : add missing comment #

Patch Set 6 : rename RedeclarationError #

Patch Set 7 : rebase #

Total comments: 2

Patch Set 8 : add tests #

Patch Set 9 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+204 lines, -26 lines) Patch
M src/runtime/runtime-scopes.cc View 1 2 3 4 5 6 7 8 8 chunks +53 lines, -15 lines 0 comments Download
M test/mjsunit/es6/block-eval-var-over-let.js View 4 chunks +6 lines, -6 lines 0 comments Download
A test/mjsunit/regress/redeclaration-error-types.js View 1 2 3 4 5 6 7 1 chunk +145 lines, -0 lines 0 comments Download
M test/test262/test262.status View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -5 lines 0 comments Download

Messages

Total messages: 28 (9 generated)
jwolfe
Note, there is actually a bug in my code here. I intend to redo this ...
4 years, 6 months ago (2016-06-07 17:42:02 UTC) #1
jwolfe
4 years, 6 months ago (2016-06-08 01:29:03 UTC) #4
adamk
Is this ready for review?
4 years, 6 months ago (2016-06-09 07:53:40 UTC) #5
jwolfe
> Is this ready for review? Yes. Sorry, I left that unclear in a previous ...
4 years, 6 months ago (2016-06-09 08:15:38 UTC) #6
adamk
Please flesh out the CL description. https://codereview.chromium.org/2048703002/diff/60001/src/runtime/runtime-scopes.cc File src/runtime/runtime-scopes.cc (right): https://codereview.chromium.org/2048703002/diff/60001/src/runtime/runtime-scopes.cc#newcode19 src/runtime/runtime-scopes.cc:19: struct RedeclarationError { ...
4 years, 6 months ago (2016-06-09 15:08:42 UTC) #7
adamk
Regarding the dead is_const branches, I've sent out a CL to remove them: https://codereview.chromium.org/2051073004/
4 years, 6 months ago (2016-06-09 15:37:31 UTC) #8
jwolfe
https://codereview.chromium.org/2048703002/diff/60001/src/runtime/runtime-scopes.cc File src/runtime/runtime-scopes.cc (right): https://codereview.chromium.org/2048703002/diff/60001/src/runtime/runtime-scopes.cc#newcode261 src/runtime/runtime-scopes.cc:261: return ThrowRedeclarationError(isolate, name, On 2016/06/09 15:08:42, adamk wrote: > ...
4 years, 6 months ago (2016-06-09 17:05:23 UTC) #10
adamk
Please add a new test file and move the test cases there instead of putting ...
4 years, 6 months ago (2016-06-10 06:52:10 UTC) #11
adamk
Oh, and if you merge to trunk there shouldn't be any dead code left (if ...
4 years, 6 months ago (2016-06-10 06:52:45 UTC) #12
jwolfe
i still need to add tests. https://codereview.chromium.org/2048703002/diff/120001/src/runtime/runtime-scopes.cc File src/runtime/runtime-scopes.cc (right): https://codereview.chromium.org/2048703002/diff/120001/src/runtime/runtime-scopes.cc#newcode286 src/runtime/runtime-scopes.cc:286: RedeclarationType::kSyntaxError); this branch ...
4 years, 6 months ago (2016-06-10 20:36:06 UTC) #13
jwolfe
There is still some dead code in this patch. See my comment on Patch Set ...
4 years, 6 months ago (2016-06-12 20:38:57 UTC) #15
jwolfe
4 years, 6 months ago (2016-06-12 20:39:05 UTC) #16
adamk
Thanks for the test, I like the generality, makes it easy to read. One more ...
4 years, 6 months ago (2016-06-13 12:44:27 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2048703002/140001
4 years, 6 months ago (2016-06-13 17:45:14 UTC) #20
commit-bot: I haz the power
Committed patchset #8 (id:140001)
4 years, 6 months ago (2016-06-13 18:11:05 UTC) #22
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/2b787561763d0f7e8dab698652715a742cf78291 Cr-Commit-Position: refs/heads/master@{#36940}
4 years, 6 months ago (2016-06-13 18:14:52 UTC) #24
Dan Ehrenberg
A revert of this CL (patchset #8 id:140001) has been created in https://codereview.chromium.org/2064793002/ by littledan@chromium.org. ...
4 years, 6 months ago (2016-06-13 18:21:40 UTC) #25
jwolfe
reopening to append a rebase patch, then retry once https://codereview.chromium.org/2084963002 lands in chromium.
4 years, 6 months ago (2016-06-21 18:01:56 UTC) #27
jwolfe
4 years, 6 months ago (2016-06-21 18:28:35 UTC) #28
Message was sent while issue was closed.
never mind. i'll make a re-land CL.

Powered by Google App Engine
This is Rietveld 408576698