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 a Location instead of the individual values.
https://codereview.chromium.org/943543002/diff/180001/src/parser.cc
File src/parser.cc (right):
https://codereview.chromium.org/943543002/diff/180001/src/parser.cc#newcode3753
src/parser.cc:3753: Variable::FUNCTION, kCreatedInitialized,
kNotAssigned);
Note that this is not a function declaration, but a local binding that
is always initialised immediately. I don't think it requires special
treatment as a function.
https://codereview.chromium.org/943543002/diff/180001/src/scopes.cc
File src/scopes.cc (right):
https://codereview.chromium.org/943543002/diff/180001/src/scopes.cc#newcode1078
src/scopes.cc:1078: // they are inside the same eval scope or different
ones.
Can you add a TODO regarding different evals? I suppose each direct eval
scope somehow would need to know its call position in the outer program
text... Hm, tricky... I think we want to disallow direct eval in strong
mode anyway, but that still leaves toplevel bindings.
https://codereview.chromium.org/943543002/diff/180001/src/scopes.cc#newcode1084
src/scopes.cc:1084: proxy->position() < var->position() &&
!var->is_function() &&
I don't believe this is good enough. Consider:
let x = x+1
Here, proxy->pos > var->pos, but it's an error nonetheless.
We already have var->initializer_position, which marks the position
where a var is known to be bound (and is used by codegen to eliminate
unnecessary hole checks for lexical bindings, see e.g.
full-codegen-ia32.cc:1474). In the above case that would point at the
_end_ of the binding's RHS (but before the next binding, if there are
multiple comma-separated ones).
However, you probably need to set that position properly for a couple
more declaration forms now (previously it only mattered for lexical
ones). Also, I just saw that it seems wrong in ParseClassDeclaration.
https://codereview.chromium.org/943543002/diff/180001/test/mjsunit/strong/declaration-after-use.js
File test/mjsunit/strong/declaration-after-use.js (right):
https://codereview.chromium.org/943543002/diff/180001/test/mjsunit/strong/declaration-after-use.js#newcode7
test/mjsunit/strong/declaration-after-use.js:7: (function
DeclarationAfterUse() {
More tests would be great, both positive and negative. In particular:
- different combinations of multi-bindings with uses on the RHS
- class declarations referring to themselves in different parts
- for loops
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.