@@ -648,11 +648,11 @@ module PatternTrees {
648648
649649 abstract class PostOrderPatTree extends StandardPatTree , StandardPostOrderTree { }
650650
651- class IdentPatTree extends StandardPostOrderTree , IdentPat {
652- override AstNode getChildNode ( int i ) {
653- i = 0 and result = this .getPat ( )
651+ class IdentPatTree extends PostOrderTree , IdentPat {
652+ override predicate first ( AstNode node ) {
653+ first ( this .getPat ( ) , node )
654654 or
655- i = 1 and result = this .getName ( )
655+ not this . hasPat ( ) and node = this .getName ( )
656656 }
657657
658658 override predicate last ( AstNode node , Completion c ) {
@@ -663,11 +663,15 @@ module PatternTrees {
663663
664664 override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
665665 // Edge from successful subpattern to name
666- super .succ ( pred , succ , c ) and c .( MatchCompletion ) .succeeded ( )
666+ last ( this .getPat ( ) , pred , c ) and
667+ first ( this .getName ( ) , succ ) and
668+ c .( MatchCompletion ) .succeeded ( )
667669 or
668670 // Edge from name to the identifier pattern itself
669671 last ( this .getName ( ) , pred , c ) and succ = this and completionIsNormal ( c )
670672 }
673+
674+ override predicate propagatesAbnormal ( AstNode child ) { child = this .getPat ( ) }
671675 }
672676
673677 class BoxPatTree extends PreOrderPatTree , BoxPat {
0 commit comments