v-for compiler error case
Version
3.2.33
Reproduction link
Steps to reproduce
v-for only spaces after in or of
What is expected?
in this case, should report an X_V_FOR_MALFORMED_EXPRESSION error during compiler
What is actually happening?
error reporting during runtime. (Unexpected token ','. )
Personally, I think the forAliasRE can be changed
// origin
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/
// suggestion
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([^\s]+)/
Personally, I think the forAliasRE can be changed
// origin const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/ // suggestion const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([^\s]+)/
I think this causes issues with expressions that contain spaces after in/of. You can try with v-for="item in store . items"
. This might be a good test case to add.
I think the following regex fixes the issue const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/