| 935 | |
| 936 | // https://tc39.es/ecma262/#prod-HoistableDeclaration |
| 937 | parseFunctionStatement( |
| 938 | this: Parser, |
| 939 | node: Undone<N.FunctionDeclaration>, |
| 940 | isAsync: boolean, |
| 941 | statementFlags: ParseStatementFlag, |
| 942 | ): N.FunctionDeclaration { |
| 943 | this.next(); // eat 'function' |
| 944 | let flags = |
| 945 | ParseFunctionFlag.Declaration | (isAsync ? ParseFunctionFlag.Async : 0); |
| 946 | if ( |
| 947 | !(statementFlags & ParseStatementFlag.AllowDeclaration) && |
| 948 | statementFlags & ParseStatementFlag.AllowFunctionDeclaration |
| 949 | ) { |
| 950 | flags |= ParseFunctionFlag.SingleStatement; |
| 951 | // Annex B.3.1: unlike functions in if statement clauses (B.3.3), |
| 952 | // labelled function declarations are bound in the enclosing scope. |
| 953 | if (!(statementFlags & ParseStatementFlag.AllowLabeledFunction)) { |
| 954 | flags |= ParseFunctionFlag.HangingDeclaration; |
| 955 | } |
| 956 | } |
| 957 | return this.parseFunction(node, flags); |
| 958 | } |
| 959 | |
| 960 | // https://tc39.es/ecma262/#prod-IfStatement |
| 961 | parseIfStatement(this: Parser, node: Undone<N.IfStatement>) { |