chore: use BAIL instead of h

This commit is contained in:
Amour1688 2020-07-12 14:01:29 +08:00
parent 9454655ee7
commit 858f39cea2

View File

@ -31,7 +31,6 @@ const transformJSXSpreadAttribute = (
const { properties } = argument.node; const { properties } = argument.node;
if (!properties) { if (!properties) {
if (argument.isIdentifier()) { if (argument.isIdentifier()) {
console.log(isConstant(argument.node), argument.node)
walksScope(nodePath, (argument.node as t.Identifier).name); walksScope(nodePath, (argument.node as t.Identifier).name);
} }
mergeArgs.push(argument.node); mergeArgs.push(argument.node);
@ -62,7 +61,7 @@ const getJSXAttributeValue = (
/** /**
* Check if an attribute value is constant * Check if an attribute value is constant
* @param path * @param node
* @returns boolean * @returns boolean
*/ */
const isConstant = ( const isConstant = (
@ -407,7 +406,7 @@ const transformJSXElement = (
} }
// @ts-ignore // @ts-ignore
const createVNode = t.callExpression(createIdentifier(state, useOptimate ? 'createVNode' : 'h'), [ const createVNode = t.callExpression(createIdentifier(state, 'createVNode'), [
tag, tag,
// @ts-ignore // @ts-ignore
compatibleProps ? t.callExpression(state.get('compatibleProps'), [props]) : props, compatibleProps ? t.callExpression(state.get('compatibleProps'), [props]) : props,
@ -426,7 +425,11 @@ const transformJSXElement = (
].filter(Boolean as any as ExcludesBoolean)) ].filter(Boolean as any as ExcludesBoolean))
: t.arrayExpression(children) : t.arrayExpression(children)
) : t.nullLiteral(), ) : t.nullLiteral(),
!!patchFlag && t.addComment(t.numericLiteral(patchFlag), 'trailing', ` ${flagNames} `, false), !!patchFlag && (
useOptimate
? t.addComment(t.numericLiteral(patchFlag), 'trailing', ` ${flagNames} `, false)
: t.numericLiteral(PatchFlags.BAIL)
),
!!dynamicPropNames.size !!dynamicPropNames.size
&& t.arrayExpression([...dynamicPropNames.keys()].map((name) => t.stringLiteral(name as string))), && t.arrayExpression([...dynamicPropNames.keys()].map((name) => t.stringLiteral(name as string))),
].filter(Boolean as any as ExcludesBoolean)); ].filter(Boolean as any as ExcludesBoolean));