(hasSeenStaticModifier bool, permitConstAsModifier bool, stopOnStartOfClassStaticBlock bool)
| 3923 | } |
| 3924 | |
| 3925 | func (p *Parser) tryParseModifier(hasSeenStaticModifier bool, permitConstAsModifier bool, stopOnStartOfClassStaticBlock bool) *ast.Node { |
| 3926 | pos := p.nodePos() |
| 3927 | kind := p.token |
| 3928 | if p.token == ast.KindConstKeyword && permitConstAsModifier { |
| 3929 | // We need to ensure that any subsequent modifiers appear on the same line |
| 3930 | // so that when 'const' is a standalone declaration, we don't issue an error. |
| 3931 | if !p.lookAhead((*Parser).nextTokenIsOnSameLineAndCanFollowModifier) { |
| 3932 | return nil |
| 3933 | } else { |
| 3934 | p.nextToken() |
| 3935 | } |
| 3936 | } else if stopOnStartOfClassStaticBlock && p.token == ast.KindStaticKeyword && p.lookAhead((*Parser).nextTokenIsOpenBrace) { |
| 3937 | return nil |
| 3938 | } else if hasSeenStaticModifier && p.token == ast.KindStaticKeyword { |
| 3939 | return nil |
| 3940 | } else { |
| 3941 | if !p.parseAnyContextualModifier() { |
| 3942 | return nil |
| 3943 | } |
| 3944 | } |
| 3945 | return p.finishNode(p.factory.NewModifier(kind), pos) |
| 3946 | } |
| 3947 | |
| 3948 | func (p *Parser) parseContextualModifier(t ast.Kind) bool { |
| 3949 | state := p.mark() |
no test coverage detected