Skip to content

Optimize eval functions with fixed result #112

Description

@plepe

When eval functions have a fixed result (e.g. 2+2), pgmapcss uses this fixed result, just like as if the final value would have been given.

E.g.:

node {
  foo: 2+2;
  foo: 4;
}

will both compile into

current['properties']['foo'] = '4'

When using a property where the value is checked/modified before assigning, the check/modification could be done at compile time.

E.g.

way {
  color: red;
  color: concat('r', 'e', 'd');
}

will compile into

current['properties']['color'] = '#ff0000';
current['properties']['color'] = check_color('red');

Therefore, for every map feature which matches this rule the check_color() function will be called, which is not necessary.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions