patch 8.1.2004: more functions can be used as methods

Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 2461b6c..19922da 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -715,38 +715,38 @@
     {"sort",		1, 3, FEARG_1,	  f_sort},
 #ifdef FEAT_SOUND
     {"sound_clear",	0, 0, 0,	  f_sound_clear},
-    {"sound_playevent",	1, 2, 0,	  f_sound_playevent},
-    {"sound_playfile",	1, 2, 0,	  f_sound_playfile},
-    {"sound_stop",	1, 1, 0,	  f_sound_stop},
+    {"sound_playevent",	1, 2, FEARG_1,	  f_sound_playevent},
+    {"sound_playfile",	1, 2, FEARG_1,	  f_sound_playfile},
+    {"sound_stop",	1, 1, FEARG_1,	  f_sound_stop},
 #endif
-    {"soundfold",	1, 1, 0,	  f_soundfold},
-    {"spellbadword",	0, 1, 0,	  f_spellbadword},
-    {"spellsuggest",	1, 3, 0,	  f_spellsuggest},
+    {"soundfold",	1, 1, FEARG_1,	  f_soundfold},
+    {"spellbadword",	0, 1, FEARG_1,	  f_spellbadword},
+    {"spellsuggest",	1, 3, FEARG_1,	  f_spellsuggest},
     {"split",		1, 3, FEARG_1,	  f_split},
 #ifdef FEAT_FLOAT
     {"sqrt",		1, 1, FEARG_1,	  f_sqrt},
     {"str2float",	1, 1, FEARG_1,	  f_str2float},
 #endif
     {"str2list",	1, 2, FEARG_1,	  f_str2list},
-    {"str2nr",		1, 2, 0,	  f_str2nr},
-    {"strcharpart",	2, 3, 0,	  f_strcharpart},
-    {"strchars",	1, 2, 0,	  f_strchars},
-    {"strdisplaywidth",	1, 2, 0,	  f_strdisplaywidth},
+    {"str2nr",		1, 2, FEARG_1,	  f_str2nr},
+    {"strcharpart",	2, 3, FEARG_1,	  f_strcharpart},
+    {"strchars",	1, 2, FEARG_1,	  f_strchars},
+    {"strdisplaywidth",	1, 2, FEARG_1,	  f_strdisplaywidth},
 #ifdef HAVE_STRFTIME
-    {"strftime",	1, 2, 0,	  f_strftime},
+    {"strftime",	1, 2, FEARG_1,	  f_strftime},
 #endif
-    {"strgetchar",	2, 2, 0,	  f_strgetchar},
-    {"stridx",		2, 3, 0,	  f_stridx},
+    {"strgetchar",	2, 2, FEARG_1,	  f_strgetchar},
+    {"stridx",		2, 3, FEARG_1,	  f_stridx},
     {"string",		1, 1, FEARG_1,	  f_string},
     {"strlen",		1, 1, FEARG_1,	  f_strlen},
-    {"strpart",		2, 3, 0,	  f_strpart},
-    {"strridx",		2, 3, 0,	  f_strridx},
+    {"strpart",		2, 3, FEARG_1,	  f_strpart},
+    {"strridx",		2, 3, FEARG_1,	  f_strridx},
     {"strtrans",	1, 1, FEARG_1,	  f_strtrans},
     {"strwidth",	1, 1, FEARG_1,	  f_strwidth},
-    {"submatch",	1, 2, 0,	  f_submatch},
+    {"submatch",	1, 2, FEARG_1,	  f_submatch},
     {"substitute",	4, 4, FEARG_1,	  f_substitute},
-    {"swapinfo",	1, 1, 0,	  f_swapinfo},
-    {"swapname",	1, 1, 0,	  f_swapname},
+    {"swapinfo",	1, 1, FEARG_1,	  f_swapinfo},
+    {"swapname",	1, 1, FEARG_1,	  f_swapname},
     {"synID",		3, 3, 0,	  f_synID},
     {"synIDattr",	2, 3, FEARG_1,	  f_synIDattr},
     {"synIDtrans",	1, 1, FEARG_1,	  f_synIDtrans},
diff --git a/src/testdir/test_breakindent.vim b/src/testdir/test_breakindent.vim
index 65e258a..785709f 100644
--- a/src/testdir/test_breakindent.vim
+++ b/src/testdir/test_breakindent.vim
@@ -424,7 +424,7 @@
   call s:test_windows('setl cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4 vts=4')
   let text = getline(2)
   let width = strlen(text[1:]) + 2->indent() + strlen(&sbr) * 3 " text wraps 3 times
