add support for Lift Template Literal Restriction (#23801)

* add support for Lift Template Literal Restriction

* rename file and improve comment and tests

* fix NoSubstitutionTemplateLiteral support

* extract tagged template and add more test

* avoid useless parameter

* fix incorrect return node if cannot transform

* accept baseline

* correctly baseline

* accept baseline

* fix merge break

* fix merge break

* inline rescan template head or no subsititution template

* update scan error

* add comment and fix lint

* refactor and fix lint

* avoid blank

* fix merge conflict

* fix again

* fix again

* use multiple target

* fix space lint

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
Wenlu Wang
2020-02-06 00:59:51 +08:00
committed by GitHub
parent 20471182fc
commit 70399e146e
31 changed files with 1647 additions and 125 deletions

View File

@@ -135,7 +135,7 @@ namespace ts {
const lastTemplateStackToken = lastOrUndefined(templateStack);
if (lastTemplateStackToken === SyntaxKind.TemplateHead) {
token = scanner.reScanTemplateToken();
token = scanner.reScanTemplateToken(/* isTaggedTemplate */ false);
// Only pop on a TemplateTail; a TemplateMiddle indicates there is more for us.
if (token === SyntaxKind.TemplateTail) {

View File

@@ -242,7 +242,7 @@ namespace ts.formatting {
case ScanAction.RescanTemplateToken:
if (token === SyntaxKind.CloseBraceToken) {
lastScanAction = ScanAction.RescanTemplateToken;
return scanner.reScanTemplateToken();
return scanner.reScanTemplateToken(/* isTaggedTemplate */ false);
}
break;
case ScanAction.RescanJsxIdentifier: