Vue version
3.5.13
Link to minimal reproduction
https://play.vuejs.org/#eNp9UU1PAyEQ/SuEU5s022j1UtcmanrQgzbqkcRs6OxHZYHAsK7Z7H932LUfh6ZAyPDeY3gzdPzB2qQJwJc89dJVFpkHDHYltDTaI+tYk6kArGf3bAt5pWHjjPWT6Z3Q44w6oyBRppgM2qnQedASK6NZDP5R1gmN7pf2XmYoyxgM61yCdD66IR90QKityhDolJbXqzyd0x5FJwSfcfSUKq+KZOeNporoBcYEl6a2lQL3ZqMlL/gyWmE0BM+UMj8vA4YuwGyPyxLk9xl859uICb5x4ME1IPiBw8wVgCO9/niFluIDWZttUKS+QL4DtSFEj6PsMegt2T7RDW6fa2scVrr49OsWQft9UdFoVPaDXnD61qcLpR/tLpKb4R79BnXxqwEXc1IDF8ltcrXg/R/LWbpE
Steps to reproduce
- define a prop with any name(Ex:
value)
- input any code, to use the prop(Ex:
value),console.log(value)
- before the prop use, input a function.It's param use prop's name(Ex:
value),and function body insert an empty try-catch like demo.
- will show error
value is not defined.
What is expected?
Step 2 's code will compile into console.log(__props.value)
What is actually happening?
In @vue/compiler-sfc's code
|
walkFunctionParams(node, registerLocalBinding) |
and
|
currentScope[id.name] = false |
when walk into function. And currentScope.value is not revert to true.cause this error!
In my opinion, this is a rather serious problem.
For example:
After the first use of props(value), and before the second use of it, if there is a function whose parameter is the name of this prop(value), then it will cause all subsequent properties to not function properly, leading to many issues.
System Info
Any additional comments?
No response
Vue version
3.5.13
Link to minimal reproduction
https://play.vuejs.org/#eNp9UU1PAyEQ/SuEU5s022j1UtcmanrQgzbqkcRs6OxHZYHAsK7Z7H932LUfh6ZAyPDeY3gzdPzB2qQJwJc89dJVFpkHDHYltDTaI+tYk6kArGf3bAt5pWHjjPWT6Z3Q44w6oyBRppgM2qnQedASK6NZDP5R1gmN7pf2XmYoyxgM61yCdD66IR90QKityhDolJbXqzyd0x5FJwSfcfSUKq+KZOeNporoBcYEl6a2lQL3ZqMlL/gyWmE0BM+UMj8vA4YuwGyPyxLk9xl859uICb5x4ME1IPiBw8wVgCO9/niFluIDWZttUKS+QL4DtSFEj6PsMegt2T7RDW6fa2scVrr49OsWQft9UdFoVPaDXnD61qcLpR/tLpKb4R79BnXxqwEXc1IDF8ltcrXg/R/LWbpE
Steps to reproduce
value)value),console.log(value)value),and function body insert an emptytry-catchlike demo.value is not defined.What is expected?
Step 2 's code will compile into
console.log(__props.value)What is actually happening?
In @vue/compiler-sfc's code
core/packages/compiler-sfc/src/script/definePropsDestructure.ts
Line 255 in 7ecd2a2
and
core/packages/compiler-sfc/src/script/definePropsDestructure.ts
Line 131 in 7ecd2a2
when walk into function. And
currentScope.valueis not revert totrue.cause this error!In my opinion, this is a rather serious problem.
For example:
After the first use of props(
value), and before the second use of it, if there is a function whose parameter is the name of this prop(value), then it will cause all subsequent properties to not function properly, leading to many issues.System Info
Any additional comments?
No response