fix(compiler-core): allow unicode to appear in identifiers (#3443)

fix #3440
This commit is contained in:
HcySunYang
2021-03-26 05:24:18 +08:00
committed by GitHub
parent 7715c49af9
commit ebedcccdc0
2 changed files with 8 additions and 1 deletions

View File

@@ -56,7 +56,7 @@ const nonIdentifierRE = /^\d|[^\$\w]/
export const isSimpleIdentifier = (name: string): boolean =>
!nonIdentifierRE.test(name)
const memberExpRE = /^[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*|\[[^\]]+\])*$/
const memberExpRE = /^[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*(?:\s*\.\s*[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*|\[[^\]]+\])*$/
export const isMemberExpression = (path: string): boolean => {
if (!path) return false
return memberExpRE.test(path.trim())