private List < Node > addComplexObserverReflectionCalls ( final PolymerClassDefinition cls ) { List < Node > propertySinkStatements = new ArrayList <> ( ) ; Node classMembers = NodeUtil . getClassMembers ( cls . definition ) ; Node getter = NodeUtil . getFirstGetterMatchingKey ( classMembers , "observers" ) ; if ( getter != null ) { Node complexObservers = null ; for ( Node child : NodeUtil . getFunctionBody ( getter . getFirstChild ( ) ) . children ( ) ) { if ( child . isReturn ( ) ) { if ( child . hasChildren ( ) && child . getFirstChild ( ) . isArrayLit ( ) ) { complexObservers = child . getFirstChild ( ) ; break ; } } } if ( complexObservers != null ) { for ( Node complexObserver : complexObservers . children ( ) ) { if ( complexObserver . isString ( ) ) { propertySinkStatements . addAll ( replaceMethodStringWithReflectedCalls ( cls . target , complexObserver ) ) ; } } } } return propertySinkStatements ; }
For any strings returned in the array from the Polymer static observers property parse the method call and path arguments and replace them with property reflection calls .