-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
block params as number? #1199
Comments
There has never been a requirement that we follow javascript id patterns, so |
It conflicts with |
I don't believe this to be the case from my test compilation, it resolves
|
It conflicts semantically and doesn't work as might be expected; no actual error. Because of this, it should probably throw when being parsed. console.log( require("handlebars").compile("{{#each list as |value 4|}} {{value}} {{4}} {{/each}}")({list:[0]}) ) …produces An example of something similar that does throw a parse error: {{#each list as ||}} {{/each}} |
This is operating as expected, {{4}} is resolving the second block parameter. Without the block parameter it would resolve to context['4'] so both behaviors are consistent. There is some level of oddity as numbers are treated as literals in any other position, but I'm not willing to break a use case that has been around for this long because someone chooses a bad variable name. |
Should we not throw an error if the first char in the variable name is not a letter?:
The text was updated successfully, but these errors were encountered: