@wevu/compiler 6.6.8 → 6.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +7 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4676,11 +4676,17 @@ function createIdentifierAccessWithPropsFallback(name) {
|
|
|
4676
4676
|
const thisAccess = createThisMemberAccess(name);
|
|
4677
4677
|
const propsAccess = createMemberAccess(createThisMemberAccess("__wevuProps"), name);
|
|
4678
4678
|
const propsObject = createThisMemberAccess("__wevuProps");
|
|
4679
|
+
const stateObject = createThisMemberAccess("$state");
|
|
4679
4680
|
const hasPropsObject = t.binaryExpression("!=", propsObject, t.nullLiteral());
|
|
4680
4681
|
const hasDefinedPropsValue = t.binaryExpression("!==", propsAccess, t.identifier("undefined"));
|
|
4681
4682
|
const hasPropsKey = createHasOwnPropertyCall(propsObject, name);
|
|
4682
4683
|
const hasUsablePropsValue = t.logicalExpression("&&", hasPropsObject, t.logicalExpression("||", hasDefinedPropsValue, hasPropsKey));
|
|
4683
|
-
|
|
4684
|
+
const hasStateObject = t.binaryExpression("!=", stateObject, t.nullLiteral());
|
|
4685
|
+
const hasStateKey = createHasOwnPropertyCall(stateObject, name);
|
|
4686
|
+
const hasThisMember = t.binaryExpression("in", t.stringLiteral(name), t.thisExpression());
|
|
4687
|
+
const shouldUseStateAccess = t.logicalExpression("&&", hasStateObject, hasStateKey);
|
|
4688
|
+
const shouldUsePropsAccess = t.logicalExpression("&&", hasUsablePropsValue, t.unaryExpression("!", hasThisMember));
|
|
4689
|
+
return t.conditionalExpression(shouldUseStateAccess, thisAccess, t.conditionalExpression(shouldUsePropsAccess, propsAccess, thisAccess));
|
|
4684
4690
|
}
|
|
4685
4691
|
function normalizeJsExpressionWithContext(exp, context, options) {
|
|
4686
4692
|
const trimmed = exp.trim();
|