@@ -119,18 +119,18 @@ class EmptyPositiveSubPatttern extends RegExpSubPattern {
119119 * whose root node is not a disjunction.
120120 */
121121class RegExpRoot extends RegExpTerm {
122- RegExpParent parent ;
123-
124122 RegExpRoot ( ) {
125- exists ( RegExpAlt alt |
126- alt .isRootTerm ( ) and
127- this = alt .getAChild ( ) and
128- parent = alt .getParent ( )
123+ exists ( RegExpParent parent |
124+ exists ( RegExpAlt alt |
125+ alt .isRootTerm ( ) and
126+ this = alt .getAChild ( ) and
127+ parent = alt .getParent ( )
128+ )
129+ or
130+ this .isRootTerm ( ) and
131+ not this instanceof RegExpAlt and
132+ parent = this .getParent ( )
129133 )
130- or
131- this .isRootTerm ( ) and
132- not this instanceof RegExpAlt and
133- parent = this .getParent ( )
134134 }
135135
136136 /**
@@ -466,13 +466,14 @@ private module CharacterClasses {
466466 * An implementation of `CharacterClass` for \d, \s, and \w.
467467 */
468468 private class PositiveCharacterClassEscape extends CharacterClass {
469- RegExpTerm cc ;
470469 string charClass ;
471470
472471 PositiveCharacterClassEscape ( ) {
473- isEscapeClass ( cc , charClass ) and
474- this = getCanonicalCharClass ( cc ) and
475- charClass = [ "d" , "s" , "w" ]
472+ exists ( RegExpTerm cc |
473+ isEscapeClass ( cc , charClass ) and
474+ this = getCanonicalCharClass ( cc ) and
475+ charClass = [ "d" , "s" , "w" ]
476+ )
476477 }
477478
478479 override string getARelevantChar ( ) {
@@ -504,13 +505,14 @@ private module CharacterClasses {
504505 * An implementation of `CharacterClass` for \D, \S, and \W.
505506 */
506507 private class NegativeCharacterClassEscape extends CharacterClass {
507- RegExpTerm cc ;
508508 string charClass ;
509509
510510 NegativeCharacterClassEscape ( ) {
511- isEscapeClass ( cc , charClass ) and
512- this = getCanonicalCharClass ( cc ) and
513- charClass = [ "D" , "S" , "W" ]
511+ exists ( RegExpTerm cc |
512+ isEscapeClass ( cc , charClass ) and
513+ this = getCanonicalCharClass ( cc ) and
514+ charClass = [ "D" , "S" , "W" ]
515+ )
514516 }
515517
516518 override string getARelevantChar ( ) {
0 commit comments