@@ -608,6 +608,12 @@ abstract class FunctionValue extends CallableValue {
608608 )
609609 }
610610
611+ /** Gets a class that may be raised by this function */
612+ abstract ClassValue getARaisedType ( ) ;
613+
614+ /** Gets a call-site from where this function is called as a function */
615+ CallNode getAFunctionCall ( ) { result .getFunction ( ) .pointsTo ( ) = this }
616+
611617 /** Gets a call-site from where this function is called as a method */
612618 CallNode getAMethodCall ( ) {
613619 exists ( BoundMethodObjectInternal bm |
@@ -656,6 +662,8 @@ class PythonFunctionValue extends FunctionValue {
656662 /** Gets a control flow node corresponding to a return statement in this function */
657663 ControlFlowNode getAReturnedNode ( ) { result = this .getScope ( ) .getAReturnValueFlowNode ( ) }
658664
665+ override ClassValue getARaisedType ( ) { scope_raises ( result , this .getScope ( ) ) }
666+
659667 override ClassValue getAnInferredReturnType ( ) {
660668 /* We have to do a special version of this because builtin functions have no
661669 * explicit return nodes that we can query and get the class of.
@@ -676,6 +684,11 @@ class BuiltinFunctionValue extends FunctionValue {
676684
677685 override int maxParameters ( ) { none ( ) }
678686
687+ override ClassValue getARaisedType ( ) {
688+ /* Information is unavailable for C code in general */
689+ none ( )
690+ }
691+
679692 override ClassValue getAnInferredReturnType ( ) {
680693 /* We have to do a special version of this because builtin functions have no
681694 * explicit return nodes that we can query and get the class of.
@@ -702,6 +715,11 @@ class BuiltinMethodValue extends FunctionValue {
702715
703716 override int maxParameters ( ) { none ( ) }
704717
718+ override ClassValue getARaisedType ( ) {
719+ /* Information is unavailable for C code in general */
720+ none ( )
721+ }
722+
705723 override ClassValue getAnInferredReturnType ( ) {
706724 result = TBuiltinClassObject ( this .( BuiltinMethodObjectInternal ) .getReturnType ( ) )
707725 }
@@ -929,6 +947,9 @@ module ClassValue {
929947 /** Get the `ClassValue` for the `LookupError` class. */
930948 ClassValue lookupError ( ) { result = TBuiltinClassObject ( Builtin:: builtin ( "LookupError" ) ) }
931949
950+ /** Get the `ClassValue` for the `IndexError` class. */
951+ ClassValue indexError ( ) { result = TBuiltinClassObject ( Builtin:: builtin ( "IndexError" ) ) }
952+
932953 /** Get the `ClassValue` for the `IOError` class. */
933954 ClassValue ioError ( ) { result = TBuiltinClassObject ( Builtin:: builtin ( "IOError" ) ) }
934955
@@ -949,4 +970,7 @@ module ClassValue {
949970 ClassValue unicodeDecodeError ( ) {
950971 result = TBuiltinClassObject ( Builtin:: builtin ( "UnicodeDecodeError" ) )
951972 }
973+
974+ /** Get the `ClassValue` for the `SystemExit` class. */
975+ ClassValue systemExit ( ) { result = TBuiltinClassObject ( Builtin:: builtin ( "SystemExit" ) ) }
952976}
0 commit comments