wip: fix binding type fallback
This commit is contained in:
parent
886ed7681d
commit
3019508e75
@ -227,7 +227,7 @@ export function generate(
|
|||||||
if (genScopeId) {
|
if (genScopeId) {
|
||||||
push(`${PURE_ANNOTATION}_withId(`)
|
push(`${PURE_ANNOTATION}_withId(`)
|
||||||
}
|
}
|
||||||
push(`() => {`)
|
push(`(_ctx, _cache${optimizeSources}) => {`)
|
||||||
} else {
|
} else {
|
||||||
if (genScopeId) {
|
if (genScopeId) {
|
||||||
push(`const render = ${PURE_ANNOTATION}_withId(`)
|
push(`const render = ${PURE_ANNOTATION}_withId(`)
|
||||||
|
@ -100,19 +100,17 @@ export function processExpression(
|
|||||||
|
|
||||||
const { inline, inlinePropsIdentifier, bindingMetadata } = context
|
const { inline, inlinePropsIdentifier, bindingMetadata } = context
|
||||||
const prefix = (raw: string) => {
|
const prefix = (raw: string) => {
|
||||||
|
const type = hasOwn(bindingMetadata, raw) && bindingMetadata[raw]
|
||||||
if (inline) {
|
if (inline) {
|
||||||
// setup inline mode, it's either props or setup
|
// setup inline mode
|
||||||
if (bindingMetadata[raw] !== 'setup') {
|
if (type === 'props') {
|
||||||
return `${inlinePropsIdentifier}.${raw}`
|
return `${inlinePropsIdentifier}.${raw}`
|
||||||
} else {
|
} else if (type === 'setup') {
|
||||||
return `${context.helperString(UNREF)}(${raw})`
|
return `${context.helperString(UNREF)}(${raw})`
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
const source = hasOwn(bindingMetadata, raw)
|
|
||||||
? `$` + bindingMetadata[raw]
|
|
||||||
: `_ctx`
|
|
||||||
return `${source}.${raw}`
|
|
||||||
}
|
}
|
||||||
|
// fallback to normal
|
||||||
|
return `${type ? `$${type}` : `_ctx`}.${raw}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// fast path if expression is a simple identifier.
|
// fast path if expression is a simple identifier.
|
||||||
|
@ -685,6 +685,7 @@ export function compileScript(
|
|||||||
if (script) {
|
if (script) {
|
||||||
if (startOffset < scriptStartOffset!) {
|
if (startOffset < scriptStartOffset!) {
|
||||||
// <script setup> before <script>
|
// <script setup> before <script>
|
||||||
|
s.remove(0, startOffset)
|
||||||
s.remove(endOffset, scriptStartOffset!)
|
s.remove(endOffset, scriptStartOffset!)
|
||||||
s.remove(scriptEndOffset!, source.length)
|
s.remove(scriptEndOffset!, source.length)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user