Bug - 1/2: s/function \+(/function(/

RILDIRS= \
  dom/cellbroadcast/ \
  dom/icc/ \
  dom/mobilemessage/ \
  dom/network/ \
  dom/telephony/ \
  dom/voicemail/ \
  dom/system/gonk/
for f in `find $RILDIRS -type f -name \*.js -o -name \*.jsm`; do
  sed -i $f -e 's/function \+(/function(/';
done
Bug - 2/3: s/\(\w\+\): function \(\w\+\)(/\1: function(/

$ RILDIRS= \
  dom/cellbroadcast/ \
  dom/icc/ \
  dom/mobilemessage/ \
  dom/network/ \
  dom/telephony/ \
  dom/voicemail/ \
  dom/system/gonk/

$ find $RILDIRS -type f -name \*.js -o -name \*.jsm | \
  grep -v test | \
  xargs sh -c 'rvim "$@" </dev/tty' asdf

In vim, replace all duplicated method name:

  1,$s,\(\w\+\): function \(\w\+\)(,\1: function(,

and check if there is line-wrapped method definitions:

  /^\s*\w\+:\n
Bug - 3/3: correct ril_worker 'RIL[FOO] = function FOO()' as well.