fix(compiler-core): fix multiline member expression check (#2436)

fix #2426
This commit is contained in:
Hunter
2020-10-20 21:31:08 +08:00
committed by GitHub
parent 288c764e52
commit 6d2a1cb64d
3 changed files with 11 additions and 6 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$]*(?:\.[A-Za-z_$][\w$]*|\[[^\]]+\])*$/
const memberExpRE = /^[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*|\[[^\]]+\])*$/
export const isMemberExpression = (path: string): boolean => {
if (!path) return false
return memberExpRE.test(path.trim())