How to "rewind" when traversing a syntax tree?

That doesn’t scale well. Imagine the following line:

local points = [new Point {1, 2}, new Point {2, 3}];

which should evaluate to:

Point __p = {1, 2};
Point __p2 = {2, 3};
Point* points = [&__p, &__p2];

So each time the traversal stumbles upon a “new”, it has to know which implied locality to apply. So a state in the traversal…? Or there needs to be another traversal first to insert the correct locality into the tree.