[strong] Declaration-after-use errors.
authormarja <marja@chromium.org>
Thu, 26 Feb 2015 13:48:10 +0000 (05:48 -0800)
committerCommit bot <commit-bot@chromium.org>
Thu, 26 Feb 2015 13:48:19 +0000 (13:48 +0000)
commit1eddcf5b712c4a3c366a9a011e5b5b61a9f78315
tree386a9fda0466ce906c899a91872ea47b1b4d1903
parent77d3ae0e119893ac8d34ea6ca090cddd5bbf987e
[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=

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

Cr-Commit-Position: refs/heads/master@{#26880}
src/ast.cc
src/ast.h
src/messages.js
src/parser.cc
src/parser.h
src/preparser.h
src/scopes.cc
src/scopes.h
src/variables.h
test/mjsunit/strong/declaration-after-use.js [new file with mode: 0644]