@@ -60,25 +60,16 @@ private module GuardsInput implements
6060 override boolean asBooleanValue ( ) { boolConst ( this , result ) }
6161 }
6262
63- private predicate intConst ( Expr e , int i ) {
64- e .getValue ( ) .toInt ( ) = i and
65- (
66- e .getType ( ) instanceof Enum
67- or
68- e .getType ( ) instanceof IntegralType
69- )
70- }
71-
7263 private class IntegerConstant extends ConstantExpr {
73- IntegerConstant ( ) { intConst ( this , _ ) }
64+ IntegerConstant ( ) { exists ( this . getIntValue ( ) ) }
7465
75- override int asIntegerValue ( ) { intConst ( this , result ) }
66+ override int asIntegerValue ( ) { result = this . getIntValue ( ) }
7667 }
7768
7869 private class EnumConst extends ConstantExpr {
7970 EnumConst ( ) { this .getType ( ) instanceof Enum and this .hasValue ( ) }
8071
81- override int asIntegerValue ( ) { result = this .getValue ( ) . toInt ( ) }
72+ override int asIntegerValue ( ) { result = this .getIntValue ( ) }
8273 }
8374
8475 private class StringConstant extends ConstantExpr instanceof StringLiteral {
@@ -517,35 +508,35 @@ class EnumerableCollectionExpr extends Expr {
517508 |
518509 // x.Length == 0
519510 ct .getComparisonKind ( ) .isEquality ( ) and
520- ct .getAnArgument ( ) .getValue ( ) . toInt ( ) = 0 and
511+ ct .getAnArgument ( ) .getIntValue ( ) = 0 and
521512 branch = isEmpty
522513 or
523514 // x.Length == k, k > 0
524515 ct .getComparisonKind ( ) .isEquality ( ) and
525- ct .getAnArgument ( ) .getValue ( ) . toInt ( ) > 0 and
516+ ct .getAnArgument ( ) .getIntValue ( ) > 0 and
526517 branch = true and
527518 isEmpty = false
528519 or
529520 // x.Length != 0
530521 ct .getComparisonKind ( ) .isInequality ( ) and
531- ct .getAnArgument ( ) .getValue ( ) . toInt ( ) = 0 and
522+ ct .getAnArgument ( ) .getIntValue ( ) = 0 and
532523 branch = isEmpty .booleanNot ( )
533524 or
534525 // x.Length != k, k != 0
535526 ct .getComparisonKind ( ) .isInequality ( ) and
536- ct .getAnArgument ( ) .getValue ( ) . toInt ( ) != 0 and
527+ ct .getAnArgument ( ) .getIntValue ( ) != 0 and
537528 branch = false and
538529 isEmpty = false
539530 or
540531 // x.Length > k, k >= 0
541532 ct .getComparisonKind ( ) .isLessThan ( ) and
542- ct .getFirstArgument ( ) .getValue ( ) . toInt ( ) >= 0 and
533+ ct .getFirstArgument ( ) .getIntValue ( ) >= 0 and
543534 branch = true and
544535 isEmpty = false
545536 or
546537 // x.Length >= k, k > 0
547538 ct .getComparisonKind ( ) .isLessThanEquals ( ) and
548- ct .getFirstArgument ( ) .getValue ( ) . toInt ( ) > 0 and
539+ ct .getFirstArgument ( ) .getIntValue ( ) > 0 and
549540 branch = true and
550541 isEmpty = false
551542 )
0 commit comments