MCPcopy Create free account
hub / github.com/babel/babel / parseIfStatement

Function parseIfStatement

packages/babel-parser/src/parser/statement.ts:961–971  ·  view source on GitHub ↗
(this: Parser, node: Undone<N.IfStatement>)

Source from the content-addressed store, hash-verified

959
960 // https://tc39.es/ecma262/#prod-IfStatement
961 parseIfStatement(this: Parser, node: Undone<N.IfStatement>) {
962 this.next();
963 node.test = this.parseHeaderExpression();
964 // Annex B.3.3
965 // https://tc39.es/ecma262/#sec-functiondeclarations-in-ifstatement-statement-clauses
966 node.consequent = this.parseStatementOrSloppyAnnexBFunctionDeclaration();
967 node.alternate = this.eat(tt._else)
968 ? this.parseStatementOrSloppyAnnexBFunctionDeclaration()
969 : null;
970 return this.finishNode(node, "IfStatement");
971 }
972
973 parseReturnStatement(this: Parser, node: Undone<N.ReturnStatement>) {
974 if (!this.prodParam.hasReturn) {

Callers

nothing calls this directly

Calls 2

nextMethod · 0.80
finishNodeMethod · 0.80

Tested by

no test coverage detected