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

Issue 943543002: [strong] Declaration-after-use errors. (Closed)

Created:
5 years, 10 months ago by marja
Modified:
5 years, 10 months ago
CC:
v8-dev, adamk
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[strong] Declaration-after-use errors. We cannot yet detect use-before-declaration in general, because for that we'd need to analyze the context when compiling. But we can detect an error case where we first see a use, then a declaration. For this, I also added end position tracking (needed for error messages) to VariableProxy. Note: the position naming is completely inconsistent: start_position & end_position, position & end_position, pos & end_pos, beg_pos & end_pos, to name a few. This doesn't fix all of it, but tries to unify towards start_position & end_position whenever possible w/ minimal changes. BUG= Committed: https://crrev.com/1eddcf5b712c4a3c366a9a011e5b5b61a9f78315 Cr-Commit-Position: refs/heads/master@{#26880}

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : . #

Patch Set 4 : . #

Patch Set 5 : . #

Patch Set 6 : . #

Patch Set 7 : . #

Patch Set 8 : fixe #

Patch Set 9 : rebased #

Patch Set 10 : more fixes + tests #

Total comments: 12

Patch Set 11 : more #

Patch Set 12 : more (classes) #

Patch Set 13 : more #

Patch Set 14 : rebased #

Patch Set 15 : code review #

Patch Set 16 : minimizing diff #

Total comments: 15

Patch Set 17 : code review #

Patch Set 18 : minor cleanup + more tests #

Patch Set 19 : one more test #

Patch Set 20 : pos #

Patch Set 21 : rebased (error handling is split off) #

Total comments: 15

Patch Set 22 : . #

Patch Set 23 : computed prop names comment fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+352 lines, -64 lines) Patch
M src/ast.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +17 lines, -8 lines 0 comments Download
M src/ast.cc View 1 1 chunk +9 lines, -6 lines 0 comments Download
M src/messages.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +1 line, -0 lines 0 comments Download
M src/parser.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +3 lines, -2 lines 0 comments Download
M src/parser.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 18 chunks +50 lines, -29 lines 0 comments Download
M src/preparser.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 8 chunks +17 lines, -12 lines 0 comments Download
M src/scopes.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 6 chunks +18 lines, -3 lines 0 comments Download
M src/scopes.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 5 chunks +47 lines, -3 lines 0 comments Download
M src/variables.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +2 lines, -1 line 0 comments Download
A test/mjsunit/strong/declaration-after-use.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +188 lines, -0 lines 0 comments Download

Messages

