(node *ast.Node)
| 2783 | } |
| 2784 | |
| 2785 | func (c *Checker) checkMethodDeclaration(node *ast.Node) { |
| 2786 | // Grammar checking |
| 2787 | if !c.checkGrammarMethod(node) { |
| 2788 | c.checkGrammarComputedPropertyName(node.Name()) |
| 2789 | if ast.IsMethodDeclaration(node) && node.AsMethodDeclaration().AsteriskToken != nil && ast.IsIdentifier(node.Name()) && node.Name().Text() == "constructor" { |
| 2790 | c.error(node.Name(), diagnostics.Class_constructor_may_not_be_a_generator) |
| 2791 | } |
| 2792 | } |
| 2793 | // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration |
| 2794 | c.checkFunctionOrMethodDeclaration(node) |
| 2795 | // method signatures already report "implementation not allowed in ambient context" elsewhere |
| 2796 | if ast.HasSyntacticModifier(node, ast.ModifierFlagsAbstract) && ast.IsMethodDeclaration(node) && node.Body() != nil { |
| 2797 | c.error(node, diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, scanner.DeclarationNameToString(node.Name())) |
| 2798 | } |
| 2799 | // Private named methods are only allowed in class declarations |
| 2800 | if ast.IsPrivateIdentifier(node.Name()) && ast.GetContainingClass(node) == nil { |
| 2801 | c.error(node, diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies) |
| 2802 | } |
| 2803 | c.setNodeLinksForPrivateIdentifierScope(node) |
| 2804 | } |
| 2805 | |
| 2806 | func (c *Checker) checkClassStaticBlockDeclaration(node *ast.Node) { |
| 2807 | // Grammar checking |
no test coverage detected