You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// When the string is set as the object property name,// it will be attempted to be transformed into a constant version to avoid repeated caching by the browserexportfunctioninternFunc(internalizeString){// Don't consider "Hash-collision,https://en.wikipedia.org/wiki/Collision_(computer_science)"// v8 貌似在 16383 长度时会发生 hash-collision 经过测试后发现正常consttemporaryOb={};temporaryOb[internalizeString]=true;returnObject.keys(temporaryOb)[0];}
这个函数在eval之前调用了一下
constevalInfo=[`;(function(${keys.join(',')}){${useStrict ? '"use strict";' : ''}`,`\n}).call(window.${contextKey},${values.join(',')});`,];constinternalizeString=internFunc(evalInfo[0]+code+evalInfo[1]);// (0, eval) This expression makes the eval under the global scope(0,eval)(internalizeString);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
在packages/utils/src/utils.ts里有一个internFunc函数,传入一个字符串,返回一个同样的字符串,意义是什么
这个函数在eval之前调用了一下
有没有谁能解惑下
Beta Was this translation helpful? Give feedback.
All reactions