template | local variable reference in a function is prefixed with _ctx
Version
3.2.8
Reproduction link
Steps to reproduce
see bad case in repro link
What is expected?
locally defined variables in a function scope should not be prefixed with _ctx when referenced inside the scope.
What is actually happening?
a reference to a local variable declared in the function scope is prefixed with _ctx
variables defined in the function scope should be treated the same like named arguments
for reference
code is compiled from
bad <button @click="(msg)=>{
let a = 'the type is ' + msg.type
output = a
}">
click
</button>
to
_createElementVNode("button", {
onClick: _cache[1] || (_cache[1] = (msg)=>{
let a = 'the type is ' + msg.type
_isRef(output) ? output.value = _ctx.a : output = a
})
}, " click "),
inconsistent prefix usage
_isRef(output) ? output.value = _ctx.a : output = a
there is currently some inconsistency for using a
the usage of a
should probably be consistent for both branches of the condition