Resolve instruction id depending on the context from which a function is called. Calling a function in a function context that does not have a definition emitted before reaching lowering will cause a crash. This needs a change in check/eval layer.