@@ -274,12 +274,10 @@ class StringComponent extends AstNode, TStringComponent {
274
274
* "foo#{ bar() } baz"
275
275
* ```
276
276
*/
277
- class StringTextComponent extends StringComponent , TStringTextComponent {
277
+ class StringTextComponent extends StringComponent , TStringTextComponentNonRegexp {
278
278
private Ruby:: Token g ;
279
279
280
- StringTextComponent ( ) {
281
- this = TStringTextComponent ( g ) and not g .getParent ( ) instanceof Ruby:: Regex
282
- }
280
+ StringTextComponent ( ) { this = TStringTextComponentNonRegexp ( g ) }
283
281
284
282
final override string toString ( ) { result = g .getValue ( ) }
285
283
@@ -291,12 +289,10 @@ class StringTextComponent extends StringComponent, TStringTextComponent {
291
289
/**
292
290
* An escape sequence component of a string or string-like literal.
293
291
*/
294
- class StringEscapeSequenceComponent extends StringComponent , TStringEscapeSequenceComponent {
292
+ class StringEscapeSequenceComponent extends StringComponent , TStringEscapeSequenceComponentNonRegexp {
295
293
private Ruby:: EscapeSequence g ;
296
294
297
- StringEscapeSequenceComponent ( ) {
298
- this = TStringEscapeSequenceComponent ( g ) and not g .getParent ( ) instanceof Ruby:: Regex
299
- }
295
+ StringEscapeSequenceComponent ( ) { this = TStringEscapeSequenceComponentNonRegexp ( g ) }
300
296
301
297
final override string toString ( ) { result = g .getValue ( ) }
302
298
@@ -309,12 +305,10 @@ class StringEscapeSequenceComponent extends StringComponent, TStringEscapeSequen
309
305
* An interpolation expression component of a string or string-like literal.
310
306
*/
311
307
class StringInterpolationComponent extends StringComponent , StmtSequence ,
312
- TStringInterpolationComponent {
308
+ TStringInterpolationComponentNonRegexp {
313
309
private Ruby:: Interpolation g ;
314
310
315
- StringInterpolationComponent ( ) {
316
- this = TStringInterpolationComponent ( g ) and not g .getParent ( ) instanceof Ruby:: Regex
317
- }
311
+ StringInterpolationComponent ( ) { this = TStringInterpolationComponentNonRegexp ( g ) }
318
312
319
313
final override string toString ( ) { result = "#{...}" }
320
314
@@ -325,14 +319,15 @@ class StringInterpolationComponent extends StringComponent, StmtSequence,
325
319
final override string getAPrimaryQlClass ( ) { result = "StringInterpolationComponent" }
326
320
}
327
321
322
+ private class TRegExpComponent =
323
+ TStringTextComponentRegexp or TStringEscapeSequenceComponentRegexp or
324
+ TStringInterpolationComponentRegexp ;
325
+
328
326
/**
329
327
* The base class for a component of a regular expression literal.
330
328
*/
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. */
336
331
string getValueText ( ) { none ( ) }
337
332
}
338
333
@@ -348,10 +343,10 @@ class RegExpComponent extends AstNode, TStringComponent {
348
343
* "foo#{ bar() } baz"
349
344
* ```
350
345
*/
351
- class RegExpTextComponent extends RegExpComponent , TStringTextComponent {
346
+ class RegExpTextComponent extends RegExpComponent , TStringTextComponentRegexp {
352
347
private Ruby:: Token g ;
353
348
354
- RegExpTextComponent ( ) { this = TStringTextComponent ( g ) and g . getParent ( ) instanceof Ruby :: Regex }
349
+ RegExpTextComponent ( ) { this = TStringTextComponentRegexp ( g ) }
355
350
356
351
final override string toString ( ) { result = g .getValue ( ) }
357
352
@@ -367,10 +362,10 @@ class RegExpTextComponent extends RegExpComponent, TStringTextComponent {
367
362
/**
368
363
* An escape sequence component of a regex literal.
369
364
*/
370
- class RegExpEscapeSequenceComponent extends RegExpComponent , TStringEscapeSequenceComponent {
365
+ class RegExpEscapeSequenceComponent extends RegExpComponent , TStringEscapeSequenceComponentRegexp {
371
366
private Ruby:: EscapeSequence g ;
372
367
373
- RegExpEscapeSequenceComponent ( ) { this = TStringEscapeSequenceComponent ( g ) }
368
+ RegExpEscapeSequenceComponent ( ) { this = TStringEscapeSequenceComponentRegexp ( g ) }
374
369
375
370
final override string toString ( ) { result = g .getValue ( ) }
376
371
@@ -387,10 +382,10 @@ class RegExpEscapeSequenceComponent extends RegExpComponent, TStringEscapeSequen
387
382
* An interpolation expression component of a regex literal.
388
383
*/
389
384
class RegExpInterpolationComponent extends RegExpComponent , StmtSequence ,
390
- TStringInterpolationComponent {
385
+ TStringInterpolationComponentRegexp {
391
386
private Ruby:: Interpolation g ;
392
387
393
- RegExpInterpolationComponent ( ) { this = TStringInterpolationComponent ( g ) }
388
+ RegExpInterpolationComponent ( ) { this = TStringInterpolationComponentRegexp ( g ) }
394
389
395
390
final override string toString ( ) { result = "#{...}" }
396
391
0 commit comments