Move token resolution to plan building

o Write tests
o Add Materialize.mapValues
Ensure Map.mapValues gets materialized immediately everywhere

o Introduce helper Materialized.mapValues for this purpose
Merge pull request #1157 from boggle/2.0-resolve-labels

Move token resolution to plan building