diff --git a/lib/carto/renderer.js b/lib/carto/renderer.js index f9e8423..2297c19 100644 --- a/lib/carto/renderer.js +++ b/lib/carto/renderer.js @@ -225,6 +225,11 @@ carto.Renderer.prototype.render = function render(m, callback) { }; // This function currently modifies 'current' +// +// @param {Array} the current list of rules +// @param {Object} definition a Definition object to add to the rules +// @param {Object} byFilter an object/dictionary of existing filters +// @param {Object} env the current environment function addRules(current, definition, byFilter, env) { var newFilters = definition.filters, newRules = definition.rules, @@ -282,7 +287,8 @@ function addRules(current, definition, byFilter, env) { // called either once per render (in the case of mss) or per layer // (for mml) // -// definitions: a list of definitions objects that contain .rules +// @param {Object} definitions: a list of definitions objects that contain .rules +// @param {Object} env the environment // // result: an array of arrays is returned, in which each array refers to a // specific attachment @@ -294,6 +300,8 @@ function inheritDefinitions(definitions, env) { var result = []; var current, previous, attachment; + // Evaluate the filters specified by each definition with the given + // environment to correctly resolve variable references definitions.forEach(function(d) { d.filters.ev(env); });