Added specs for defined? with expressions.
Fixed defined? for more expressions. Fixes #2611.