static anonymous functions
commit81f6ae525560a71dcd73ae5e729de7200e703bab
authorVladimir Matveev <vladima@fb.com>
Thu, 6 Jul 2017 20:04:10 +0000 (6 13:04 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 6 Jul 2017 20:14:14 +0000 (6 13:14 -0700)
tree00d09bb516292b1d11b4b6e10b56d030fe545315
parent66889e133e4d008d2710ca814d1afff3f7c4a56e
static anonymous functions

Summary:
This diff adds parsing for static anonymous functions.

HHVM behavior is pretty loose when parsing modifier lists: it does not check that modifier is already present in the list or enforce any particular order of modifiers i.e. this code is accepted

```lang=php
<?hh

class A {
    function f() {
        $a = static static static static static static async async function () { $a = 1; };
    }
}
```

I was not able to find any docs that will state that multiple appearance of modififers is intentional so it is not supported in this diff. Also [[https://docs.hhvm.com/hack/async/blocks|this page]] states:
>In async functions declared with the function keyword, async immediately precedes function, which in turn immediately precedes the arguments.

Current diff follows behavior mentioned above and assumes that order of modifiers should be `static` `async`.

Reviewed By: oulgen

Differential Revision: D5372690

fbshipit-source-id: 082539ac5ccd7dc3c382940c17e6c1ec3970e55c
hphp/hack/src/hackfmt/hack_format.ml
hphp/hack/src/parser/full_fidelity_expression_parser.ml
hphp/hack/src/parser/full_fidelity_positioned_syntax.ml
hphp/hack/src/parser/full_fidelity_pretty_printer.ml
hphp/hack/src/parser/full_fidelity_syntax.ml
hphp/hack/src/parser/full_fidelity_syntax_type.ml
hphp/hack/src/parser/js/full_fidelity_editable.js
hphp/hack/src/parser/js/full_fidelity_schema.json
hphp/hack/src/parser/php/full_fidelity_editable.php
hphp/hack/src/parser/schema/full_fidelity_schema.ml
hphp/hack/src/parser/schema/schema_definition.ml