-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
fix(compiler): Allow BigInt usage in templates #11152
Conversation
Hi, thanks for the PR but this is not what was mentioned on the issue. The idea is to allow the use of BigInt when it's available and fail if it's not. See https://jsfiddle.net/syrnaefq/. This should work on browsers supporting |
That makes me a little confused... It seems that the idea of this issue is the same to my PR🤦♂️? see this test:
|
Did you mean: 'We need to "{{ BigInt(100) }}" and "{{ 100n }}" both work when BigInt is available, and fail if it is not' like ' "{{ Number(100) }}" and "{{ 100n }}" both work'? If so, I get your point and I will fix it in this way. |
Hi @posva ! If it's OK, please merge this PR, if not, let's discuss further : ) |
src/core/instance/proxy.js
Outdated
const allowedGlobals = makeMap( | ||
'Infinity,undefined,NaN,isFinite,isNaN,' + | ||
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + | ||
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' + | ||
'require' // for Webpack/Browserify | ||
'require,' + // for Webpack/Browserify | ||
(supportBigInt ? 'BigInt' : '') // for BigInt support issue #11126 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine to not use a conditional, the same way we allow Intl
even though it's not supported before IE 11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK,That sounds right,and I will add BigInt
directly in makeMap()
: )
src/core/instance/proxy.js
Outdated
@@ -10,7 +10,8 @@ if (process.env.NODE_ENV !== 'production') { | |||
'Infinity,undefined,NaN,isFinite,isNaN,' + | |||
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + | |||
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' + | |||
'require' // for Webpack/Browserify | |||
'require,' + // for Webpack/Browserify | |||
'BigInt' // for BigInt support issue #11126 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's put it up after the Intl, the comment is not really necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK~, I fixed it in commit#4241f12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shadowings-zy can you undo the merge you did? it seems to have messed up the PR
@posva Sorry, I forgot I use |
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
dev
branch for v2.x (or to a previous version branch), not themaster
branchfix #xxx[,#xxx]
, where "xxx" is the issue number)If adding a new feature, the PR's description includes:
Other information:
Hello!
This pull request is related to issue #11126 . Now we can use BigInt in "Mustache" syntax.
I had already added test for this feature in "test/unit/features/filter/filter.spec.js".
And all tests are passing.
Close #11126