[Backport maintenance/4.0.x] Handle FunctionDef blockstart_tolineno edge cases (#2881)

Handle FunctionDef blockstart_tolineno edge cases (#2880)

Getting the lineno of the start of the block for function definition(`FunctionDef.blockstart_tolineno`) can be quite tricky. Take below example:

```python
# Case A
def foo(bar: str) -> None:
    pass
# should returns line=1

# Case B
def foo(
        bar:str):
    pass
# should returns line=2

# Case C
def foo(
    bar:str
) -> None:
    pass
# should returns line=3

# Case D
def foo(
    bar:str
):
# should returns line=3
    pass
```

Currently we only handled Case A, B. With this commit we can cover case C.

But for Case D, we will need a better solution

(cherry picked from commit 8fa18c7fe307bc86b53c1ba442a96cfb26b9ed8f)

Co-authored-by: Low, Zhi Hao <lowzhao@gmail.com>
2 files changed