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:
Hm, I'm confused, why is this the right init position?

Argh, this was only working because the position is fixed later w/
set_initializer_position. The only case where this position actually got
used (was not overwritten) was for "var", and for those, there were
(are?) no test cases where the difference would matter. (Like, var x = x
+ 1; is ok and we don't allow those in strong mode anyway.)

So I removed transmitting the declaration position altogether and made
var variables also have their initializer positions set. This is needed
so that we can make this an error: function foo() {"use strong"; x; }
var x = 0;

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 15:52:40, rossberg wrote:
I'm surprised that this isn't a problem, since 'pos' doesn't seem to
point at
the right position.

This isn't the problem for the

class C extends C { }

case, because the relevant declaration is done by ParseClassLiteral, not
this function. (Both ParseClassDeclaration and ParseClassLiteral declare
C, but the stuff inside the class resolves to what ParseClassLiteral
declared.)

IOW, I didn't see a place where this position set here would matter, so
I didn't change it.

https://codereview.chromium.org/943543002/diff/320001/test/mjsunit/strong/declaration-after-use.js
File test/mjsunit/strong/declaration-after-use.js (right):

https://codereview.chromium.org/943543002/diff/320001/test/mjsunit/strong/declaration-after-use.js#newcode68
test/mjsunit/strong/declaration-after-use.js:68: "'use strong'; if
(false) { for (let x = x; ; ) { } }",
On 2015/02/24 15:52:40, rossberg wrote:
Perhaps add

   for (let x = y, y; ;) {}

Done.

https://codereview.chromium.org/943543002/diff/320001/test/mjsunit/strong/declaration-after-use.js#newcode77
test/mjsunit/strong/declaration-after-use.js:77:
assertThrowsHelper("'use strong'; if (false) { class C extends C { } }",
On 2015/02/24 15:52:40, rossberg wrote:
Also add versions for class expressions:

   let C = class C2 extends C2 {}
   let C = class extends C {}

Also, with --harmony-computed-property-names, the following ones
become
relevant:

   class C { [C]() {} }
   class C { get [C]() {} }
   class C { set [C]() {} }
   class C { static [C]() {} }

Added the first 2 cases and a TODO for computed property names
(difficult!).

https://codereview.chromium.org/943543002/diff/320001/test/mjsunit/strong/declaration-after-use.js#newcode98
test/mjsunit/strong/declaration-after-use.js:98: for (let var4a = 0,
var4b = 0; var4a + var4b < 4; var4a++, var4b++) {
On 2015/02/24 15:52:40, rossberg wrote:
Change to

   var4b = var4a

Done.

https://codereview.chromium.org/943543002/diff/320001/test/mjsunit/strong/declaration-after-use.js#newcode142
test/mjsunit/strong/declaration-after-use.js:142: class C {
constructor() { C; } };
On 2015/02/24 15:52:40, rossberg wrote:
Add a

   new C

after.

Done.

https://codereview.chromium.org/943543002/

--
--
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.

Reply via email to