Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat($parse): Allow user-defined literals #14194

Closed
wants to merge 1 commit into from

Conversation

lgalfaso
Copy link
Contributor

@lgalfaso lgalfaso commented Mar 7, 2016

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    Feature
  • What is the current behavior? (You can also link to an open issue here)
    It is not possible to add user-defined literals.
  • What is the new behavior (if this is a feature change)?
    It is possible to have user-defined literals like Infinity and NaN
  • Does this PR introduce a breaking change?
    No
  • Please check if the PR fulfills these requirements
  • The commit message follows our guidelines: https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Other information:

Allow user-defined literals.

Close: #9504
Close: #9492

@gkalpak
Copy link
Member

gkalpak commented Mar 10, 2016

Nice one !
LGTM

Unrelated to this PR, I noticed we are copy()'ing a lot while parsing. I guess parsing expressions is not our perfrmance bottleneck, but would it make any noticable difference if we used a more efficient special-purpose copy function ?
@lgalfaso, do you have any insight on this ?

@lgalfaso
Copy link
Contributor Author

@gkalpak we only copy very small objects (they are always objects with key/value and the value is a primitive), and we do so

  • Twice when $ParseProvider is initialized
  • Once per occurrence of this and $local

The later we do not use the same as in the process of creating the evaluation function we pollute the parse tree

@gkalpak
Copy link
Member

gkalpak commented Mar 10, 2016

You are right. I somehow thought we were copying on every branch of the primary function (which is not the case). Just ignore the noise 😁

Allow user-defined literals.

Close: angular#9504
Close: angular#9492
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expressions don't understand Infinity
3 participants