private List < String > parseMethodParams ( String methodParameters , Node methodSignature ) { List < String > parsedParameters = new ArrayList <> ( ) ; char nextDelimeter = ' ' ; String currentTerm = "" ; for ( int i = 0 ; i < methodParameters . length ( ) ; i ++ ) { if ( methodParameters . charAt ( i ) == nextDelimeter ) { if ( nextDelimeter == ' ' ) { parsedParameters . add ( currentTerm . trim ( ) ) ; currentTerm = "" ; } else { currentTerm += nextDelimeter ; nextDelimeter = ' ' ; } } else { currentTerm += methodParameters . charAt ( i ) ; if ( methodParameters . charAt ( i ) == ' ' || methodParameters . charAt ( i ) == ' ' ) { nextDelimeter = methodParameters . charAt ( i ) ; } } } if ( nextDelimeter != ' ' ) { compiler . report ( JSError . make ( methodSignature , PolymerPassErrors . POLYMER_UNPARSABLE_STRING ) ) ; return parsedParameters ; } if ( currentTerm . length ( ) > 0 ) { parsedParameters . add ( currentTerm . trim ( ) ) ; } return parsedParameters ; }
Parses the parameters string from a complex observer or computed property into distinct parameters . Since a parameter can be a quoted string literal we can t just split on commas .