-  call assert_equal(width, strdisplaywidth(text))
+  call assert_equal(width, text->strdisplaywidth())
   call s:close_windows('set sbr= vts&')
 endfunc
 
diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim
index 110cecb..365a813 100644
--- a/src/testdir/test_expr.vim
+++ b/src/testdir/test_expr.vim
@@ -53,7 +53,7 @@
 
 func Test_strgetchar()
   call assert_equal(char2nr('a'), strgetchar('axb', 0))
-  call assert_equal(char2nr('x'), strgetchar('axb', 1))
+  call assert_equal(char2nr('x'), 'axb'->strgetchar(1))
   call assert_equal(char2nr('b'), strgetchar('axb', 2))
 
   call assert_equal(-1, strgetchar('axb', -1))
@@ -63,7 +63,7 @@
 
 func Test_strcharpart()
   call assert_equal('a', strcharpart('axb', 0, 1))
-  call assert_equal('x', strcharpart('axb', 1, 1))
+  call assert_equal('x', 'axb'->strcharpart(1, 1))
   call assert_equal('b', strcharpart('axb', 2, 1))
   call assert_equal('xb', strcharpart('axb', 1))
 
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 3588c76..4c6d2a8 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -138,7 +138,7 @@
   call assert_equal(-123456789, str2nr('-123456789'))
 
   call assert_equal(5, str2nr('101', 2))
-  call assert_equal(5, str2nr('0b101', 2))
+  call assert_equal(5, '0b101'->str2nr(2))
   call assert_equal(5, str2nr('0B101', 2))
   call assert_equal(-5, str2nr('-101', 2))
   call assert_equal(-5, str2nr('-0b101', 2))
@@ -184,7 +184,7 @@
   " of strftime() can be 17 or 18, depending on timezone.
   call assert_match('^2017-01-1[78]$', strftime('%Y-%m-%d', 1484695512))
   "
-  call assert_match('^\d\d\d\d-\(0\d\|1[012]\)-\([012]\d\|3[01]\) \([01]\d\|2[0-3]\):[0-5]\d:\([0-5]\d\|60\)$', strftime('%Y-%m-%d %H:%M:%S'))
+  call assert_match('^\d\d\d\d-\(0\d\|1[012]\)-\([012]\d\|3[01]\) \([01]\d\|2[0-3]\):[0-5]\d:\([0-5]\d\|60\)$', '%Y-%m-%d %H:%M:%S'->strftime())
 
   call assert_fails('call strftime([])', 'E730:')
   call assert_fails('call strftime("%Y", [])', 'E745:')
@@ -415,7 +415,7 @@
 func Test_strpart()
   call assert_equal('de', strpart('abcdefg', 3, 2))
   call assert_equal('ab', strpart('abcdefg', -2, 4))
-  call assert_equal('abcdefg', strpart('abcdefg', -2))
+  call assert_equal('abcdefg', 'abcdefg'->strpart(-2))
   call assert_equal('fg', strpart('abcdefg', 5, 4))
   call assert_equal('defg', strpart('abcdefg', 3))
 
@@ -763,11 +763,11 @@
 func Test_stridx()
   call assert_equal(-1, stridx('', 'l'))
   call assert_equal(0,  stridx('', ''))
-  call assert_equal(0,  stridx('hello', ''))
+  call assert_equal(0,  'hello'->stridx(''))
   call assert_equal(-1, stridx('hello', 'L'))
   call assert_equal(2,  stridx('hello', 'l', -1))
   call assert_equal(2,  stridx('hello', 'l', 0))
-  call assert_equal(2,  stridx('hello', 'l', 1))
+  call assert_equal(2,  'hello'->stridx('l', 1))
   call assert_equal(3,  stridx('hello', 'l', 3))
   call assert_equal(-1, stridx('hello', 'l', 4))
   call assert_equal(-1, stridx('hello', 'l', 10))
@@ -780,7 +780,7 @@
   call assert_equal(0,  strridx('', ''))
   call assert_equal(5,  strridx('hello', ''))
   call assert_equal(-1, strridx('hello', 'L'))
-  call assert_equal(3,  strridx('hello', 'l'))
+  call assert_equal(3,  'hello'->strridx('l'))
   call assert_equal(3,  strridx('hello', 'l', 10))
   call assert_equal(3,  strridx('hello', 'l', 3))
   call assert_equal(2,  strridx('hello', 'l', 2))
