Skip to content

Commit

Permalink
Merge pull request #389 from edemaine/tagged-template-literals
Browse files Browse the repository at this point in the history
Treat tagged templates as function calls
  • Loading branch information
ryansolid authored Dec 10, 2024
2 parents a1d24a1 + 6a23046 commit 828f9e9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function isDynamic(path, { checkMember, checkTags, checkCallExpressions =
return false;
}

if (checkCallExpressions && (t.isCallExpression(expr) || t.isOptionalCallExpression(expr))) {
if (checkCallExpressions && (t.isCallExpression(expr) || t.isOptionalCallExpression(expr) || t.isTaggedTemplateExpression(expr))) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ const singleExpression = <>{inserted}</>;

const singleDynamic = <>{inserted()}</>;

const greeting = (x) => "Hello " + x;
const singleTemplateLiteral = <>{greeting`world`}</>

const firstStatic = (
<>
{inserted}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const multiDynamic = [
];
const singleExpression = inserted;
const singleDynamic = _$memo(inserted);
const greeting = x => "Hello " + x;
const singleTemplateLiteral = _$memo(() => greeting`world`);
const firstStatic = [inserted, _tmpl$3()];
const firstDynamic = [_$memo(inserted), _tmpl$3()];
const firstComponent = [_$createComponent(Component, {}), _tmpl$3()];
Expand Down

0 comments on commit 828f9e9

Please sign in to comment.