mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
[python] Fix NPE in PyAstAsPattern
(cherry picked from commit d8f319769d8fd25c27e6ab75b05d94d56a9751b9) IJ-CR-172556 GitOrigin-RevId: c0c921a2ef363c9e3b33a21869cc290896372ab6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
adcc559e5c
commit
31dcf9f6d5
@@ -8,8 +8,8 @@ interface PyAstAsPattern : PyAstPattern {
|
||||
return requireNotNull(findChildByClass(PyAstPattern::class.java)) { "${this}: pattern cannot be null" }
|
||||
}
|
||||
|
||||
fun getTarget(): PyAstTargetExpression {
|
||||
return requireNotNull(findChildByClass(PyAstTargetExpression::class.java)) { "${this}: target cannot be null" }
|
||||
fun getTarget(): PyAstTargetExpression? {
|
||||
return findChildByClass(PyAstTargetExpression::class.java)
|
||||
}
|
||||
|
||||
override fun isIrrefutable(): Boolean {
|
||||
|
||||
@@ -457,7 +457,9 @@ public class PyControlFlowBuilder extends PyRecursiveElementVisitor {
|
||||
// So no need to create an additional fail edge
|
||||
myBuilder.startNode(node);
|
||||
node.acceptChildren(this);
|
||||
myPatternBindingNames.add(node.getTarget().getName());
|
||||
if (node.getTarget() != null) {
|
||||
myPatternBindingNames.add(node.getTarget().getName());
|
||||
}
|
||||
myBuilder.updatePendingElementScope(node, node.getParent());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user