提交 35afa309 编写于 作者: P Petr Onderka 提交者: Andy Gocke

Improved the grammar of local functions (#20368)

上级 87276b7f
...@@ -12,28 +12,29 @@ Syntax Grammar ...@@ -12,28 +12,29 @@ Syntax Grammar
This grammar is represented as a diff from the current spec grammar. This grammar is represented as a diff from the current spec grammar.
```diff ```diff
declaration-statement declaration_statement
: local-variable-declaration ';' : local_variable_declaration ';'
| local-constant-declaration ';' | local_constant_declaration ';'
+ | local-function-declaration + | local_function_declaration
; ;
+local-function-declaration +local_function_declaration
+ : local-function-header local-function-body + : local_function_header local_function_body
+ ; + ;
+local-function-header +local_function_header
+ : local-function-modifiers? return-type identifier type-parameter-list? + : local_function_modifier* return_type identifier type_parameter_list?
+ ( formal-parameter-list? ) type-parameter-constraints-clauses + '(' formal_parameter_list? ')' type_parameter_constraints_clauses
+ ; + ;
+local-function-modifiers +local_function_modifier
+ : (async | unsafe) + : 'async'
+ | 'unsafe'
+ ; + ;
+local-function-body +local_function_body
+ : block + : block
+ | arrow-expression-body + | arrow_expression_body
+ ; + ;
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册