@@ -726,7 +726,8 @@ private module Stdlib {
726726 OpenCall ( ) {
727727 this = API:: builtin ( "open" ) .getACall ( )
728728 or
729- this .getFunction ( ) = io_attr ( "open" )
729+ // io.open is a special case, since it is an alias for the builtin `open`
730+ this = API:: moduleImport ( "io" ) .getMember ( "open" ) .getACall ( )
730731 }
731732
732733 override DataFlow:: Node getAPathArgument ( ) {
@@ -880,59 +881,6 @@ private module Stdlib {
880881 }
881882 }
882883
883- // ---------------------------------------------------------------------------
884- // io
885- // ---------------------------------------------------------------------------
886- /** Gets a reference to the `io` module. */
887- private DataFlow:: Node io ( DataFlow:: TypeTracker t ) {
888- t .start ( ) and
889- result = DataFlow:: importNode ( "io" )
890- or
891- exists ( DataFlow:: TypeTracker t2 | result = io ( t2 ) .track ( t2 , t ) )
892- }
893-
894- /** Gets a reference to the `io` module. */
895- DataFlow:: Node io ( ) { result = io ( DataFlow:: TypeTracker:: end ( ) ) }
896-
897- /**
898- * Gets a reference to the attribute `attr_name` of the `io` module.
899- * WARNING: Only holds for a few predefined attributes.
900- */
901- private DataFlow:: Node io_attr ( DataFlow:: TypeTracker t , string attr_name ) {
902- attr_name in [ "open" ] and
903- (
904- t .start ( ) and
905- result = DataFlow:: importNode ( "io" + "." + attr_name )
906- or
907- t .startInAttr ( attr_name ) and
908- result = io ( )
909- )
910- or
911- // Due to bad performance when using normal setup with `io_attr(t2, attr_name).track(t2, t)`
912- // we have inlined that code and forced a join
913- exists ( DataFlow:: TypeTracker t2 |
914- exists ( DataFlow:: StepSummary summary |
915- io_attr_first_join ( t2 , attr_name , result , summary ) and
916- t = t2 .append ( summary )
917- )
918- )
919- }
920-
921- pragma [ nomagic]
922- private predicate io_attr_first_join (
923- DataFlow:: TypeTracker t2 , string attr_name , DataFlow:: Node res , DataFlow:: StepSummary summary
924- ) {
925- DataFlow:: StepSummary:: step ( io_attr ( t2 , attr_name ) , res , summary )
926- }
927-
928- /**
929- * Gets a reference to the attribute `attr_name` of the `io` module.
930- * WARNING: Only holds for a few predefined attributes.
931- */
932- private DataFlow:: Node io_attr ( string attr_name ) {
933- result = io_attr ( DataFlow:: TypeTracker:: end ( ) , attr_name )
934- }
935-
936884 // ---------------------------------------------------------------------------
937885 // json
938886 // ---------------------------------------------------------------------------
0 commit comments