Total messages: 28 (9 generated)
marja
rossberg, ptal. adamk, fyi, this conflicts w/ your error handling changes, I can rebase once ...
5 years, 10 months ago (2015-02-20 12:44:46 UTC) #2
marja
Ah, nevermind, this is not working, no need to have a look before I fix ...
5 years, 10 months ago (2015-02-20 13:22:09 UTC) #3
marja
(all fixed now, ptal)
5 years, 10 months ago (2015-02-23 12:37:52 UTC) #4
rossberg
https://codereview.chromium.org/943543002/diff/180001/src/ast.h File src/ast.h (right): https://codereview.chromium.org/943543002/diff/180001/src/ast.h#newcode1658 src/ast.h:1658: VariableProxy(Zone* zone, Variable* var, int start_position, You could pass ...
5 years, 10 months ago (2015-02-23 13:45:26 UTC) #5
arv (Not doing code reviews)
https://codereview.chromium.org/943543002/diff/180001/src/variables.h File src/variables.h (right): https://codereview.chromium.org/943543002/diff/180001/src/variables.h#newcode21 src/variables.h:21: enum Kind { NORMAL, FUNCTION, THIS, NEW_TARGET, ARGUMENTS }; ...
5 years, 10 months ago (2015-02-23 14:45:55 UTC) #7
marja
thanks for having a look https://codereview.chromium.org/943543002/diff/180001/src/ast.h File src/ast.h (right): https://codereview.chromium.org/943543002/diff/180001/src/ast.h#newcode1658 src/ast.h:1658: VariableProxy(Zone* zone, Variable* var, ...
5 years, 10 months ago (2015-02-24 13:29:35 UTC) #9
rossberg
https://codereview.chromium.org/943543002/diff/320001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/943543002/diff/320001/src/parser.cc#newcode1820 src/parser.cc:1820: name, mode, declaration->initialization(), declaration->position(), Hm, I'm confused, why is ...
5 years, 10 months ago (2015-02-24 15:52:40 UTC) #10
marja
https://codereview.chromium.org/943543002/diff/320001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/943543002/diff/320001/src/parser.cc#newcode1820 src/parser.cc:1820: name, mode, declaration->initialization(), declaration->position(), On 2015/02/24 15:52:40, rossberg wrote: ...
5 years, 10 months ago (2015-02-24 18:05:41 UTC) #11
rossberg
lgtm https://codereview.chromium.org/943543002/diff/320001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/943543002/diff/320001/src/parser.cc#newcode2039 src/parser.cc:2039: proxy->var()->set_initializer_position(pos); On 2015/02/24 18:05:40, marja wrote: > On ...
5 years, 10 months ago (2015-02-25 13:17:27 UTC) #12
marja
thanks for review! (arv, more comments?) https://codereview.chromium.org/943543002/diff/320001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/943543002/diff/320001/src/parser.cc#newcode2039 src/parser.cc:2039: proxy->var()->set_initializer_position(pos); On 2015/02/25 ...
5 years, 10 months ago (2015-02-25 13:25:03 UTC) #13
rossberg
https://codereview.chromium.org/943543002/diff/320001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/943543002/diff/320001/src/parser.cc#newcode2039 src/parser.cc:2039: proxy->var()->set_initializer_position(pos); On 2015/02/25 13:25:03, marja wrote: > On 2015/02/25 ...
5 years, 10 months ago (2015-02-25 13:29:08 UTC) #14
marja
Yeah, it makes sense taken into account which references resolve to the "inner" and "outer" ...
5 years, 10 months ago (2015-02-25 13:31:12 UTC) #15
arv (Not doing code reviews)
LGTM My comments can be resolved after this CL lands if you prefer. https://codereview.chromium.org/943543002/diff/420001/src/parser.cc File ...
5 years, 10 months ago (2015-02-25 16:37:32 UTC) #17
arv (Not doing code reviews)
https://codereview.chromium.org/943543002/diff/420001/test/mjsunit/strong/declaration-after-use.js File test/mjsunit/strong/declaration-after-use.js (right): https://codereview.chromium.org/943543002/diff/420001/test/mjsunit/strong/declaration-after-use.js#newcode100 test/mjsunit/strong/declaration-after-use.js:100: "'use strong'; if (false) { let C = class ...
5 years, 10 months ago (2015-02-25 16:49:18 UTC) #18
marja
thanks for review! https://codereview.chromium.org/943543002/diff/420001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/943543002/diff/420001/src/parser.cc#newcode2240 src/parser.cc:2240: DCHECK(var != nullptr); On 2015/02/25 16:37:32, ...
5 years, 10 months ago (2015-02-26 12:55:42 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/943543002/440001
5 years, 10 months ago (2015-02-26 12:58:54 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/943543002/460001
5 years, 10 months ago (2015-02-26 13:26:16 UTC) #26
commit-bot: I haz the power
Committed patchset #23 (id:460001)
5 years, 10 months ago (2015-02-26 13:48:17 UTC) #27
commit-bot: I haz the power
5 years, 10 months ago (2015-02-26 13:48:29 UTC) #28
Message was sent while issue was closed.
Patchset 23 (id:??) landed as
https://crrev.com/1eddcf5b712c4a3c366a9a011e5b5b61a9f78315
Cr-Commit-Position: refs/heads/master@{#26880}

Powered by Google App Engine
This is Rietveld 408576698