(#22363) Add file/line when creating resources and parameters
The previous version of the logic cheated with "todo" and -1. Now
the file and line is picked up from the reference expression.
While not 100% accurate (it gives the resource expression as a whole,
or the parameter expr as a whole as the location instead of the more
detailed expression (one particular title etc).