patch 9.0.1081: using "->" with split lines does not always work

Problem:    Using "->" with split lines does not always work.
Solution:   Avoid trying to get another line. (closes #11723)
diff --git a/src/eval.c b/src/eval.c
index 934d640..94bb4e3 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -4548,11 +4548,19 @@
 	if (**arg != '(' && alias == NULL
 				    && (paren = vim_strchr(*arg, '(')) != NULL)
 	{
-	    char_u *deref;
-
 	    *arg = name;
+
+	    // Truncate the name a the "(".  Avoid trying to get another line
+	    // by making "getline" NULL.
 	    *paren = NUL;
-	    deref = deref_function_name(arg, &tofree, evalarg, verbose);
+	    char_u	*(*getline)(int, void *, int, getline_opt_T) = NULL;
+	    if (evalarg != NULL)
+	    {
+		getline = evalarg->eval_getline;
+		evalarg->eval_getline = NULL;
+	    }
+
+	    char_u *deref = deref_function_name(arg, &tofree, evalarg, verbose);
 	    if (deref == NULL)
 	    {
 		*arg = name + len;
@@ -4563,7 +4571,10 @@
 		name = deref;
 		len = (long)STRLEN(name);
 	    }
+
 	    *paren = '(';
+	    if (getline != NULL)
+		evalarg->eval_getline = getline;
 	}
 
 	if (ret == OK)
diff --git a/src/testdir/test_user_func.vim b/src/testdir/test_user_func.vim
index 79afea1..ade259c 100644
--- a/src/testdir/test_user_func.vim
+++ b/src/testdir/test_user_func.vim
@@ -179,6 +179,60 @@
   eval 'bar'->s:addFoo()->assert_equal('barfoo')
 endfunc
 
+func Test_method_with_linebreaks()
+  let lines =<< trim END
+      vim9script
+
+      export def Scan(ll: list<number>): func(func(number))
+        return (Emit: func(number)) => {
+          for v in ll
+            Emit(v)
+          endfor
+        }
+      enddef
+
+      export def Build(Cont: func(func(number))): list<number>
+        var result: list<number> = []
+        Cont((v) => {
+            add(result, v)
+        })
+        return result
+      enddef
+
+      export def Noop(Cont: func(func(number))): func(func(number))
+        return (Emit: func(number)) => {
+          Cont(Emit)
+        }
+      enddef
+  END
+  call writefile(lines, 'Xlib.vim', 'D')
+
+  let lines =<< trim END
+      vim9script
+
+      import "./Xlib.vim" as lib
+
+      const x = [1, 2, 3]
+
+      var result = lib.Scan(x)->lib.Noop()->lib.Build()
+      assert_equal([1, 2, 3], result)
+
+      result = lib.Scan(x)->lib.Noop()
+              ->lib.Build()
+      assert_equal([1, 2, 3], result)
+
+      result = lib.Scan(x)
+            ->lib.Noop()->lib.Build()
+      assert_equal([1, 2, 3], result)
+
+      result = lib.Scan(x)
+                ->lib.Noop()
+                ->lib.Build()
+      assert_equal([1, 2, 3], result)
+  END
+  call v9.CheckScriptSuccess(lines)
+endfunc
+
 func Test_failed_call_in_try()
   try | call UnknownFunc() | catch | endtry
 endfunc
diff --git a/src/version.c b/src/version.c
index a237128..90522fd 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1081,
+/**/
     1080,
 /**/
     1079,