Fix infinite loop in parsing local functions (#13010)
The original intent of #12056 was to improve parsing recovery in the cast of a leading accessibility modifier on a local function. However, I mistakenly allowed for recovery for an accessibility modifier *anywhere* in the modifier list of the local function. This is a mistake because it significantly complicates parsing back-out. While it's easy to recognize that the local function parsing failed and skip any leading accessibility modifiers, it's significantly more complicated to find and skip all accessibility modifiers anywhere in a sequence of modifiers. This PR changes the parsing backout to only consider accessibility modifiers at the start of statements. Any other case will be treated like other bad modifiers in local functions -- they will be marked as errors in the declaration list. Fixes #12947.
Showing
想要评论请 注册 或 登录