D-Programming-Language/dmd — pull request #443 by 9rnsr (2011-10-10 09:25:06+00:00)
Title: Issue 6798 - Integrate overloadings for multidimentional indexing and slicing

http://d.puremagic.com/issues/show_bug.cgi?id=6798

This patch is additional enhancement of opDollar (issue 3474 and #442).
Enable the mixture operator overloadings of indexing and slicing.

`a[$-1, 2..$]` is translated to `a.opIndex(a.opDollar!0 - 1, a.opSlice!1(2, a.opDollar!1))`

The slicing `lwr..upr` inside bracket is converted to `a.opSlice!(dimention)(lwr, upr)`.
This enhancement never break existing codes.

expression	newly added overloading	exists overloading

a[]	a.opIndex()	a.opSlice()

a[l..u]	a.opIndex(a.opSlice!0(l, u))	a.opSlice(l, u)

a[l..u, ...]	a.opIndex(a.opSlice!0(l, u), ...)

op a[]	a.opIndexUnary!op()	a.opSliceUnary!op()

op a[l..u]	a.opIndexUnary!op(a.opSlice!0(l, u))	a.opSliceUnary!op(l, u)

op a[l..u, ...]	a.opIndexUnary!op(a.opSlice!0(l, u), ...)

a[i0, ...]	a.opIndex(i0, ...)

op a[i0, ...]	a.opIndexUnary!op(i0, ...)

a[] = v	a.opIndexAssign(v)	a.opSliceAssign(v)

a[l..u] = v	a.opIndexAssign(v, a.opSlice!0(l, u))	a.opSliceAssign(v, l, u)

a[l..u, ...] = v	a.opIndexAssign(v, a.opSlice!0(l, u), ...)

a[i0, ...] = v	a.opIndexAssign(v, i0, ...)

a[l..u] op= v	a.opIndexOpAssign!op(v, a.opSlice!0(l, u))	a.opSliceOpAssign!op(v, l, u)

a[l..u, ...] op= v	a.opIndexOpAssign!op(v, a.opSlice!0(l, u), ...)

a[i0, ...] op= v	a.opIndexOpAssign!op(v, i0, ...)