Add position metadata to desugaring
commitb2a0ffc37737c3891513fcfc37d85d3b7c7fb1ce
authorThomas Jiang <thomasjiang@fb.com>
Fri, 23 Oct 2020 19:29:02 +0000 (23 12:29 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 23 Oct 2020 19:33:42 +0000 (23 12:33 -0700)
tree7597cb0d1ad32c6aeb06005995ae502096fa1201
parentdceaa6a00ae3bd1e5075984f6f2c7272ac0f89a2
Add position metadata to desugaring

Summary:
`ExprTreeVisitor`s should be able to access the positional information about the constructs that they are visiting. This is useful for reporting errors and may be useful for caching purposes.

When desugaring, emit a `ExprPos` object containing the starting and ending line and column number.

In the case of a `Pos.none`, we construct a `ExprPos` with 0s.

Reviewed By: Wilfred

Differential Revision: D24481995

fbshipit-source-id: b7af45ec8c1392c23e04d2fed6bfa038ec16b36e
50 files changed:
hphp/hack/src/parser/lowerer/desugar_expression_tree.rs
hphp/hack/test/nast/expression_tree.php.exp [copied from hphp/hack/test/nast/expression_tree_loop.php.exp with 63% similarity]
hphp/hack/test/nast/expression_tree_assign.php.exp
hphp/hack/test/nast/expression_tree_for.php.exp
hphp/hack/test/nast/expression_tree_loop.php.exp
hphp/hack/test/nast/expression_tree_splice.php.exp
hphp/hack/test/typecheck/expression_trees/add.php
hphp/hack/test/typecheck/expression_trees/assign.php
hphp/hack/test/typecheck/expression_trees/boolean_and.php
hphp/hack/test/typecheck/expression_trees/boolean_check.php
hphp/hack/test/typecheck/expression_trees/boolean_or.php
hphp/hack/test/typecheck/expression_trees/bound_variable_lambda.php
hphp/hack/test/typecheck/expression_trees/break.php
hphp/hack/test/typecheck/expression_trees/call.php
hphp/hack/test/typecheck/expression_trees/consecutive_splicing.php
hphp/hack/test/typecheck/expression_trees/continue.php
hphp/hack/test/typecheck/expression_trees/expr_tree_defs.php [copied from hphp/hack/test/typecheck/expression_trees/add.php with 52% similarity]
hphp/hack/test/typecheck/expression_trees/hover_type.php
hphp/hack/test/typecheck/expression_trees/if.php
hphp/hack/test/typecheck/expression_trees/invalid_operator.php
hphp/hack/test/typecheck/expression_trees/invalid_operator.php.exp
hphp/hack/test/typecheck/expression_trees/lambda.php
hphp/hack/test/typecheck/expression_trees/loop.php
hphp/hack/test/typecheck/expression_trees/mismatched_types.php
hphp/hack/test/typecheck/expression_trees/nested_expression_trees.php
hphp/hack/test/typecheck/expression_trees/nested_splicing.php
hphp/hack/test/typecheck/expression_trees/nested_splicing2.php
hphp/hack/test/typecheck/expression_trees/not.php
hphp/hack/test/typecheck/expression_trees/null.php
hphp/hack/test/typecheck/expression_trees/parse_constants.php
hphp/hack/test/typecheck/expression_trees/splice.php
hphp/hack/test/typecheck/expression_trees/splice2.php
hphp/hack/test/typecheck/expression_trees/splice_err1.php
hphp/hack/test/typecheck/expression_trees/splice_err1.php.exp
hphp/hack/test/typecheck/expression_trees/splice_err2.php
hphp/hack/test/typecheck/expression_trees/splice_err3.php
hphp/hack/test/typecheck/expression_trees/splice_err4.php
hphp/hack/test/typecheck/expression_trees/splice_err4.php.exp
hphp/hack/test/typecheck/expression_trees/splice_infer.php
hphp/hack/test/typecheck/expression_trees/splice_state.php
hphp/hack/test/typecheck/expression_trees/splice_state2.php
hphp/hack/test/typecheck/expression_trees/splice_state3.php
hphp/hack/test/typecheck/expression_trees/splice_state4.php
hphp/hack/test/typecheck/expression_trees/splice_variable.php
hphp/hack/test/typecheck/expression_trees/splice_variable2.php
hphp/hack/test/typecheck/expression_trees/splice_variable3.php
hphp/hack/test/typecheck/expression_trees/splice_variable4.php
hphp/hack/test/typecheck/expression_trees/splice_variable_state.php
hphp/hack/test/typecheck/expression_trees/unbound_variables.php
hphp/test/slow/expression_trees/basic.php