private static void collectConstructorPropertyJsDoc ( Node node , Map < String , JSDocInfo > map ) { checkNotNull ( node ) ; for ( Node child : node . children ( ) ) { if ( child . isGetProp ( ) && child . getFirstChild ( ) . isThis ( ) && child . getSecondChild ( ) . isString ( ) ) { // We found a "this.foo" expression. Map "foo" to its JSDoc. map . put ( child . getSecondChild ( ) . getString ( ) , NodeUtil . getBestJSDocInfo ( child ) ) ; } else { // Recurse through every other kind of node, because properties are not necessarily declared // at the top level of the constructor body; e.g. they could be declared as part of an // assignment, or within an if statement. We're being overly loose here, e.g. we shouldn't // traverse into a nested function where "this" doesn't refer to our prototype, but // hopefully this is good enough for our purposes. collectConstructorPropertyJsDoc ( child , map ) ; } } }
Find the properties that are initialized in the given constructor and return a map from each property name to its JSDoc .