In an ambient declaration, the grammar only allows integer literals as initializers. In a non-ambient declaration, the grammar allows uninitialized members only in a ConstantEnumMemberSection, which starts at the beginning of an enum declaration or any time an integer literal initializer is encounte
()
| 2124 | // ConstantEnumMemberSection, which starts at the beginning of an enum declaration |
| 2125 | // or any time an integer literal initializer is encountered. |
| 2126 | func (p *Parser) parseEnumMember() *ast.Node { |
| 2127 | pos := p.nodePos() |
| 2128 | jsdoc := p.jsdocScannerInfo() |
| 2129 | name := p.parsePropertyName() |
| 2130 | initializer := doInContext(p, ast.NodeFlagsDisallowInContext, false, (*Parser).parseInitializer) |
| 2131 | result := p.finishNode(p.factory.NewEnumMember(name, initializer), pos) |
| 2132 | p.withJSDoc(result, jsdoc) |
| 2133 | return result |
| 2134 | } |
| 2135 | |
| 2136 | func (p *Parser) parseEnumDeclaration(pos int, jsdoc jsdocScannerInfo, modifiers *ast.ModifierList) *ast.Node { |
| 2137 | saveHasAwaitIdentifier := p.statementHasAwaitIdentifier |
nothing calls this directly
no test coverage detected