Skip to content
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-core): improve member expression check #8940

Closed
wants to merge 2 commits into from

Conversation

gucovip
Copy link
Contributor

@gucovip gucovip commented Aug 9, 2023

close #8939

@Justineo
Copy link
Member

Justineo commented Aug 9, 2023

According to the spec, the accurate regexp for identifiers (disregarding unicode escape sequences) should be

/^[$_\p{IDS}][$\p{IDC}\u200c\u200d]*/u

But this may have browser compatibility issues so we may need a simplified version. Where does this \xA0-\uFFFF come from in your change?

@gucovip
Copy link
Contributor Author

gucovip commented Aug 9, 2023

According to the spec, the accurate regexp for identifiers (disregarding unicode escape sequences) should be

/^[$_\p{IDS}][$\p{IDC}\u200c\u200d]*/u

But this may have browser compatibility issues so we may need a simplified version. Where does this \xA0-\uFFFF come from in your change?

reference code const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/ (line: 74)

@sxzz sxzz added the ready to merge The PR is ready to be merged. label Aug 9, 2023
@skirtles-code
Copy link
Contributor

Would it be worth adding some tests for this? I can easily imagine somebody trying to tweak that RegExp in future and accidentally breaking support for Chinese characters.

@skirtles-code
Copy link
Contributor

Seems similar to #6765.

@gucovip gucovip closed this Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge The PR is ready to be merged.
Projects
Status: Rejected
Development

Successfully merging this pull request may close these issues.

Template cannot correctly handle Chinese variable names(中文变量名)
4 participants