@@ -236,7 +236,7 @@ class Call extends Call_ {
236
236
string getANamedArgumentName ( ) {
237
237
result = this .getAKeyword ( ) .getArg ( )
238
238
or
239
- result = this .getKwargs ( ) .( Dict ) .getAKey ( ) .( StrConst ) .getText ( )
239
+ result = this .getKwargs ( ) .( Dict ) .getAKey ( ) .( StringLiteral ) .getText ( )
240
240
}
241
241
242
242
/** Gets the positional argument count of this call, provided there is no more than one tuple (*) argument. */
@@ -299,7 +299,7 @@ class Repr extends Repr_ {
299
299
* A bytes constant, such as `b'ascii'`. Note that unadorned string constants such as
300
300
* `"hello"` are treated as Bytes for Python2, but Unicode for Python3.
301
301
*/
302
- class Bytes extends StrConst {
302
+ class Bytes extends StringLiteral {
303
303
/* syntax: b"hello" */
304
304
Bytes ( ) { not this .isUnicode ( ) }
305
305
@@ -446,7 +446,7 @@ class NegativeIntegerLiteral extends ImmutableLiteral, UnaryExpr {
446
446
* A unicode string expression, such as `u"\u20ac"`. Note that unadorned string constants such as
447
447
* "hello" are treated as Bytes for Python2, but Unicode for Python3.
448
448
*/
449
- class Unicode extends StrConst {
449
+ class Unicode extends StringLiteral {
450
450
/* syntax: "hello" */
451
451
Unicode ( ) { this .isUnicode ( ) }
452
452
@@ -599,7 +599,7 @@ class Slice extends Slice_ {
599
599
/**
600
600
* Returns all string prefixes in the database that are explicitly marked as Unicode strings.
601
601
*
602
- * Helper predicate for `StrConst ::isUnicode`.
602
+ * Helper predicate for `StringLiteral ::isUnicode`.
603
603
*/
604
604
pragma [ nomagic]
605
605
private string unicode_prefix ( ) {
@@ -610,20 +610,27 @@ private string unicode_prefix() {
610
610
/**
611
611
* Returns all string prefixes in the database that are _not_ explicitly marked as bytestrings.
612
612
*
613
- * Helper predicate for `StrConst ::isUnicode`.
613
+ * Helper predicate for `StringLiteral ::isUnicode`.
614
614
*/
615
615
pragma [ nomagic]
616
616
private string non_byte_prefix ( ) {
617
617
result = any ( Str_ s ) .getPrefix ( ) and
618
618
not result .charAt ( _) in [ "b" , "B" ]
619
619
}
620
620
621
- /** A string constant. This is a placeholder class -- use `StrConst` instead. */
622
- class Str = StrConst ;
621
+ /** DEPRECATED. Use `StringLiteral` instead. */
622
+ deprecated class Str = StringLiteral ;
623
+
624
+ /** DEPRECATED. Use `StringLiteral` instead. */
625
+ deprecated class StrConst = StringLiteral ;
623
626
624
627
/** A string constant. */
625
- class StrConst extends Str_ , ImmutableLiteral {
628
+ class StringLiteral extends Str_ , ImmutableLiteral {
626
629
/* syntax: "hello" */
630
+ /**
631
+ * Holds if this string is a unicode string, either by default (e.g. if Python 3), or with an
632
+ * explicit prefix.
633
+ */
627
634
predicate isUnicode ( ) {
628
635
this .getPrefix ( ) = unicode_prefix ( )
629
636
or
@@ -652,6 +659,8 @@ class StrConst extends Str_, ImmutableLiteral {
652
659
}
653
660
654
661
override Object getLiteralObject ( ) { none ( ) }
662
+
663
+ override string toString ( ) { result = "StringLiteral" }
655
664
}
656
665
657
666
private predicate name_consts ( Name_ n , string id ) {
0 commit comments