diff --git a/src/testdir/test_sound.vim b/src/testdir/test_sound.vim
index 6ffd7e6..86dc596 100644
--- a/src/testdir/test_sound.vim
+++ b/src/testdir/test_sound.vim
@@ -13,13 +13,13 @@
   if has('win32')
     throw 'Skipped: Playing event with callback is not supported on Windows'
   endif
-  let id = sound_playevent('bell', 'PlayCallback')
+  let id = 'bell'->sound_playevent('PlayCallback')
   if id == 0
     throw 'Skipped: bell event not available'
   endif
   " Stop it quickly, avoid annoying the user.
   sleep 20m
-  call sound_stop(id)
+  eval id->sound_stop()
   sleep 30m
   call assert_equal(id, g:id)
   call assert_equal(1, g:result)  " sound was aborted
@@ -35,7 +35,7 @@
   endif
 
   " play until the end
-  let id2 = sound_playfile(fname, 'PlayCallback')
+  let id2 = fname->sound_playfile('PlayCallback')
   call assert_true(id2 > 0)
   sleep 500m
   call assert_equal(id2, g:id)
diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim
index af72637..a44d955 100644
--- a/src/testdir/test_spell.vim
+++ b/src/testdir/test_spell.vim
@@ -73,7 +73,7 @@
   set spell
 
   call assert_equal(['bycycle', 'bad'],  spellbadword('My bycycle.'))
-  call assert_equal(['another', 'caps'], spellbadword('A sentence. another sentence'))
+  call assert_equal(['another', 'caps'], 'A sentence. another sentence'->spellbadword())
 
   set spelllang=en
   call assert_equal(['', ''],            spellbadword('centre'))
@@ -179,7 +179,7 @@
         \ )
 
   call assert_equal("gebletegek", soundfold('goobledygoook'))
-  call assert_equal("kepereneven", soundfold('kóopërÿnôven'))
+  call assert_equal("kepereneven", 'kóopërÿnôven'->soundfold())
   call assert_equal("everles gesvets etele", soundfold('oeverloos gezwets edale'))
 endfunc
 
@@ -440,7 +440,7 @@
       break
     endif
     let prevbad = bad
-    let lst = spellsuggest(bad, 3)
+    let lst = bad->spellsuggest(3)
     normal mm
 
     call add(result, [bad, lst])
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index a263fb6..8a8e7ab 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -337,7 +337,7 @@
 		\ substitute('A123456789',
 		\ 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)',
 		\ '\=string([submatch(0, 1), submatch(9, 1), ' .
-		\ 'submatch(8, 1), submatch(7, 1), submatch(6, 1), ' .
+		\ 'submatch(8, 1), 7->submatch(1), submatch(6, 1), ' .
 		\ 'submatch(5, 1), submatch(4, 1), submatch(3, 1), ' .
 		\ 'submatch(2, 1), submatch(1, 1)])',
 		\ ''))
diff --git a/src/testdir/test_swap.vim b/src/testdir/test_swap.vim
index 856c663..6e01ad0 100644
--- a/src/testdir/test_swap.vim
+++ b/src/testdir/test_swap.vim
@@ -111,7 +111,7 @@
   w
   let fname = s:swapname()
   call assert_match('Xswapinfo', fname)
-  let info = swapinfo(fname)
+  let info = fname->swapinfo()
 
   let ver = printf('VIM %d.%d', v:version / 100, v:version % 100)
   call assert_equal(ver, info.version)
@@ -153,7 +153,7 @@
   let buf = bufnr('%')
   let expected = s:swapname()
   wincmd p
-  call assert_equal(expected, swapname(buf))
+  call assert_equal(expected, buf->swapname())
 
   new Xtest3
   setlocal noswapfile
diff --git a/src/testdir/test_utf8.vim b/src/testdir/test_utf8.vim
index fa0568e..42a46fd 100644
--- a/src/testdir/test_utf8.vim
+++ b/src/testdir/test_utf8.vim
@@ -17,7 +17,7 @@
   let exp = [[1, 1, 1], [3, 3, 3], [2, 2, 1], [3, 3, 1], [1, 1, 1]]
   for i in range(len(inp))
     call assert_equal(exp[i][0], strchars(inp[i]))
-    call assert_equal(exp[i][1], strchars(inp[i], 0))
+    call assert_equal(exp[i][1], inp[i]->strchars(0))
     call assert_equal(exp[i][2], strchars(inp[i], 1))
   endfor
 endfunc
diff --git a/src/version.c b/src/version.c
index 8097677..54680f5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2004,
+/**/
     2003,
 /**/
     2002,