From d40891697b05aa2c196e6a2d9c870eecfbe4f54d Mon Sep 17 00:00:00 2001 From: Ivan Posti Date: Thu, 3 Feb 2022 12:38:13 +0300 Subject: [PATCH] [Markdown][IDEA-281376] Use null aware getters for element type Also fixes EA-392668 GitOrigin-RevId: 40297fbbfb13d04c4ff0a16f1fef394f8f5ac5a1 --- .../src/org/intellij/plugins/markdown/util/PsiUtils.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/util/PsiUtils.kt b/plugins/markdown/core/src/org/intellij/plugins/markdown/util/PsiUtils.kt index de326df4645e..55d8534cf962 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/util/PsiUtils.kt +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/util/PsiUtils.kt @@ -5,9 +5,10 @@ import com.intellij.lang.ASTNode import com.intellij.psi.PsiElement import com.intellij.psi.tree.IElementType import com.intellij.psi.tree.TokenSet +import com.intellij.psi.util.PsiUtilCore -internal fun PsiElement.hasType(type: IElementType) = node.elementType == type -internal fun PsiElement.hasType(type: TokenSet) = node.elementType in type +internal fun PsiElement.hasType(type: IElementType) = PsiUtilCore.getElementType(this) == type +internal fun PsiElement.hasType(type: TokenSet) = PsiUtilCore.getElementType(this) in type -internal fun ASTNode.hasType(type: IElementType) = elementType == type -internal fun ASTNode.hasType(type: TokenSet) = elementType in type +internal fun ASTNode.hasType(type: IElementType) = PsiUtilCore.getElementType(this) == type +internal fun ASTNode.hasType(type: TokenSet) = PsiUtilCore.getElementType(this) in type