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

Improved the grammar of local functions (#20368)

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