fix #18: if for iterator is an expression, cache it
also caches length, though I hardly think it matters for performance in most engines anymore