1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-09 16:32:39 +01:00

Fix improper XHPAST parsing of namespace grammar like "use x as private;"

Summary:
Depends on D21067. Ref T13492. Converting unit tests to be readable exposed this error in the grammar.

Normally, "grammar_rule" rules emit a standalone Node. In this case, the bottom-level grammar rule is a collection of trivial rules and the callers configure the Node. Wrap the bottom-level rule in a configuration rule so the node is configured correctly and consistently, in exactly one place.

Test Plan: Ran unit tests.

Maniphest Tasks: T13492

Differential Revision: https://secure.phabricator.com/D21068
This commit is contained in:
epriestley 2020-04-07 12:43:06 -07:00
parent e03431def8
commit a1ee2ab931
4 changed files with 1838 additions and 1831 deletions

View file

@ -205,7 +205,7 @@ pass
> " " > " "
> as > as
> " " > " "
* "<INVALID TYPE \"0\">" * n_STRING
> protected > protected
* n_EMPTY * n_EMPTY
> " " > " "

View file

@ -8,7 +8,7 @@ final class PhutilXHPASTBinary extends Phobject {
* This is the version that would be obtained with an up-to-date XHPAST * This is the version that would be obtained with an up-to-date XHPAST
* build. The //actual// XHPAST build version may vary. * build. The //actual// XHPAST build version may vary.
*/ */
const EXPECTED_VERSION = '7.1.5'; const EXPECTED_VERSION = '7.1.6';
/** /**
* The XHPAST build version. * The XHPAST build version.

View file

@ -1335,7 +1335,7 @@ trait_modifiers:
} }
| member_modifier { | member_modifier {
$$ = NNEW(n_METHOD_MODIFIER_LIST); $$ = NNEW(n_METHOD_MODIFIER_LIST);
$$->appendChild(NTYPE($1, n_STRING)); $$->appendChild($1);
} }
; ;
@ -1370,14 +1370,20 @@ method_modifiers:
non_empty_member_modifiers: non_empty_member_modifiers:
member_modifier { member_modifier {
$$ = NNEW(n_CLASS_MEMBER_MODIFIER_LIST); $$ = NNEW(n_CLASS_MEMBER_MODIFIER_LIST);
$$->appendChild(NTYPE($1, n_STRING)); $$->appendChild($1);
} }
| non_empty_member_modifiers member_modifier { | non_empty_member_modifiers member_modifier {
$$ = $1->appendChild(NTYPE($2, n_STRING)); $$ = $1->appendChild($2);
} }
; ;
member_modifier: member_modifier:
basic_member_modifier {
$$ = NTYPE($1, n_STRING);
}
;
basic_member_modifier:
T_PUBLIC T_PUBLIC
| T_PROTECTED | T_PROTECTED
| T_PRIVATE | T_PRIVATE

File diff suppressed because it is too large Load diff