@@ -274,12 +274,10 @@ class StringComponent extends AstNode, TStringComponent {
274274 * "foo#{ bar() } baz"
275275 * ```
276276 */
277- class StringTextComponent extends StringComponent , TStringTextComponent {
277+ class StringTextComponent extends StringComponent , TStringTextComponentNonRegexp {
278278 private Ruby:: Token g ;
279279
280- StringTextComponent ( ) {
281- this = TStringTextComponent ( g ) and not g .getParent ( ) instanceof Ruby:: Regex
282- }
280+ StringTextComponent ( ) { this = TStringTextComponentNonRegexp ( g ) }
283281
284282 final override string toString ( ) { result = g .getValue ( ) }
285283
@@ -291,12 +289,10 @@ class StringTextComponent extends StringComponent, TStringTextComponent {
291289/**
292290 * An escape sequence component of a string or string-like literal.
293291 */
294- class StringEscapeSequenceComponent extends StringComponent , TStringEscapeSequenceComponent {
292+ class StringEscapeSequenceComponent extends StringComponent , TStringEscapeSequenceComponentNonRegexp {
295293 private Ruby:: EscapeSequence g ;
296294
297- StringEscapeSequenceComponent ( ) {
298- this = TStringEscapeSequenceComponent ( g ) and not g .getParent ( ) instanceof Ruby:: Regex
299- }
295+ StringEscapeSequenceComponent ( ) { this = TStringEscapeSequenceComponentNonRegexp ( g ) }
300296
301297 final override string toString ( ) { result = g .getValue ( ) }
302298
@@ -309,12 +305,10 @@ class StringEscapeSequenceComponent extends StringComponent, TStringEscapeSequen
309305 * An interpolation expression component of a string or string-like literal.
310306 */
311307class StringInterpolationComponent extends StringComponent , StmtSequence ,
312- TStringInterpolationComponent {
308+ TStringInterpolationComponentNonRegexp {
313309 private Ruby:: Interpolation g ;
314310
315- StringInterpolationComponent ( ) {
316- this = TStringInterpolationComponent ( g ) and not g .getParent ( ) instanceof Ruby:: Regex
317- }
311+ StringInterpolationComponent ( ) { this = TStringInterpolationComponentNonRegexp ( g ) }
318312
319313 final override string toString ( ) { result = "#{...}" }
320314
@@ -325,14 +319,15 @@ class StringInterpolationComponent extends StringComponent, StmtSequence,
325319 final override string getAPrimaryQlClass ( ) { result = "StringInterpolationComponent" }
326320}
327321
322+ private class TRegExpComponent =
323+ TStringTextComponentRegexp or TStringEscapeSequenceComponentRegexp or
324+ TStringInterpolationComponentRegexp ;
325+
328326/**
329327 * The base class for a component of a regular expression literal.
330328 */
331- class RegExpComponent extends AstNode , TStringComponent {
332- private RegExpLiteral parent ;
333-
334- RegExpComponent ( ) { toGenerated ( this ) .getParent ( ) = toGenerated ( parent ) }
335-
329+ class RegExpComponent extends AstNode , TRegExpComponent {
330+ /** Gets the source text for this regex component, if any. */
336331 string getValueText ( ) { none ( ) }
337332}
338333
@@ -348,10 +343,10 @@ class RegExpComponent extends AstNode, TStringComponent {
348343 * "foo#{ bar() } baz"
349344 * ```
350345 */
351- class RegExpTextComponent extends RegExpComponent , TStringTextComponent {
346+ class RegExpTextComponent extends RegExpComponent , TStringTextComponentRegexp {
352347 private Ruby:: Token g ;
353348
354- RegExpTextComponent ( ) { this = TStringTextComponent ( g ) and g . getParent ( ) instanceof Ruby :: Regex }
349+ RegExpTextComponent ( ) { this = TStringTextComponentRegexp ( g ) }
355350
356351 final override string toString ( ) { result = g .getValue ( ) }
357352
@@ -367,10 +362,10 @@ class RegExpTextComponent extends RegExpComponent, TStringTextComponent {
367362/**
368363 * An escape sequence component of a regex literal.
369364 */
370- class RegExpEscapeSequenceComponent extends RegExpComponent , TStringEscapeSequenceComponent {
365+ class RegExpEscapeSequenceComponent extends RegExpComponent , TStringEscapeSequenceComponentRegexp {
371366 private Ruby:: EscapeSequence g ;
372367
373- RegExpEscapeSequenceComponent ( ) { this = TStringEscapeSequenceComponent ( g ) }
368+ RegExpEscapeSequenceComponent ( ) { this = TStringEscapeSequenceComponentRegexp ( g ) }
374369
375370 final override string toString ( ) { result = g .getValue ( ) }
376371
@@ -387,10 +382,10 @@ class RegExpEscapeSequenceComponent extends RegExpComponent, TStringEscapeSequen
387382 * An interpolation expression component of a regex literal.
388383 */
389384class RegExpInterpolationComponent extends RegExpComponent , StmtSequence ,
390- TStringInterpolationComponent {
385+ TStringInterpolationComponentRegexp {
391386 private Ruby:: Interpolation g ;
392387
393- RegExpInterpolationComponent ( ) { this = TStringInterpolationComponent ( g ) }
388+ RegExpInterpolationComponent ( ) { this = TStringInterpolationComponentRegexp ( g ) }
394389
395390 final override string toString ( ) { result = "#{...}" }
396391
0 commit comments