@@ -240,17 +240,12 @@ class Bytes extends StringLiteral {
240240 /* syntax: b"hello" */
241241 Bytes ( ) { not this .isUnicode ( ) }
242242
243- override Object getLiteralObject ( ) {
244- py_cobjecttypes ( result , theBytesType ( ) ) and
245- py_cobjectnames ( result , this .quotedString ( ) )
246- }
247-
248243 /**
249244 * The extractor puts quotes into the name of each string (to prevent "0" clashing with 0).
250245 * The following predicate help us match up a string/byte literals in the source
251246 * which the equivalent object.
252247 */
253- private string quotedString ( ) {
248+ string quotedString ( ) {
254249 exists ( string b_unquoted | b_unquoted = this .getS ( ) | result = "b'" + b_unquoted + "'" )
255250 }
256251}
@@ -266,8 +261,6 @@ class Ellipsis extends Ellipsis_ {
266261 * Consists of string (both unicode and byte) literals and numeric literals.
267262 */
268263abstract class ImmutableLiteral extends Expr {
269- abstract Object getLiteralObject ( ) ;
270-
271264 abstract boolean booleanValue ( ) ;
272265}
273266
@@ -292,12 +285,6 @@ class IntegerLiteral extends Num {
292285
293286 override string toString ( ) { result = "IntegerLiteral" }
294287
295- override Object getLiteralObject ( ) {
296- py_cobjecttypes ( result , theIntType ( ) ) and py_cobjectnames ( result , this .getN ( ) )
297- or
298- py_cobjecttypes ( result , theLongType ( ) ) and py_cobjectnames ( result , this .getN ( ) )
299- }
300-
301288 override boolean booleanValue ( ) {
302289 this .getValue ( ) = 0 and result = false
303290 or
@@ -317,10 +304,6 @@ class FloatLiteral extends Num {
317304
318305 override string toString ( ) { result = "FloatLiteral" }
319306
320- override Object getLiteralObject ( ) {
321- py_cobjecttypes ( result , theFloatType ( ) ) and py_cobjectnames ( result , this .getN ( ) )
322- }
323-
324307 override boolean booleanValue ( ) {
325308 this .getValue ( ) = 0.0 and result = false
326309 or
@@ -343,10 +326,6 @@ class ImaginaryLiteral extends Num {
343326
344327 override string toString ( ) { result = "ImaginaryLiteral" }
345328
346- override Object getLiteralObject ( ) {
347- py_cobjecttypes ( result , theComplexType ( ) ) and py_cobjectnames ( result , this .getN ( ) )
348- }
349-
350329 override boolean booleanValue ( ) {
351330 this .getValue ( ) = 0.0 and result = false
352331 or
@@ -365,11 +344,6 @@ class NegativeIntegerLiteral extends ImmutableLiteral, UnaryExpr {
365344
366345 override boolean booleanValue ( ) { result = this .getOperand ( ) .( IntegerLiteral ) .booleanValue ( ) }
367346
368- override Object getLiteralObject ( ) {
369- ( py_cobjecttypes ( result , theIntType ( ) ) or py_cobjecttypes ( result , theLongType ( ) ) ) and
370- py_cobjectnames ( result , "-" + this .getOperand ( ) .( IntegerLiteral ) .getN ( ) )
371- }
372-
373347 /**
374348 * Gets the (integer) value of this constant. Will not return a result if the value does not fit into
375349 * a 32 bit signed value
@@ -385,11 +359,6 @@ class Unicode extends StringLiteral {
385359 /* syntax: "hello" */
386360 Unicode ( ) { this .isUnicode ( ) }
387361
388- override Object getLiteralObject ( ) {
389- py_cobjecttypes ( result , theUnicodeType ( ) ) and
390- py_cobjectnames ( result , this .quotedString ( ) )
391- }
392-
393362 /**
394363 * Gets the quoted representation fo this string.
395364 *
@@ -593,12 +562,10 @@ class StringLiteral extends Str_, ImmutableLiteral {
593562 this .getText ( ) != "" and result = true
594563 }
595564
596- override Object getLiteralObject ( ) { none ( ) }
597-
598565 override string toString ( ) { result = "StringLiteral" }
599566}
600567
601- private predicate name_consts ( Name_ n , string id ) {
568+ predicate name_consts ( Name_ n , string id ) {
602569 exists ( Variable v | py_variables ( v , n ) and id = v .getId ( ) |
603570 id = "True" or id = "False" or id = "None"
604571 )
@@ -627,8 +594,6 @@ class True extends BooleanLiteral {
627594 /* syntax: True */
628595 True ( ) { name_consts ( this , "True" ) }
629596
630- override Object getLiteralObject ( ) { name_consts ( this , "True" ) and result = theTrueObject ( ) }
631-
632597 override boolean booleanValue ( ) { result = true }
633598}
634599
@@ -637,8 +602,6 @@ class False extends BooleanLiteral {
637602 /* syntax: False */
638603 False ( ) { name_consts ( this , "False" ) }
639604
640- override Object getLiteralObject ( ) { name_consts ( this , "False" ) and result = theFalseObject ( ) }
641-
642605 override boolean booleanValue ( ) { result = false }
643606}
644607
@@ -647,8 +610,6 @@ class None extends NameConstant {
647610 /* syntax: None */
648611 None ( ) { name_consts ( this , "None" ) }
649612
650- override Object getLiteralObject ( ) { name_consts ( this , "None" ) and result = theNoneObject ( ) }
651-
652613 override boolean booleanValue ( ) { result = false }
653614}
654615
0 commit comments