(node *Node)
| 1962 | } |
| 1963 | |
| 1964 | func IsInExpressionContext(node *Node) bool { |
| 1965 | parent := node.Parent |
| 1966 | switch parent.Kind { |
| 1967 | case KindVariableDeclaration, KindParameter, KindPropertyDeclaration, KindPropertySignature, KindEnumMember, KindPropertyAssignment, KindBindingElement: |
| 1968 | return parent.Initializer() == node |
| 1969 | case KindExpressionStatement, KindIfStatement, KindDoStatement, KindWhileStatement, KindReturnStatement, KindWithStatement, KindSwitchStatement, |
| 1970 | KindCaseClause, KindDefaultClause, KindThrowStatement, KindTypeAssertionExpression, KindAsExpression, KindTemplateSpan, KindComputedPropertyName, |
| 1971 | KindSatisfiesExpression: |
| 1972 | return parent.Expression() == node |
| 1973 | case KindForStatement: |
| 1974 | s := parent.AsForStatement() |
| 1975 | return s.Initializer == node && s.Initializer.Kind != KindVariableDeclarationList || s.Condition == node || s.Incrementor == node |
| 1976 | case KindForInStatement, KindForOfStatement: |
| 1977 | s := parent.AsForInOrOfStatement() |
| 1978 | return s.Initializer == node && s.Initializer.Kind != KindVariableDeclarationList || s.Expression == node |
| 1979 | case KindDecorator, KindJsxExpression, KindJsxSpreadAttribute, KindSpreadAssignment: |
| 1980 | return true |
| 1981 | case KindExpressionWithTypeArguments: |
| 1982 | return parent.Expression() == node && !IsPartOfTypeNode(parent) |
| 1983 | case KindShorthandPropertyAssignment: |
| 1984 | return parent.AsShorthandPropertyAssignment().ObjectAssignmentInitializer == node |
| 1985 | default: |
| 1986 | return IsExpressionNode(parent) |
| 1987 | } |
| 1988 | } |
| 1989 | |
| 1990 | func IsPartOfTypeNode(node *Node) bool { |
| 1991 | kind := node.Kind |
no test coverage detected