@@ -236,7 +236,7 @@ class Call extends Call_ {
236236 string getANamedArgumentName ( ) {
237237 result = this .getAKeyword ( ) .getArg ( )
238238 or
239- result = this .getKwargs ( ) .( Dict ) .getAKey ( ) .( StrConst ) .getText ( )
239+ result = this .getKwargs ( ) .( Dict ) .getAKey ( ) .( StringLiteral ) .getText ( )
240240 }
241241
242242 /** 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_ {
299299 * A bytes constant, such as `b'ascii'`. Note that unadorned string constants such as
300300 * `"hello"` are treated as Bytes for Python2, but Unicode for Python3.
301301 */
302- class Bytes extends StrConst {
302+ class Bytes extends StringLiteral {
303303 /* syntax: b"hello" */
304304 Bytes ( ) { not this .isUnicode ( ) }
305305
@@ -446,7 +446,7 @@ class NegativeIntegerLiteral extends ImmutableLiteral, UnaryExpr {
446446 * A unicode string expression, such as `u"\u20ac"`. Note that unadorned string constants such as
447447 * "hello" are treated as Bytes for Python2, but Unicode for Python3.
448448 */
449- class Unicode extends StrConst {
449+ class Unicode extends StringLiteral {
450450 /* syntax: "hello" */
451451 Unicode ( ) { this .isUnicode ( ) }
452452
@@ -599,7 +599,7 @@ class Slice extends Slice_ {
599599/**
600600 * Returns all string prefixes in the database that are explicitly marked as Unicode strings.
601601 *
602- * Helper predicate for `StrConst ::isUnicode`.
602+ * Helper predicate for `StringLiteral ::isUnicode`.
603603 */
604604pragma [ nomagic]
605605private string unicode_prefix ( ) {
@@ -610,20 +610,27 @@ private string unicode_prefix() {
610610/**
611611 * Returns all string prefixes in the database that are _not_ explicitly marked as bytestrings.
612612 *
613- * Helper predicate for `StrConst ::isUnicode`.
613+ * Helper predicate for `StringLiteral ::isUnicode`.
614614 */
615615pragma [ nomagic]
616616private string non_byte_prefix ( ) {
617617 result = any ( Str_ s ) .getPrefix ( ) and
618618 not result .charAt ( _) in [ "b" , "B" ]
619619}
620620
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 ;
623626
624627/** A string constant. */
625- class StrConst extends Str_ , ImmutableLiteral {
628+ class StringLiteral extends Str_ , ImmutableLiteral {
626629 /* 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+ */
627634 predicate isUnicode ( ) {
628635 this .getPrefix ( ) = unicode_prefix ( )
629636 or
@@ -652,6 +659,8 @@ class StrConst extends Str_, ImmutableLiteral {
652659 }
653660
654661 override Object getLiteralObject ( ) { none ( ) }
662+
663+ override string toString ( ) { result = "StringLiteral" }
655664}
656665
657666private predicate name_consts ( Name_ n , string id ) {
0 commit comments