MCPcopy Create free account
hub / github.com/ygs-code/vue / checkIdentifier

Function checkIdentifier

vue.js:15412–15424  ·  view source on GitHub ↗
(ident, //识别
        type,  //类型
        text,  //为本
        errors  //错误信息
    )

Source from the content-addressed store, hash-verified

15410
15411 //检查var a ='_' 或者 检查var a =_ 是否会报错 new function 用来检测js错误 与eval差不多
15412 function checkIdentifier(ident, //识别
15413 type, //类型
15414 text, //为本
15415 errors //错误信息
15416 ) {
15417 if (typeof ident === 'string') {
15418 try {
15419 new Function(("var " + ident + "=_")); //检查var a ='_' 或者 检查var a =_ 是否会报错 new function 用来检测js错误 与eval差不多
15420 } catch (e) {
15421 errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
15422 }
15423 }
15424 }
15425
15426 // new function 用来检测js错误 可以替代eval() 字符转换js检查 字符串变量指向Function,防止有些前端编译工具报错
15427 function checkExpression(exp, text, errors) {

Callers 1

checkForFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected