mapbox / carto

fast CSS-like map stylesheets
https://cartocss.readthedocs.io/
Apache License 2.0
652 stars 129 forks source link

Rule.toString prints function instead of zoom level #503

Closed Sjord closed 3 years ago

Sjord commented 4 years ago

Rule.toString means to return the zoom level in its string representation:

tree.Rule.prototype.toString = function() {
    return '[' + tree.Zoom.toString(this.zoom) + '] ' + this.name + ': ' + this.value;
};

However, for me tree.Zoom.toString(this.zoom) gives the following output, regardless of the value of this.zoom:

function(op, value, index, filename) {\n    this.op = op;\n    this.value = value;\n    this.index = index;\n    this.filename = filename;\n}

So Rule.toString prints a blob of JavaScript code instead of information about the zoom level. Should Rule.toString use tree.Zoom(this.zoom).toString() instead? Or just use this.zoom?

This is normally not visible when using carto normally, but may make debugging a little bit harder.