Move merge_contexts function into ExprContext constructor