@@ -579,7 +579,31 @@ module API {
579579 * Gets a textual representation of this node.
580580 */
581581 string toString ( ) {
582- none ( ) // defined in subclasses
582+ this = Impl:: MkRoot ( ) and result = "root"
583+ or
584+ exists ( string m | this = Impl:: MkModuleDef ( m ) | result = "module def " + m )
585+ or
586+ exists ( string m | this = Impl:: MkModuleUse ( m ) | result = "module use " + m )
587+ or
588+ exists ( string m | this = Impl:: MkModuleExport ( m ) | result = "module export " + m )
589+ or
590+ exists ( string m | this = Impl:: MkModuleImport ( m ) | result = "module import " + m )
591+ or
592+ exists ( string m , string e | this = Impl:: MkTypeUse ( m , e ) |
593+ result = "type use " + m + "::" + e
594+ )
595+ or
596+ exists ( DataFlow:: SourceNode cls | this = Impl:: MkClassInstance ( cls ) |
597+ result = "instance of " + cls .toString ( )
598+ )
599+ or
600+ exists ( DataFlow:: Node nd | this = Impl:: MkDef ( nd ) | result = "def " + nd .toString ( ) )
601+ or
602+ exists ( DataFlow:: Node nd | this = Impl:: MkUse ( nd ) | result = "use " + nd .toString ( ) )
603+ or
604+ exists ( DataFlow:: InvokeNode nd | this = Impl:: MkSyntheticCallbackArg ( nd ) |
605+ result = "callback arg " + nd .toString ( )
606+ )
583607 }
584608
585609 /**
@@ -607,19 +631,13 @@ module API {
607631 }
608632
609633 /** The root node of an API graph. */
610- class Root extends Node , Impl:: MkRoot {
611- override string toString ( ) { result = "root" }
612- }
634+ class Root extends Node , Impl:: MkRoot { }
613635
614636 /** A node corresponding to a definition of an API component. */
615- class Definition extends Node , Impl:: TDef {
616- override string toString ( ) { result = "def " + this .getInducingNode ( ) .toString ( ) }
617- }
637+ class Definition extends Node , Impl:: TDef { }
618638
619639 /** A node corresponding to the use of an API component. */
620- class Use extends Node , Impl:: TUse {
621- override string toString ( ) { result = "use " + this .getInducingNode ( ) .toString ( ) }
622- }
640+ class Use extends Node , Impl:: TUse { }
623641
624642 /** Gets the root node. */
625643 Root root ( ) { any ( ) }
0 commit comments