@@ -34,6 +34,8 @@ namespace ts {
3434 context . onEmitNode = onEmitNode ;
3535 context . enableSubstitution ( SyntaxKind . Identifier ) ; // Substitutes expression identifiers with imported/exported symbols.
3636 context . enableSubstitution ( SyntaxKind . BinaryExpression ) ; // Substitutes assignments to exported symbols.
37+ context . enableSubstitution ( SyntaxKind . CallExpression ) ; // Substitutes expression identifiers with imported/exported symbols.
38+ context . enableSubstitution ( SyntaxKind . TaggedTemplateExpression ) ; // Substitutes expression identifiers with imported/exported symbols.
3739 context . enableSubstitution ( SyntaxKind . PrefixUnaryExpression ) ; // Substitutes updates to exported symbols.
3840 context . enableSubstitution ( SyntaxKind . PostfixUnaryExpression ) ; // Substitutes updates to exported symbols.
3941 context . enableSubstitution ( SyntaxKind . ShorthandPropertyAssignment ) ; // Substitutes shorthand property assignments for imported/exported symbols.
@@ -1742,6 +1744,10 @@ namespace ts {
17421744 return substituteExpressionIdentifier ( < Identifier > node ) ;
17431745 case SyntaxKind . BinaryExpression :
17441746 return substituteBinaryExpression ( < BinaryExpression > node ) ;
1747+ case SyntaxKind . CallExpression :
1748+ return substituteCallExpression ( < CallExpression > node ) ;
1749+ case SyntaxKind . TaggedTemplateExpression :
1750+ return substituteTaggedTemplateExpression ( < TaggedTemplateExpression > node ) ;
17451751 case SyntaxKind . PostfixUnaryExpression :
17461752 case SyntaxKind . PrefixUnaryExpression :
17471753 return substituteUnaryExpression ( < PrefixUnaryExpression | PostfixUnaryExpression > node ) ;
@@ -1750,6 +1756,28 @@ namespace ts {
17501756 return node ;
17511757 }
17521758
1759+ function substituteCallExpression ( node : CallExpression ) {
1760+ if ( ! isIdentifier ( node . expression ) ) {
1761+ return node ;
1762+ }
1763+ const newExpression = substituteExpressionIdentifier ( node . expression ) ;
1764+ if ( newExpression !== node . expression ) {
1765+ return updateCall ( node , setTextRange ( createBinary ( createNumericLiteral ( "0" ) , SyntaxKind . CommaToken , newExpression ) , node . expression ) , /*typeArguments*/ undefined , node . arguments ) ;
1766+ }
1767+ return node ;
1768+ }
1769+
1770+ function substituteTaggedTemplateExpression ( node : TaggedTemplateExpression ) {
1771+ if ( ! isIdentifier ( node . tag ) ) {
1772+ return node ;
1773+ }
1774+ const newTag = substituteExpressionIdentifier ( node . tag ) ;
1775+ if ( newTag !== node . tag ) {
1776+ return updateTaggedTemplate ( node , setTextRange ( createBinary ( createNumericLiteral ( "0" ) , SyntaxKind . CommaToken , newTag ) , node . tag ) , /*typeArguments*/ undefined , node . template ) ;
1777+ }
1778+ return node ;
1779+ }
1780+
17531781 /**
17541782 * Substitution for an Identifier expression that may contain an imported or exported
17551783 * symbol.
0 commit comments