public static Matcher constructorPropertyDeclaration ( ) { return new Matcher ( ) { @ Override public boolean matches ( Node node , NodeMetadata metadata ) { // This will match against code that looks like: // /** @constructor */ // function constructor() { // this.variable = 3; // } if ( ! node . isAssign ( ) || ! node . getFirstChild ( ) . isGetProp ( ) || ! node . getFirstFirstChild ( ) . isThis ( ) ) { return false ; } while ( node != null && ! node . isFunction ( ) ) { node = node . getParent ( ) ; } if ( node != null && node . isFunction ( ) ) { JSDocInfo jsDoc = NodeUtil . getBestJSDocInfo ( node ) ; if ( jsDoc != null ) { return jsDoc . isConstructor ( ) ; } } return false ; } } ; }
Returns a Matcher that matches against properties that are declared in the constructor .