Docs: Make `@doc` macro return the value of documented expression (#59882)
Change the `@doc` macro implementation to return the result of the
original expression instead of the Docs.Binding object. This allows
using the documented definition in an assignment or other expression
context.
For example, documenting a function now returns the function itself:
```julia
result = begin
"docstring"
function f end
end
```
Add special handling for `global` declarations to return nothing instead
of failing with a syntax error, since `y = begin; global x; end` is not
valid Julia syntax.
🤖 Generated with help from Claude Code