mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Merge pull request #8208 from Microsoft/transforms-fixDebugFailure
[Transforms] Fix debug failure caused by merge.
This commit is contained in:
commit
2940a3fb74
@ -1883,6 +1883,7 @@ namespace ts {
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.AsExpression:
|
||||
case SyntaxKind.NonNullExpression:
|
||||
case SyntaxKind.ReadonlyKeyword:
|
||||
// These nodes are TypeScript syntax.
|
||||
transformFlags = TransformFlags.AssertTypeScript;
|
||||
|
||||
@ -751,6 +751,8 @@ const _super = (function (geti, seti) {
|
||||
return;
|
||||
case SyntaxKind.AsExpression:
|
||||
return emitAsExpression(<AsExpression>node);
|
||||
case SyntaxKind.NonNullExpression:
|
||||
return emitNonNullExpression(<NonNullExpression>node);
|
||||
|
||||
// JSX
|
||||
case SyntaxKind.JsxElement:
|
||||
@ -1286,6 +1288,11 @@ const _super = (function (geti, seti) {
|
||||
}
|
||||
}
|
||||
|
||||
function emitNonNullExpression(node: NonNullExpression) {
|
||||
emitExpression(node.expression);
|
||||
write("!");
|
||||
}
|
||||
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
|
||||
@ -372,6 +372,10 @@ namespace ts {
|
||||
// TypeScript type assertions are removed, but their subtrees are preserved.
|
||||
return visitAssertionExpression(<AssertionExpression>node);
|
||||
|
||||
case SyntaxKind.NonNullExpression:
|
||||
// TypeScript non-null expressions are removed, but their subtrees are preserved.
|
||||
return visitNonNullExpression(<NonNullExpression>node);
|
||||
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
// TypeScript enum declarations do not exist in ES6 and must be rewritten.
|
||||
return visitEnumDeclaration(<EnumDeclaration>node);
|
||||
@ -2233,7 +2237,12 @@ namespace ts {
|
||||
}
|
||||
|
||||
function visitAssertionExpression(node: AssertionExpression): Expression {
|
||||
const expression = visitNode((<TypeAssertion | AsExpression>node).expression, visitor, isExpression);
|
||||
const expression = visitNode(node.expression, visitor, isExpression);
|
||||
return createPartiallyEmittedExpression(expression, node);
|
||||
}
|
||||
|
||||
function visitNonNullExpression(node: NonNullExpression): Expression {
|
||||
const expression = visitNode(node.expression, visitor, isLeftHandSideExpression);
|
||||
return createPartiallyEmittedExpression(expression, node);
|
||||
}
|
||||
|
||||
|
||||
@ -509,7 +509,7 @@ namespace ts {
|
||||
const { line: startLine } = getLineAndCharacterOfPosition(sourceFile, node.body.pos);
|
||||
const { line: endLine } = getLineAndCharacterOfPosition(sourceFile, node.body.end);
|
||||
if (startLine < endLine) {
|
||||
// The arrow function spans multiple lines,
|
||||
// The arrow function spans multiple lines,
|
||||
// make the error span be the first line, inclusive.
|
||||
return createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1);
|
||||
}
|
||||
@ -3462,7 +3462,8 @@ namespace ts {
|
||||
|| kind === SyntaxKind.NullKeyword
|
||||
|| kind === SyntaxKind.ThisKeyword
|
||||
|| kind === SyntaxKind.TrueKeyword
|
||||
|| kind === SyntaxKind.SuperKeyword;
|
||||
|| kind === SyntaxKind.SuperKeyword
|
||||
|| kind === SyntaxKind.NonNullExpression;
|
||||
}
|
||||
|
||||
export function isLeftHandSideExpression(node: Node): node is LeftHandSideExpression {
|
||||
|
||||
@ -219,6 +219,9 @@ namespace ts {
|
||||
{ name: "expression", test: isExpression },
|
||||
{ name: "type", test: isTypeNode }
|
||||
],
|
||||
[SyntaxKind.NonNullExpression]: [
|
||||
{ name: "expression", test: isLeftHandSideExpression }
|
||||
],
|
||||
[SyntaxKind.TemplateSpan]: [
|
||||
{ name: "expression", test: isExpression },
|
||||
{ name: "literal", test: isTemplateLiteralFragment }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user