(node *ast.Node, list *ast.NodeList)
| 871 | } |
| 872 | |
| 873 | func (p *Printer) shouldAllowTrailingComma(node *ast.Node, list *ast.NodeList) bool { |
| 874 | if p.currentSourceFile == nil || p.currentSourceFile.ScriptKind == core.ScriptKindJSON { |
| 875 | return false |
| 876 | } |
| 877 | |
| 878 | switch node.Kind { |
| 879 | case ast.KindObjectLiteralExpression: |
| 880 | return true |
| 881 | case ast.KindArrayLiteralExpression, |
| 882 | ast.KindArrowFunction, |
| 883 | ast.KindConstructor, |
| 884 | ast.KindGetAccessor, |
| 885 | ast.KindSetAccessor, |
| 886 | ast.KindTypeAliasDeclaration, |
| 887 | ast.KindJSTypeAliasDeclaration, |
| 888 | ast.KindFunctionType, |
| 889 | ast.KindConstructorType, |
| 890 | ast.KindCallSignature, |
| 891 | ast.KindConstructSignature, |
| 892 | ast.KindTaggedTemplateExpression, |
| 893 | ast.KindObjectBindingPattern, |
| 894 | ast.KindArrayBindingPattern, |
| 895 | ast.KindNamedImports, |
| 896 | ast.KindNamedExports, |
| 897 | ast.KindImportAttributes: |
| 898 | return true |
| 899 | case ast.KindClassExpression, |
| 900 | ast.KindClassDeclaration, |
| 901 | ast.KindInterfaceDeclaration: |
| 902 | return list == node.TypeParameterList() |
| 903 | case ast.KindFunctionDeclaration, |
| 904 | ast.KindFunctionExpression, |
| 905 | ast.KindMethodDeclaration: |
| 906 | return true |
| 907 | case ast.KindCallExpression: |
| 908 | return true |
| 909 | case ast.KindNewExpression: |
| 910 | return true |
| 911 | } |
| 912 | |
| 913 | return false |
| 914 | } |
| 915 | |
| 916 | // |
| 917 | // Tokens/Keywords |
no test coverage detected