Add logical assignment operator

This commit is contained in:
kingwl 2020-04-01 11:08:26 +08:00
parent 33c3e9e2c6
commit 1d93db81cc
22 changed files with 1230 additions and 570 deletions

View file

@ -3601,6 +3601,9 @@ namespace ts {
if (operatorTokenKind === SyntaxKind.QuestionQuestionToken) { if (operatorTokenKind === SyntaxKind.QuestionQuestionToken) {
transformFlags |= TransformFlags.AssertES2020; transformFlags |= TransformFlags.AssertES2020;
} }
else if (isLogicalAssignmentOperator(operatorTokenKind)) {
transformFlags |= TransformFlags.AssertESNext;
}
else if (operatorTokenKind === SyntaxKind.EqualsToken && leftKind === SyntaxKind.ObjectLiteralExpression) { else if (operatorTokenKind === SyntaxKind.EqualsToken && leftKind === SyntaxKind.ObjectLiteralExpression) {
// Destructuring object assignments with are ES2015 syntax // Destructuring object assignments with are ES2015 syntax
// and possibly ES2018 if they contain rest // and possibly ES2018 if they contain rest

View file

@ -28579,17 +28579,35 @@ namespace ts {
case SyntaxKind.InKeyword: case SyntaxKind.InKeyword:
return checkInExpression(left, right, leftType, rightType); return checkInExpression(left, right, leftType, rightType);
case SyntaxKind.AmpersandAmpersandToken: case SyntaxKind.AmpersandAmpersandToken:
return getTypeFacts(leftType) & TypeFacts.Truthy ? case SyntaxKind.AmpersandAmpersandEqualsToken: {
const resultType = getTypeFacts(leftType) & TypeFacts.Truthy ?
getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) :
leftType; leftType;
if (operator === SyntaxKind.AmpersandAmpersandEqualsToken) {
checkAssignmentOperator(resultType);
}
return resultType;
}
case SyntaxKind.BarBarToken: case SyntaxKind.BarBarToken:
return getTypeFacts(leftType) & TypeFacts.Falsy ? case SyntaxKind.BarBarEqualsToken: {
const resultType = getTypeFacts(leftType) & TypeFacts.Falsy ?
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], UnionReduction.Subtype) : getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], UnionReduction.Subtype) :
leftType; leftType;
if (operator === SyntaxKind.BarBarEqualsToken) {
checkAssignmentOperator(resultType);
}
return resultType;
}
case SyntaxKind.QuestionQuestionToken: case SyntaxKind.QuestionQuestionToken:
return getTypeFacts(leftType) & TypeFacts.EQUndefinedOrNull ? case SyntaxKind.QuestionQuestionEqualsToken: {
const resultType = getTypeFacts(leftType) & TypeFacts.EQUndefinedOrNull ?
getUnionType([getNonNullableType(leftType), rightType], UnionReduction.Subtype) : getUnionType([getNonNullableType(leftType), rightType], UnionReduction.Subtype) :
leftType; leftType;
if (operator === SyntaxKind.QuestionQuestionEqualsToken) {
checkAssignmentOperator(resultType);
}
return resultType;
}
case SyntaxKind.EqualsToken: case SyntaxKind.EqualsToken:
const declKind = isBinaryExpression(left.parent) ? getAssignmentDeclarationKind(left.parent) : AssignmentDeclarationKind.None; const declKind = isBinaryExpression(left.parent) ? getAssignmentDeclarationKind(left.parent) : AssignmentDeclarationKind.None;
checkAssignmentDeclaration(declKind, rightType); checkAssignmentDeclaration(declKind, rightType);

View file

@ -208,6 +208,9 @@ namespace ts {
"&=": SyntaxKind.AmpersandEqualsToken, "&=": SyntaxKind.AmpersandEqualsToken,
"|=": SyntaxKind.BarEqualsToken, "|=": SyntaxKind.BarEqualsToken,
"^=": SyntaxKind.CaretEqualsToken, "^=": SyntaxKind.CaretEqualsToken,
"||=": SyntaxKind.BarBarEqualsToken,
"&&=": SyntaxKind.AmpersandAmpersandEqualsToken,
"??=": SyntaxKind.QuestionQuestionEqualsToken,
"@": SyntaxKind.AtToken, "@": SyntaxKind.AtToken,
"`": SyntaxKind.BacktickToken "`": SyntaxKind.BacktickToken
}); });
@ -1667,6 +1670,9 @@ namespace ts {
return token = SyntaxKind.PercentToken; return token = SyntaxKind.PercentToken;
case CharacterCodes.ampersand: case CharacterCodes.ampersand:
if (text.charCodeAt(pos + 1) === CharacterCodes.ampersand) { if (text.charCodeAt(pos + 1) === CharacterCodes.ampersand) {
if (text.charCodeAt(pos + 2) === CharacterCodes.equals) {
return pos += 3, token = SyntaxKind.AmpersandAmpersandEqualsToken;
}
return pos += 2, token = SyntaxKind.AmpersandAmpersandToken; return pos += 2, token = SyntaxKind.AmpersandAmpersandToken;
} }
if (text.charCodeAt(pos + 1) === CharacterCodes.equals) { if (text.charCodeAt(pos + 1) === CharacterCodes.equals) {
@ -1928,15 +1934,16 @@ namespace ts {
pos++; pos++;
return token = SyntaxKind.GreaterThanToken; return token = SyntaxKind.GreaterThanToken;
case CharacterCodes.question: case CharacterCodes.question:
if (text.charCodeAt(pos + 1) === CharacterCodes.dot && !isDigit(text.charCodeAt(pos + 2))) {
return pos += 2, token = SyntaxKind.QuestionDotToken;
}
if (text.charCodeAt(pos + 1) === CharacterCodes.question) {
if (text.charCodeAt(pos + 2) === CharacterCodes.equals) {
return pos += 3, token = SyntaxKind.QuestionQuestionEqualsToken;
}
return pos += 2, token = SyntaxKind.QuestionQuestionToken;
}
pos++; pos++;
if (text.charCodeAt(pos) === CharacterCodes.dot && !isDigit(text.charCodeAt(pos + 1))) {
pos++;
return token = SyntaxKind.QuestionDotToken;
}
if (text.charCodeAt(pos) === CharacterCodes.question) {
pos++;
return token = SyntaxKind.QuestionQuestionToken;
}
return token = SyntaxKind.QuestionToken; return token = SyntaxKind.QuestionToken;
case CharacterCodes.openBracket: case CharacterCodes.openBracket:
pos++; pos++;
@ -1965,6 +1972,9 @@ namespace ts {
} }
if (text.charCodeAt(pos + 1) === CharacterCodes.bar) { if (text.charCodeAt(pos + 1) === CharacterCodes.bar) {
if (text.charCodeAt(pos + 2) === CharacterCodes.equals) {
return pos += 3, token = SyntaxKind.BarBarEqualsToken;
}
return pos += 2, token = SyntaxKind.BarBarToken; return pos += 2, token = SyntaxKind.BarBarToken;
} }
if (text.charCodeAt(pos + 1) === CharacterCodes.equals) { if (text.charCodeAt(pos + 1) === CharacterCodes.equals) {

View file

@ -1,6 +1,10 @@
/*@internal*/ /*@internal*/
namespace ts { namespace ts {
export function transformESNext(context: TransformationContext) { export function transformESNext(context: TransformationContext) {
const {
hoistVariableDeclaration
} = context;
return chainBundle(transformSourceFile); return chainBundle(transformSourceFile);
function transformSourceFile(node: SourceFile) { function transformSourceFile(node: SourceFile) {
@ -16,9 +20,42 @@ namespace ts {
return node; return node;
} }
switch (node.kind) { switch (node.kind) {
case SyntaxKind.BinaryExpression:
const binaryExpression = <BinaryExpression>node;
if (isLogicalAssignmentOperator(binaryExpression.operatorToken.kind)) {
return transformLogicalAssignmentOperators(binaryExpression);
}
// falls through
default: default:
return visitEachChild(node, visitor, context); return visitEachChild(node, visitor, context);
} }
} }
function transformLogicalAssignmentOperators(binaryExpression: BinaryExpression): VisitResult<Node> {
const operator = binaryExpression.operatorToken;
if (isCompoundAssignment(operator.kind) && isLogicalAssignmentOperator(operator.kind)) {
const nonAssignmentOperator = getNonAssignmentOperatorForCompoundAssignment(operator.kind);
const left = visitNode(binaryExpression.left, visitor, isExpression);
const right = visitNode(binaryExpression.right, visitor, isExpression);
let cond = left;
if (shouldCaptureInTempVariable(left)) {
const temp = createTempVariable(hoistVariableDeclaration);
cond = createAssignment(temp, left);
}
return createBinary(
cond,
nonAssignmentOperator,
createParen(
createAssignment(
left,
right
)
)
)
}
Debug.fail("unexpected operator: " + operator.kind);
}
} }
} }

View file

@ -259,7 +259,7 @@ namespace ts {
&& kind <= SyntaxKind.LastCompoundAssignment; && kind <= SyntaxKind.LastCompoundAssignment;
} }
export function getNonAssignmentOperatorForCompoundAssignment(kind: CompoundAssignmentOperator): BitwiseOperatorOrHigher { export function getNonAssignmentOperatorForCompoundAssignment(kind: CompoundAssignmentOperator): LogicalOperatorOrHigher | SyntaxKind.QuestionQuestionToken {
switch (kind) { switch (kind) {
case SyntaxKind.PlusEqualsToken: return SyntaxKind.PlusToken; case SyntaxKind.PlusEqualsToken: return SyntaxKind.PlusToken;
case SyntaxKind.MinusEqualsToken: return SyntaxKind.MinusToken; case SyntaxKind.MinusEqualsToken: return SyntaxKind.MinusToken;
@ -273,9 +273,21 @@ namespace ts {
case SyntaxKind.AmpersandEqualsToken: return SyntaxKind.AmpersandToken; case SyntaxKind.AmpersandEqualsToken: return SyntaxKind.AmpersandToken;
case SyntaxKind.BarEqualsToken: return SyntaxKind.BarToken; case SyntaxKind.BarEqualsToken: return SyntaxKind.BarToken;
case SyntaxKind.CaretEqualsToken: return SyntaxKind.CaretToken; case SyntaxKind.CaretEqualsToken: return SyntaxKind.CaretToken;
case SyntaxKind.BarBarEqualsToken: return SyntaxKind.BarBarToken;
case SyntaxKind.AmpersandAmpersandEqualsToken: return SyntaxKind.AmpersandAmpersandToken;
case SyntaxKind.QuestionQuestionEqualsToken: return SyntaxKind.QuestionQuestionToken;
} }
} }
export function shouldCaptureInTempVariable(expression: Expression): boolean {
// don't capture identifiers and `this` in a temporary variable
// `super` cannot be captured as it's no real variable
return !isIdentifier(expression) &&
expression.kind !== SyntaxKind.ThisKeyword &&
expression.kind !== SyntaxKind.SuperKeyword;
}
/** /**
* Adds super call and preceding prologue directives into the list of statements. * Adds super call and preceding prologue directives into the list of statements.
* *

View file

@ -203,6 +203,9 @@ namespace ts {
GreaterThanGreaterThanGreaterThanEqualsToken, GreaterThanGreaterThanGreaterThanEqualsToken,
AmpersandEqualsToken, AmpersandEqualsToken,
BarEqualsToken, BarEqualsToken,
BarBarEqualsToken,
AmpersandAmpersandEqualsToken,
QuestionQuestionEqualsToken,
CaretEqualsToken, CaretEqualsToken,
// Identifiers and PrivateIdentifiers // Identifiers and PrivateIdentifiers
Identifier, Identifier,
@ -1597,6 +1600,9 @@ namespace ts {
| SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.LessThanLessThanEqualsToken
| SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken
| SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken
| SyntaxKind.BarBarEqualsToken
| SyntaxKind.AmpersandAmpersandEqualsToken
| SyntaxKind.QuestionQuestionEqualsToken
; ;
// see: https://tc39.github.io/ecma262/#prod-AssignmentExpression // see: https://tc39.github.io/ecma262/#prod-AssignmentExpression

View file

@ -3220,6 +3220,9 @@ namespace ts {
case SyntaxKind.AmpersandEqualsToken: case SyntaxKind.AmpersandEqualsToken:
case SyntaxKind.CaretEqualsToken: case SyntaxKind.CaretEqualsToken:
case SyntaxKind.BarEqualsToken: case SyntaxKind.BarEqualsToken:
case SyntaxKind.BarBarEqualsToken:
case SyntaxKind.AmpersandAmpersandEqualsToken:
case SyntaxKind.QuestionQuestionEqualsToken:
return Associativity.Right; return Associativity.Right;
} }
} }
@ -3276,6 +3279,9 @@ namespace ts {
case SyntaxKind.AmpersandEqualsToken: case SyntaxKind.AmpersandEqualsToken:
case SyntaxKind.CaretEqualsToken: case SyntaxKind.CaretEqualsToken:
case SyntaxKind.BarEqualsToken: case SyntaxKind.BarEqualsToken:
case SyntaxKind.BarBarEqualsToken:
case SyntaxKind.AmpersandAmpersandEqualsToken:
case SyntaxKind.QuestionQuestionEqualsToken:
return 3; return 3;
default: default:
@ -3372,6 +3378,10 @@ namespace ts {
return 14; return 14;
case SyntaxKind.AsteriskAsteriskToken: case SyntaxKind.AsteriskAsteriskToken:
return 15; return 15;
case SyntaxKind.BarBarEqualsToken:
case SyntaxKind.AmpersandAmpersandEqualsToken:
case SyntaxKind.QuestionQuestionEqualsToken:
return 16;
} }
// -1 is lower than all other precedences. Returning it will cause binary expression // -1 is lower than all other precedences. Returning it will cause binary expression
@ -4444,6 +4454,12 @@ namespace ts {
|| token === SyntaxKind.ExclamationToken; || token === SyntaxKind.ExclamationToken;
} }
export function isLogicalAssignmentOperator(token: SyntaxKind): boolean {
return token === SyntaxKind.BarBarEqualsToken
|| token === SyntaxKind.AmpersandAmpersandEqualsToken
|| token === SyntaxKind.QuestionQuestionEqualsToken;
}
export function isAssignmentOperator(token: SyntaxKind): boolean { export function isAssignmentOperator(token: SyntaxKind): boolean {
return token >= SyntaxKind.FirstAssignment && token <= SyntaxKind.LastAssignment; return token >= SyntaxKind.FirstAssignment && token <= SyntaxKind.LastAssignment;
} }

View file

@ -392,6 +392,9 @@ namespace ts {
case SyntaxKind.EqualsToken: case SyntaxKind.EqualsToken:
case SyntaxKind.CommaToken: case SyntaxKind.CommaToken:
case SyntaxKind.QuestionQuestionToken: case SyntaxKind.QuestionQuestionToken:
case SyntaxKind.BarBarEqualsToken:
case SyntaxKind.AmpersandAmpersandEqualsToken:
case SyntaxKind.QuestionQuestionEqualsToken:
return true; return true;
default: default:
return false; return false;

View file

@ -785,6 +785,12 @@ namespace ts.codefix {
} }
break; break;
case SyntaxKind.BarBarEqualsToken:
case SyntaxKind.QuestionQuestionEqualsToken:
case SyntaxKind.AmpersandAmpersandEqualsToken:
// TODO: infer here
break;
case SyntaxKind.AmpersandAmpersandToken: case SyntaxKind.AmpersandAmpersandToken:
case SyntaxKind.CommaToken: case SyntaxKind.CommaToken:
case SyntaxKind.InstanceOfKeyword: case SyntaxKind.InstanceOfKeyword:

View file

@ -77,6 +77,9 @@ namespace ts {
checkRhs(SyntaxKind.AmpersandAmpersandToken, /*expectParens*/ true); checkRhs(SyntaxKind.AmpersandAmpersandToken, /*expectParens*/ true);
checkRhs(SyntaxKind.QuestionQuestionToken, /*expectParens*/ true); checkRhs(SyntaxKind.QuestionQuestionToken, /*expectParens*/ true);
checkRhs(SyntaxKind.EqualsEqualsToken, /*expectParens*/ true); checkRhs(SyntaxKind.EqualsEqualsToken, /*expectParens*/ true);
checkRhs(SyntaxKind.BarBarEqualsToken, /*expectParens*/ false);
checkRhs(SyntaxKind.AmpersandAmpersandEqualsToken, /*expectParens*/ false);
checkRhs(SyntaxKind.QuestionQuestionEqualsToken, /*expectParens*/ false);
}); });
}); });
}); });

View file

@ -149,280 +149,283 @@ declare namespace ts {
GreaterThanGreaterThanGreaterThanEqualsToken = 71, GreaterThanGreaterThanGreaterThanEqualsToken = 71,
AmpersandEqualsToken = 72, AmpersandEqualsToken = 72,
BarEqualsToken = 73, BarEqualsToken = 73,
CaretEqualsToken = 74, BarBarEqualsToken = 74,
Identifier = 75, AmpersandAmpersandEqualsToken = 75,
PrivateIdentifier = 76, QuestionQuestionEqualsToken = 76,
BreakKeyword = 77, CaretEqualsToken = 77,
CaseKeyword = 78, Identifier = 78,
CatchKeyword = 79, PrivateIdentifier = 79,
ClassKeyword = 80, BreakKeyword = 80,
ConstKeyword = 81, CaseKeyword = 81,
ContinueKeyword = 82, CatchKeyword = 82,
DebuggerKeyword = 83, ClassKeyword = 83,
DefaultKeyword = 84, ConstKeyword = 84,
DeleteKeyword = 85, ContinueKeyword = 85,
DoKeyword = 86, DebuggerKeyword = 86,
ElseKeyword = 87, DefaultKeyword = 87,
EnumKeyword = 88, DeleteKeyword = 88,
ExportKeyword = 89, DoKeyword = 89,
ExtendsKeyword = 90, ElseKeyword = 90,
FalseKeyword = 91, EnumKeyword = 91,
FinallyKeyword = 92, ExportKeyword = 92,
ForKeyword = 93, ExtendsKeyword = 93,
FunctionKeyword = 94, FalseKeyword = 94,
IfKeyword = 95, FinallyKeyword = 95,
ImportKeyword = 96, ForKeyword = 96,
InKeyword = 97, FunctionKeyword = 97,
InstanceOfKeyword = 98, IfKeyword = 98,
NewKeyword = 99, ImportKeyword = 99,
NullKeyword = 100, InKeyword = 100,
ReturnKeyword = 101, InstanceOfKeyword = 101,
SuperKeyword = 102, NewKeyword = 102,
SwitchKeyword = 103, NullKeyword = 103,
ThisKeyword = 104, ReturnKeyword = 104,
ThrowKeyword = 105, SuperKeyword = 105,
TrueKeyword = 106, SwitchKeyword = 106,
TryKeyword = 107, ThisKeyword = 107,
TypeOfKeyword = 108, ThrowKeyword = 108,
VarKeyword = 109, TrueKeyword = 109,
VoidKeyword = 110, TryKeyword = 110,
WhileKeyword = 111, TypeOfKeyword = 111,
WithKeyword = 112, VarKeyword = 112,
ImplementsKeyword = 113, VoidKeyword = 113,
InterfaceKeyword = 114, WhileKeyword = 114,
LetKeyword = 115, WithKeyword = 115,
PackageKeyword = 116, ImplementsKeyword = 116,
PrivateKeyword = 117, InterfaceKeyword = 117,
ProtectedKeyword = 118, LetKeyword = 118,
PublicKeyword = 119, PackageKeyword = 119,
StaticKeyword = 120, PrivateKeyword = 120,
YieldKeyword = 121, ProtectedKeyword = 121,
AbstractKeyword = 122, PublicKeyword = 122,
AsKeyword = 123, StaticKeyword = 123,
AssertsKeyword = 124, YieldKeyword = 124,
AnyKeyword = 125, AbstractKeyword = 125,
AsyncKeyword = 126, AsKeyword = 126,
AwaitKeyword = 127, AssertsKeyword = 127,
BooleanKeyword = 128, AnyKeyword = 128,
ConstructorKeyword = 129, AsyncKeyword = 129,
DeclareKeyword = 130, AwaitKeyword = 130,
GetKeyword = 131, BooleanKeyword = 131,
InferKeyword = 132, ConstructorKeyword = 132,
IsKeyword = 133, DeclareKeyword = 133,
KeyOfKeyword = 134, GetKeyword = 134,
ModuleKeyword = 135, InferKeyword = 135,
NamespaceKeyword = 136, IsKeyword = 136,
NeverKeyword = 137, KeyOfKeyword = 137,
ReadonlyKeyword = 138, ModuleKeyword = 138,
RequireKeyword = 139, NamespaceKeyword = 139,
NumberKeyword = 140, NeverKeyword = 140,
ObjectKeyword = 141, ReadonlyKeyword = 141,
SetKeyword = 142, RequireKeyword = 142,
StringKeyword = 143, NumberKeyword = 143,
SymbolKeyword = 144, ObjectKeyword = 144,
TypeKeyword = 145, SetKeyword = 145,
UndefinedKeyword = 146, StringKeyword = 146,
UniqueKeyword = 147, SymbolKeyword = 147,
UnknownKeyword = 148, TypeKeyword = 148,
FromKeyword = 149, UndefinedKeyword = 149,
GlobalKeyword = 150, UniqueKeyword = 150,
BigIntKeyword = 151, UnknownKeyword = 151,
OfKeyword = 152, FromKeyword = 152,
QualifiedName = 153, GlobalKeyword = 153,
ComputedPropertyName = 154, BigIntKeyword = 154,
TypeParameter = 155, OfKeyword = 155,
Parameter = 156, QualifiedName = 156,
Decorator = 157, ComputedPropertyName = 157,
PropertySignature = 158, TypeParameter = 158,
PropertyDeclaration = 159, Parameter = 159,
MethodSignature = 160, Decorator = 160,
MethodDeclaration = 161, PropertySignature = 161,
Constructor = 162, PropertyDeclaration = 162,
GetAccessor = 163, MethodSignature = 163,
SetAccessor = 164, MethodDeclaration = 164,
CallSignature = 165, Constructor = 165,
ConstructSignature = 166, GetAccessor = 166,
IndexSignature = 167, SetAccessor = 167,
TypePredicate = 168, CallSignature = 168,
TypeReference = 169, ConstructSignature = 169,
FunctionType = 170, IndexSignature = 170,
ConstructorType = 171, TypePredicate = 171,
TypeQuery = 172, TypeReference = 172,
TypeLiteral = 173, FunctionType = 173,
ArrayType = 174, ConstructorType = 174,
TupleType = 175, TypeQuery = 175,
OptionalType = 176, TypeLiteral = 176,
RestType = 177, ArrayType = 177,
UnionType = 178, TupleType = 178,
IntersectionType = 179, OptionalType = 179,
ConditionalType = 180, RestType = 180,
InferType = 181, UnionType = 181,
ParenthesizedType = 182, IntersectionType = 182,
ThisType = 183, ConditionalType = 183,
TypeOperator = 184, InferType = 184,
IndexedAccessType = 185, ParenthesizedType = 185,
MappedType = 186, ThisType = 186,
LiteralType = 187, TypeOperator = 187,
ImportType = 188, IndexedAccessType = 188,
ObjectBindingPattern = 189, MappedType = 189,
ArrayBindingPattern = 190, LiteralType = 190,
BindingElement = 191, ImportType = 191,
ArrayLiteralExpression = 192, ObjectBindingPattern = 192,
ObjectLiteralExpression = 193, ArrayBindingPattern = 193,
PropertyAccessExpression = 194, BindingElement = 194,
ElementAccessExpression = 195, ArrayLiteralExpression = 195,
CallExpression = 196, ObjectLiteralExpression = 196,
NewExpression = 197, PropertyAccessExpression = 197,
TaggedTemplateExpression = 198, ElementAccessExpression = 198,
TypeAssertionExpression = 199, CallExpression = 199,
ParenthesizedExpression = 200, NewExpression = 200,
FunctionExpression = 201, TaggedTemplateExpression = 201,
ArrowFunction = 202, TypeAssertionExpression = 202,
DeleteExpression = 203, ParenthesizedExpression = 203,
TypeOfExpression = 204, FunctionExpression = 204,
VoidExpression = 205, ArrowFunction = 205,
AwaitExpression = 206, DeleteExpression = 206,
PrefixUnaryExpression = 207, TypeOfExpression = 207,
PostfixUnaryExpression = 208, VoidExpression = 208,
BinaryExpression = 209, AwaitExpression = 209,
ConditionalExpression = 210, PrefixUnaryExpression = 210,
TemplateExpression = 211, PostfixUnaryExpression = 211,
YieldExpression = 212, BinaryExpression = 212,
SpreadElement = 213, ConditionalExpression = 213,
ClassExpression = 214, TemplateExpression = 214,
OmittedExpression = 215, YieldExpression = 215,
ExpressionWithTypeArguments = 216, SpreadElement = 216,
AsExpression = 217, ClassExpression = 217,
NonNullExpression = 218, OmittedExpression = 218,
MetaProperty = 219, ExpressionWithTypeArguments = 219,
SyntheticExpression = 220, AsExpression = 220,
TemplateSpan = 221, NonNullExpression = 221,
SemicolonClassElement = 222, MetaProperty = 222,
Block = 223, SyntheticExpression = 223,
EmptyStatement = 224, TemplateSpan = 224,
VariableStatement = 225, SemicolonClassElement = 225,
ExpressionStatement = 226, Block = 226,
IfStatement = 227, EmptyStatement = 227,
DoStatement = 228, VariableStatement = 228,
WhileStatement = 229, ExpressionStatement = 229,
ForStatement = 230, IfStatement = 230,
ForInStatement = 231, DoStatement = 231,
ForOfStatement = 232, WhileStatement = 232,
ContinueStatement = 233, ForStatement = 233,
BreakStatement = 234, ForInStatement = 234,
ReturnStatement = 235, ForOfStatement = 235,
WithStatement = 236, ContinueStatement = 236,
SwitchStatement = 237, BreakStatement = 237,
LabeledStatement = 238, ReturnStatement = 238,
ThrowStatement = 239, WithStatement = 239,
TryStatement = 240, SwitchStatement = 240,
DebuggerStatement = 241, LabeledStatement = 241,
VariableDeclaration = 242, ThrowStatement = 242,
VariableDeclarationList = 243, TryStatement = 243,
FunctionDeclaration = 244, DebuggerStatement = 244,
ClassDeclaration = 245, VariableDeclaration = 245,
InterfaceDeclaration = 246, VariableDeclarationList = 246,
TypeAliasDeclaration = 247, FunctionDeclaration = 247,
EnumDeclaration = 248, ClassDeclaration = 248,
ModuleDeclaration = 249, InterfaceDeclaration = 249,
ModuleBlock = 250, TypeAliasDeclaration = 250,
CaseBlock = 251, EnumDeclaration = 251,
NamespaceExportDeclaration = 252, ModuleDeclaration = 252,
ImportEqualsDeclaration = 253, ModuleBlock = 253,
ImportDeclaration = 254, CaseBlock = 254,
ImportClause = 255, NamespaceExportDeclaration = 255,
NamespaceImport = 256, ImportEqualsDeclaration = 256,
NamedImports = 257, ImportDeclaration = 257,
ImportSpecifier = 258, ImportClause = 258,
ExportAssignment = 259, NamespaceImport = 259,
ExportDeclaration = 260, NamedImports = 260,
NamedExports = 261, ImportSpecifier = 261,
NamespaceExport = 262, ExportAssignment = 262,
ExportSpecifier = 263, ExportDeclaration = 263,
MissingDeclaration = 264, NamedExports = 264,
ExternalModuleReference = 265, NamespaceExport = 265,
JsxElement = 266, ExportSpecifier = 266,
JsxSelfClosingElement = 267, MissingDeclaration = 267,
JsxOpeningElement = 268, ExternalModuleReference = 268,
JsxClosingElement = 269, JsxElement = 269,
JsxFragment = 270, JsxSelfClosingElement = 270,
JsxOpeningFragment = 271, JsxOpeningElement = 271,
JsxClosingFragment = 272, JsxClosingElement = 272,
JsxAttribute = 273, JsxFragment = 273,
JsxAttributes = 274, JsxOpeningFragment = 274,
JsxSpreadAttribute = 275, JsxClosingFragment = 275,
JsxExpression = 276, JsxAttribute = 276,
CaseClause = 277, JsxAttributes = 277,
DefaultClause = 278, JsxSpreadAttribute = 278,
HeritageClause = 279, JsxExpression = 279,
CatchClause = 280, CaseClause = 280,
PropertyAssignment = 281, DefaultClause = 281,
ShorthandPropertyAssignment = 282, HeritageClause = 282,
SpreadAssignment = 283, CatchClause = 283,
EnumMember = 284, PropertyAssignment = 284,
UnparsedPrologue = 285, ShorthandPropertyAssignment = 285,
UnparsedPrepend = 286, SpreadAssignment = 286,
UnparsedText = 287, EnumMember = 287,
UnparsedInternalText = 288, UnparsedPrologue = 288,
UnparsedSyntheticReference = 289, UnparsedPrepend = 289,
SourceFile = 290, UnparsedText = 290,
Bundle = 291, UnparsedInternalText = 291,
UnparsedSource = 292, UnparsedSyntheticReference = 292,
InputFiles = 293, SourceFile = 293,
JSDocTypeExpression = 294, Bundle = 294,
JSDocAllType = 295, UnparsedSource = 295,
JSDocUnknownType = 296, InputFiles = 296,
JSDocNullableType = 297, JSDocTypeExpression = 297,
JSDocNonNullableType = 298, JSDocAllType = 298,
JSDocOptionalType = 299, JSDocUnknownType = 299,
JSDocFunctionType = 300, JSDocNullableType = 300,
JSDocVariadicType = 301, JSDocNonNullableType = 301,
JSDocNamepathType = 302, JSDocOptionalType = 302,
JSDocComment = 303, JSDocFunctionType = 303,
JSDocTypeLiteral = 304, JSDocVariadicType = 304,
JSDocSignature = 305, JSDocNamepathType = 305,
JSDocTag = 306, JSDocComment = 306,
JSDocAugmentsTag = 307, JSDocTypeLiteral = 307,
JSDocImplementsTag = 308, JSDocSignature = 308,
JSDocAuthorTag = 309, JSDocTag = 309,
JSDocClassTag = 310, JSDocAugmentsTag = 310,
JSDocPublicTag = 311, JSDocImplementsTag = 311,
JSDocPrivateTag = 312, JSDocAuthorTag = 312,
JSDocProtectedTag = 313, JSDocClassTag = 313,
JSDocReadonlyTag = 314, JSDocPublicTag = 314,
JSDocCallbackTag = 315, JSDocPrivateTag = 315,
JSDocEnumTag = 316, JSDocProtectedTag = 316,
JSDocParameterTag = 317, JSDocReadonlyTag = 317,
JSDocReturnTag = 318, JSDocCallbackTag = 318,
JSDocThisTag = 319, JSDocEnumTag = 319,
JSDocTypeTag = 320, JSDocParameterTag = 320,
JSDocTemplateTag = 321, JSDocReturnTag = 321,
JSDocTypedefTag = 322, JSDocThisTag = 322,
JSDocPropertyTag = 323, JSDocTypeTag = 323,
SyntaxList = 324, JSDocTemplateTag = 324,
NotEmittedStatement = 325, JSDocTypedefTag = 325,
PartiallyEmittedExpression = 326, JSDocPropertyTag = 326,
CommaListExpression = 327, SyntaxList = 327,
MergeDeclarationMarker = 328, NotEmittedStatement = 328,
EndOfDeclarationMarker = 329, PartiallyEmittedExpression = 329,
SyntheticReferenceExpression = 330, CommaListExpression = 330,
Count = 331, MergeDeclarationMarker = 331,
EndOfDeclarationMarker = 332,
SyntheticReferenceExpression = 333,
Count = 334,
FirstAssignment = 62, FirstAssignment = 62,
LastAssignment = 74, LastAssignment = 77,
FirstCompoundAssignment = 63, FirstCompoundAssignment = 63,
LastCompoundAssignment = 74, LastCompoundAssignment = 77,
FirstReservedWord = 77, FirstReservedWord = 80,
LastReservedWord = 112, LastReservedWord = 115,
FirstKeyword = 77, FirstKeyword = 80,
LastKeyword = 152, LastKeyword = 155,
FirstFutureReservedWord = 113, FirstFutureReservedWord = 116,
LastFutureReservedWord = 121, LastFutureReservedWord = 124,
FirstTypeNode = 168, FirstTypeNode = 171,
LastTypeNode = 188, LastTypeNode = 191,
FirstPunctuation = 18, FirstPunctuation = 18,
LastPunctuation = 74, LastPunctuation = 77,
FirstToken = 0, FirstToken = 0,
LastToken = 152, LastToken = 155,
FirstTriviaToken = 2, FirstTriviaToken = 2,
LastTriviaToken = 7, LastTriviaToken = 7,
FirstLiteralToken = 8, FirstLiteralToken = 8,
@ -430,14 +433,14 @@ declare namespace ts {
FirstTemplateToken = 14, FirstTemplateToken = 14,
LastTemplateToken = 17, LastTemplateToken = 17,
FirstBinaryOperator = 29, FirstBinaryOperator = 29,
LastBinaryOperator = 74, LastBinaryOperator = 77,
FirstStatement = 225, FirstStatement = 228,
LastStatement = 241, LastStatement = 244,
FirstNode = 153, FirstNode = 156,
FirstJSDocNode = 294, FirstJSDocNode = 297,
LastJSDocNode = 323, LastJSDocNode = 326,
FirstJSDocTagNode = 306, FirstJSDocTagNode = 309,
LastJSDocTagNode = 323, LastJSDocTagNode = 326,
} }
export enum NodeFlags { export enum NodeFlags {
None = 0, None = 0,
@ -963,7 +966,7 @@ declare namespace ts {
export type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator; export type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator;
export type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken; export type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken;
export type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator; export type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator;
export type CompoundAssignmentOperator = SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken; export type CompoundAssignmentOperator = SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.BarBarEqualsToken | SyntaxKind.AmpersandAmpersandEqualsToken | SyntaxKind.QuestionQuestionEqualsToken;
export type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator; export type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator;
export type AssignmentOperatorOrHigher = SyntaxKind.QuestionQuestionToken | LogicalOperatorOrHigher | AssignmentOperator; export type AssignmentOperatorOrHigher = SyntaxKind.QuestionQuestionToken | LogicalOperatorOrHigher | AssignmentOperator;
export type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken; export type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken;

View file

@ -149,280 +149,283 @@ declare namespace ts {
GreaterThanGreaterThanGreaterThanEqualsToken = 71, GreaterThanGreaterThanGreaterThanEqualsToken = 71,
AmpersandEqualsToken = 72, AmpersandEqualsToken = 72,
BarEqualsToken = 73, BarEqualsToken = 73,
CaretEqualsToken = 74, BarBarEqualsToken = 74,
Identifier = 75, AmpersandAmpersandEqualsToken = 75,
PrivateIdentifier = 76, QuestionQuestionEqualsToken = 76,
BreakKeyword = 77, CaretEqualsToken = 77,
CaseKeyword = 78, Identifier = 78,
CatchKeyword = 79, PrivateIdentifier = 79,
ClassKeyword = 80, BreakKeyword = 80,
ConstKeyword = 81, CaseKeyword = 81,
ContinueKeyword = 82, CatchKeyword = 82,
DebuggerKeyword = 83, ClassKeyword = 83,
DefaultKeyword = 84, ConstKeyword = 84,
DeleteKeyword = 85, ContinueKeyword = 85,
DoKeyword = 86, DebuggerKeyword = 86,
ElseKeyword = 87, DefaultKeyword = 87,
EnumKeyword = 88, DeleteKeyword = 88,
ExportKeyword = 89, DoKeyword = 89,
ExtendsKeyword = 90, ElseKeyword = 90,
FalseKeyword = 91, EnumKeyword = 91,
FinallyKeyword = 92, ExportKeyword = 92,
ForKeyword = 93, ExtendsKeyword = 93,
FunctionKeyword = 94, FalseKeyword = 94,
IfKeyword = 95, FinallyKeyword = 95,
ImportKeyword = 96, ForKeyword = 96,
InKeyword = 97, FunctionKeyword = 97,
InstanceOfKeyword = 98, IfKeyword = 98,
NewKeyword = 99, ImportKeyword = 99,
NullKeyword = 100, InKeyword = 100,
ReturnKeyword = 101, InstanceOfKeyword = 101,
SuperKeyword = 102, NewKeyword = 102,
SwitchKeyword = 103, NullKeyword = 103,
ThisKeyword = 104, ReturnKeyword = 104,
ThrowKeyword = 105, SuperKeyword = 105,
TrueKeyword = 106, SwitchKeyword = 106,
TryKeyword = 107, ThisKeyword = 107,
TypeOfKeyword = 108, ThrowKeyword = 108,
VarKeyword = 109, TrueKeyword = 109,
VoidKeyword = 110, TryKeyword = 110,
WhileKeyword = 111, TypeOfKeyword = 111,
WithKeyword = 112, VarKeyword = 112,
ImplementsKeyword = 113, VoidKeyword = 113,
InterfaceKeyword = 114, WhileKeyword = 114,
LetKeyword = 115, WithKeyword = 115,
PackageKeyword = 116, ImplementsKeyword = 116,
PrivateKeyword = 117, InterfaceKeyword = 117,
ProtectedKeyword = 118, LetKeyword = 118,
PublicKeyword = 119, PackageKeyword = 119,
StaticKeyword = 120, PrivateKeyword = 120,
YieldKeyword = 121, ProtectedKeyword = 121,
AbstractKeyword = 122, PublicKeyword = 122,
AsKeyword = 123, StaticKeyword = 123,
AssertsKeyword = 124, YieldKeyword = 124,
AnyKeyword = 125, AbstractKeyword = 125,
AsyncKeyword = 126, AsKeyword = 126,
AwaitKeyword = 127, AssertsKeyword = 127,
BooleanKeyword = 128, AnyKeyword = 128,
ConstructorKeyword = 129, AsyncKeyword = 129,
DeclareKeyword = 130, AwaitKeyword = 130,
GetKeyword = 131, BooleanKeyword = 131,
InferKeyword = 132, ConstructorKeyword = 132,
IsKeyword = 133, DeclareKeyword = 133,
KeyOfKeyword = 134, GetKeyword = 134,
ModuleKeyword = 135, InferKeyword = 135,
NamespaceKeyword = 136, IsKeyword = 136,
NeverKeyword = 137, KeyOfKeyword = 137,
ReadonlyKeyword = 138, ModuleKeyword = 138,
RequireKeyword = 139, NamespaceKeyword = 139,
NumberKeyword = 140, NeverKeyword = 140,
ObjectKeyword = 141, ReadonlyKeyword = 141,
SetKeyword = 142, RequireKeyword = 142,
StringKeyword = 143, NumberKeyword = 143,
SymbolKeyword = 144, ObjectKeyword = 144,
TypeKeyword = 145, SetKeyword = 145,
UndefinedKeyword = 146, StringKeyword = 146,
UniqueKeyword = 147, SymbolKeyword = 147,
UnknownKeyword = 148, TypeKeyword = 148,
FromKeyword = 149, UndefinedKeyword = 149,
GlobalKeyword = 150, UniqueKeyword = 150,
BigIntKeyword = 151, UnknownKeyword = 151,
OfKeyword = 152, FromKeyword = 152,
QualifiedName = 153, GlobalKeyword = 153,
ComputedPropertyName = 154, BigIntKeyword = 154,
TypeParameter = 155, OfKeyword = 155,
Parameter = 156, QualifiedName = 156,
Decorator = 157, ComputedPropertyName = 157,
PropertySignature = 158, TypeParameter = 158,
PropertyDeclaration = 159, Parameter = 159,
MethodSignature = 160, Decorator = 160,
MethodDeclaration = 161, PropertySignature = 161,
Constructor = 162, PropertyDeclaration = 162,
GetAccessor = 163, MethodSignature = 163,
SetAccessor = 164, MethodDeclaration = 164,
CallSignature = 165, Constructor = 165,
ConstructSignature = 166, GetAccessor = 166,
IndexSignature = 167, SetAccessor = 167,
TypePredicate = 168, CallSignature = 168,
TypeReference = 169, ConstructSignature = 169,
FunctionType = 170, IndexSignature = 170,
ConstructorType = 171, TypePredicate = 171,
TypeQuery = 172, TypeReference = 172,
TypeLiteral = 173, FunctionType = 173,
ArrayType = 174, ConstructorType = 174,
TupleType = 175, TypeQuery = 175,
OptionalType = 176, TypeLiteral = 176,
RestType = 177, ArrayType = 177,
UnionType = 178, TupleType = 178,
IntersectionType = 179, OptionalType = 179,
ConditionalType = 180, RestType = 180,
InferType = 181, UnionType = 181,
ParenthesizedType = 182, IntersectionType = 182,
ThisType = 183, ConditionalType = 183,
TypeOperator = 184, InferType = 184,
IndexedAccessType = 185, ParenthesizedType = 185,
MappedType = 186, ThisType = 186,
LiteralType = 187, TypeOperator = 187,
ImportType = 188, IndexedAccessType = 188,
ObjectBindingPattern = 189, MappedType = 189,
ArrayBindingPattern = 190, LiteralType = 190,
BindingElement = 191, ImportType = 191,
ArrayLiteralExpression = 192, ObjectBindingPattern = 192,
ObjectLiteralExpression = 193, ArrayBindingPattern = 193,
PropertyAccessExpression = 194, BindingElement = 194,
ElementAccessExpression = 195, ArrayLiteralExpression = 195,
CallExpression = 196, ObjectLiteralExpression = 196,
NewExpression = 197, PropertyAccessExpression = 197,
TaggedTemplateExpression = 198, ElementAccessExpression = 198,
TypeAssertionExpression = 199, CallExpression = 199,
ParenthesizedExpression = 200, NewExpression = 200,
FunctionExpression = 201, TaggedTemplateExpression = 201,
ArrowFunction = 202, TypeAssertionExpression = 202,
DeleteExpression = 203, ParenthesizedExpression = 203,
TypeOfExpression = 204, FunctionExpression = 204,
VoidExpression = 205, ArrowFunction = 205,
AwaitExpression = 206, DeleteExpression = 206,
PrefixUnaryExpression = 207, TypeOfExpression = 207,
PostfixUnaryExpression = 208, VoidExpression = 208,
BinaryExpression = 209, AwaitExpression = 209,
ConditionalExpression = 210, PrefixUnaryExpression = 210,
TemplateExpression = 211, PostfixUnaryExpression = 211,
YieldExpression = 212, BinaryExpression = 212,
SpreadElement = 213, ConditionalExpression = 213,
ClassExpression = 214, TemplateExpression = 214,
OmittedExpression = 215, YieldExpression = 215,
ExpressionWithTypeArguments = 216, SpreadElement = 216,
AsExpression = 217, ClassExpression = 217,
NonNullExpression = 218, OmittedExpression = 218,
MetaProperty = 219, ExpressionWithTypeArguments = 219,
SyntheticExpression = 220, AsExpression = 220,
TemplateSpan = 221, NonNullExpression = 221,
SemicolonClassElement = 222, MetaProperty = 222,
Block = 223, SyntheticExpression = 223,
EmptyStatement = 224, TemplateSpan = 224,
VariableStatement = 225, SemicolonClassElement = 225,
ExpressionStatement = 226, Block = 226,
IfStatement = 227, EmptyStatement = 227,
DoStatement = 228, VariableStatement = 228,
WhileStatement = 229, ExpressionStatement = 229,
ForStatement = 230, IfStatement = 230,
ForInStatement = 231, DoStatement = 231,
ForOfStatement = 232, WhileStatement = 232,
ContinueStatement = 233, ForStatement = 233,
BreakStatement = 234, ForInStatement = 234,
ReturnStatement = 235, ForOfStatement = 235,
WithStatement = 236, ContinueStatement = 236,
SwitchStatement = 237, BreakStatement = 237,
LabeledStatement = 238, ReturnStatement = 238,
ThrowStatement = 239, WithStatement = 239,
TryStatement = 240, SwitchStatement = 240,
DebuggerStatement = 241, LabeledStatement = 241,
VariableDeclaration = 242, ThrowStatement = 242,
VariableDeclarationList = 243, TryStatement = 243,
FunctionDeclaration = 244, DebuggerStatement = 244,
ClassDeclaration = 245, VariableDeclaration = 245,
InterfaceDeclaration = 246, VariableDeclarationList = 246,
TypeAliasDeclaration = 247, FunctionDeclaration = 247,
EnumDeclaration = 248, ClassDeclaration = 248,
ModuleDeclaration = 249, InterfaceDeclaration = 249,
ModuleBlock = 250, TypeAliasDeclaration = 250,
CaseBlock = 251, EnumDeclaration = 251,
NamespaceExportDeclaration = 252, ModuleDeclaration = 252,
ImportEqualsDeclaration = 253, ModuleBlock = 253,
ImportDeclaration = 254, CaseBlock = 254,
ImportClause = 255, NamespaceExportDeclaration = 255,
NamespaceImport = 256, ImportEqualsDeclaration = 256,
NamedImports = 257, ImportDeclaration = 257,
ImportSpecifier = 258, ImportClause = 258,
ExportAssignment = 259, NamespaceImport = 259,
ExportDeclaration = 260, NamedImports = 260,
NamedExports = 261, ImportSpecifier = 261,
NamespaceExport = 262, ExportAssignment = 262,
ExportSpecifier = 263, ExportDeclaration = 263,
MissingDeclaration = 264, NamedExports = 264,
ExternalModuleReference = 265, NamespaceExport = 265,
JsxElement = 266, ExportSpecifier = 266,
JsxSelfClosingElement = 267, MissingDeclaration = 267,
JsxOpeningElement = 268, ExternalModuleReference = 268,
JsxClosingElement = 269, JsxElement = 269,
JsxFragment = 270, JsxSelfClosingElement = 270,
JsxOpeningFragment = 271, JsxOpeningElement = 271,
JsxClosingFragment = 272, JsxClosingElement = 272,
JsxAttribute = 273, JsxFragment = 273,
JsxAttributes = 274, JsxOpeningFragment = 274,
JsxSpreadAttribute = 275, JsxClosingFragment = 275,
JsxExpression = 276, JsxAttribute = 276,
CaseClause = 277, JsxAttributes = 277,
DefaultClause = 278, JsxSpreadAttribute = 278,
HeritageClause = 279, JsxExpression = 279,
CatchClause = 280, CaseClause = 280,
PropertyAssignment = 281, DefaultClause = 281,
ShorthandPropertyAssignment = 282, HeritageClause = 282,
SpreadAssignment = 283, CatchClause = 283,
EnumMember = 284, PropertyAssignment = 284,
UnparsedPrologue = 285, ShorthandPropertyAssignment = 285,
UnparsedPrepend = 286, SpreadAssignment = 286,
UnparsedText = 287, EnumMember = 287,
UnparsedInternalText = 288, UnparsedPrologue = 288,
UnparsedSyntheticReference = 289, UnparsedPrepend = 289,
SourceFile = 290, UnparsedText = 290,
Bundle = 291, UnparsedInternalText = 291,
UnparsedSource = 292, UnparsedSyntheticReference = 292,
InputFiles = 293, SourceFile = 293,
JSDocTypeExpression = 294, Bundle = 294,
JSDocAllType = 295, UnparsedSource = 295,
JSDocUnknownType = 296, InputFiles = 296,
JSDocNullableType = 297, JSDocTypeExpression = 297,
JSDocNonNullableType = 298, JSDocAllType = 298,
JSDocOptionalType = 299, JSDocUnknownType = 299,
JSDocFunctionType = 300, JSDocNullableType = 300,
JSDocVariadicType = 301, JSDocNonNullableType = 301,
JSDocNamepathType = 302, JSDocOptionalType = 302,
JSDocComment = 303, JSDocFunctionType = 303,
JSDocTypeLiteral = 304, JSDocVariadicType = 304,
JSDocSignature = 305, JSDocNamepathType = 305,
JSDocTag = 306, JSDocComment = 306,
JSDocAugmentsTag = 307, JSDocTypeLiteral = 307,
JSDocImplementsTag = 308, JSDocSignature = 308,
JSDocAuthorTag = 309, JSDocTag = 309,
JSDocClassTag = 310, JSDocAugmentsTag = 310,
JSDocPublicTag = 311, JSDocImplementsTag = 311,
JSDocPrivateTag = 312, JSDocAuthorTag = 312,
JSDocProtectedTag = 313, JSDocClassTag = 313,
JSDocReadonlyTag = 314, JSDocPublicTag = 314,
JSDocCallbackTag = 315, JSDocPrivateTag = 315,
JSDocEnumTag = 316, JSDocProtectedTag = 316,
JSDocParameterTag = 317, JSDocReadonlyTag = 317,
JSDocReturnTag = 318, JSDocCallbackTag = 318,
JSDocThisTag = 319, JSDocEnumTag = 319,
JSDocTypeTag = 320, JSDocParameterTag = 320,
JSDocTemplateTag = 321, JSDocReturnTag = 321,
JSDocTypedefTag = 322, JSDocThisTag = 322,
JSDocPropertyTag = 323, JSDocTypeTag = 323,
SyntaxList = 324, JSDocTemplateTag = 324,
NotEmittedStatement = 325, JSDocTypedefTag = 325,
PartiallyEmittedExpression = 326, JSDocPropertyTag = 326,
CommaListExpression = 327, SyntaxList = 327,
MergeDeclarationMarker = 328, NotEmittedStatement = 328,
EndOfDeclarationMarker = 329, PartiallyEmittedExpression = 329,
SyntheticReferenceExpression = 330, CommaListExpression = 330,
Count = 331, MergeDeclarationMarker = 331,
EndOfDeclarationMarker = 332,
SyntheticReferenceExpression = 333,
Count = 334,
FirstAssignment = 62, FirstAssignment = 62,
LastAssignment = 74, LastAssignment = 77,
FirstCompoundAssignment = 63, FirstCompoundAssignment = 63,
LastCompoundAssignment = 74, LastCompoundAssignment = 77,
FirstReservedWord = 77, FirstReservedWord = 80,
LastReservedWord = 112, LastReservedWord = 115,
FirstKeyword = 77, FirstKeyword = 80,
LastKeyword = 152, LastKeyword = 155,
FirstFutureReservedWord = 113, FirstFutureReservedWord = 116,
LastFutureReservedWord = 121, LastFutureReservedWord = 124,
FirstTypeNode = 168, FirstTypeNode = 171,
LastTypeNode = 188, LastTypeNode = 191,
FirstPunctuation = 18, FirstPunctuation = 18,
LastPunctuation = 74, LastPunctuation = 77,
FirstToken = 0, FirstToken = 0,
LastToken = 152, LastToken = 155,
FirstTriviaToken = 2, FirstTriviaToken = 2,
LastTriviaToken = 7, LastTriviaToken = 7,
FirstLiteralToken = 8, FirstLiteralToken = 8,
@ -430,14 +433,14 @@ declare namespace ts {
FirstTemplateToken = 14, FirstTemplateToken = 14,
LastTemplateToken = 17, LastTemplateToken = 17,
FirstBinaryOperator = 29, FirstBinaryOperator = 29,
LastBinaryOperator = 74, LastBinaryOperator = 77,
FirstStatement = 225, FirstStatement = 228,
LastStatement = 241, LastStatement = 244,
FirstNode = 153, FirstNode = 156,
FirstJSDocNode = 294, FirstJSDocNode = 297,
LastJSDocNode = 323, LastJSDocNode = 326,
FirstJSDocTagNode = 306, FirstJSDocTagNode = 309,
LastJSDocTagNode = 323, LastJSDocTagNode = 326,
} }
export enum NodeFlags { export enum NodeFlags {
None = 0, None = 0,
@ -963,7 +966,7 @@ declare namespace ts {
export type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator; export type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator;
export type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken; export type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken;
export type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator; export type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator;
export type CompoundAssignmentOperator = SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken; export type CompoundAssignmentOperator = SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.BarBarEqualsToken | SyntaxKind.AmpersandAmpersandEqualsToken | SyntaxKind.QuestionQuestionEqualsToken;
export type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator; export type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator;
export type AssignmentOperatorOrHigher = SyntaxKind.QuestionQuestionToken | LogicalOperatorOrHigher | AssignmentOperator; export type AssignmentOperatorOrHigher = SyntaxKind.QuestionQuestionToken | LogicalOperatorOrHigher | AssignmentOperator;
export type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken; export type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken;

View file

@ -0,0 +1,39 @@
//// [logicalAssignment1.ts]
declare let a: string | undefined
declare let b: string | undefined
declare let c: string | undefined
declare let d: number | undefined
declare let e: number | undefined
declare let f: number | undefined
declare let g: 0 | 1 | 42
declare let h: 0 | 1 | 42
declare let i: 0 | 1 | 42
a &&= "foo"
b ||= "foo"
c ??= "foo"
d &&= 42
e ||= 42
f ??= 42
g &&= 42
h ||= 42
i ??= 42
//// [logicalAssignment1.js]
"use strict";
a && (a = "foo");
b || (b = "foo");
c !== null && c !== void 0 ? c : (c = "foo");
d && (d = 42);
e || (e = 42);
f !== null && f !== void 0 ? f : (f = 42);
g && (g = 42);
h || (h = 42);
i !== null && i !== void 0 ? i : (i = 42);

View file

@ -0,0 +1,57 @@
=== tests/cases/conformance/esnext/logicalAssignment/logicalAssignment1.ts ===
declare let a: string | undefined
>a : Symbol(a, Decl(logicalAssignment1.ts, 0, 11))
declare let b: string | undefined
>b : Symbol(b, Decl(logicalAssignment1.ts, 1, 11))
declare let c: string | undefined
>c : Symbol(c, Decl(logicalAssignment1.ts, 2, 11))
declare let d: number | undefined
>d : Symbol(d, Decl(logicalAssignment1.ts, 4, 11))
declare let e: number | undefined
>e : Symbol(e, Decl(logicalAssignment1.ts, 5, 11))
declare let f: number | undefined
>f : Symbol(f, Decl(logicalAssignment1.ts, 6, 11))
declare let g: 0 | 1 | 42
>g : Symbol(g, Decl(logicalAssignment1.ts, 8, 11))
declare let h: 0 | 1 | 42
>h : Symbol(h, Decl(logicalAssignment1.ts, 9, 11))
declare let i: 0 | 1 | 42
>i : Symbol(i, Decl(logicalAssignment1.ts, 10, 11))
a &&= "foo"
>a : Symbol(a, Decl(logicalAssignment1.ts, 0, 11))
b ||= "foo"
>b : Symbol(b, Decl(logicalAssignment1.ts, 1, 11))
c ??= "foo"
>c : Symbol(c, Decl(logicalAssignment1.ts, 2, 11))
d &&= 42
>d : Symbol(d, Decl(logicalAssignment1.ts, 4, 11))
e ||= 42
>e : Symbol(e, Decl(logicalAssignment1.ts, 5, 11))
f ??= 42
>f : Symbol(f, Decl(logicalAssignment1.ts, 6, 11))
g &&= 42
>g : Symbol(g, Decl(logicalAssignment1.ts, 8, 11))
h ||= 42
>h : Symbol(h, Decl(logicalAssignment1.ts, 9, 11))
i ??= 42
>i : Symbol(i, Decl(logicalAssignment1.ts, 10, 11))

View file

@ -0,0 +1,75 @@
=== tests/cases/conformance/esnext/logicalAssignment/logicalAssignment1.ts ===
declare let a: string | undefined
>a : string | undefined
declare let b: string | undefined
>b : string | undefined
declare let c: string | undefined
>c : string | undefined
declare let d: number | undefined
>d : number | undefined
declare let e: number | undefined
>e : number | undefined
declare let f: number | undefined
>f : number | undefined
declare let g: 0 | 1 | 42
>g : 0 | 1 | 42
declare let h: 0 | 1 | 42
>h : 0 | 1 | 42
declare let i: 0 | 1 | 42
>i : 0 | 1 | 42
a &&= "foo"
>a &&= "foo" : "" | "foo" | undefined
>a : string | undefined
>"foo" : "foo"
b ||= "foo"
>b ||= "foo" : string
>b : string | undefined
>"foo" : "foo"
c ??= "foo"
>c ??= "foo" : string
>c : string | undefined
>"foo" : "foo"
d &&= 42
>d &&= 42 : 0 | 42 | undefined
>d : number | undefined
>42 : 42
e ||= 42
>e ||= 42 : number
>e : number | undefined
>42 : 42
f ??= 42
>f ??= 42 : number
>f : number | undefined
>42 : 42
g &&= 42
>g &&= 42 : 0 | 42
>g : number
>42 : 42
h ||= 42
>h ||= 42 : number
>h : number
>42 : 42
i ??= 42
>i ??= 42 : number
>i : number
>42 : 42

View file

@ -0,0 +1,39 @@
//// [logicalAssignment1.ts]
declare let a: string | undefined
declare let b: string | undefined
declare let c: string | undefined
declare let d: number | undefined
declare let e: number | undefined
declare let f: number | undefined
declare let g: 0 | 1 | 42
declare let h: 0 | 1 | 42
declare let i: 0 | 1 | 42
a &&= "foo"
b ||= "foo"
c ??= "foo"
d &&= 42
e ||= 42
f ??= 42
g &&= 42
h ||= 42
i ??= 42
//// [logicalAssignment1.js]
"use strict";
a && (a = "foo");
b || (b = "foo");
c ?? (c = "foo");
d && (d = 42);
e || (e = 42);
f ?? (f = 42);
g && (g = 42);
h || (h = 42);
i ?? (i = 42);

View file

@ -0,0 +1,57 @@
=== tests/cases/conformance/esnext/logicalAssignment/logicalAssignment1.ts ===
declare let a: string | undefined
>a : Symbol(a, Decl(logicalAssignment1.ts, 0, 11))
declare let b: string | undefined
>b : Symbol(b, Decl(logicalAssignment1.ts, 1, 11))
declare let c: string | undefined
>c : Symbol(c, Decl(logicalAssignment1.ts, 2, 11))
declare let d: number | undefined
>d : Symbol(d, Decl(logicalAssignment1.ts, 4, 11))
declare let e: number | undefined
>e : Symbol(e, Decl(logicalAssignment1.ts, 5, 11))
declare let f: number | undefined
>f : Symbol(f, Decl(logicalAssignment1.ts, 6, 11))
declare let g: 0 | 1 | 42
>g : Symbol(g, Decl(logicalAssignment1.ts, 8, 11))
declare let h: 0 | 1 | 42
>h : Symbol(h, Decl(logicalAssignment1.ts, 9, 11))
declare let i: 0 | 1 | 42
>i : Symbol(i, Decl(logicalAssignment1.ts, 10, 11))
a &&= "foo"
>a : Symbol(a, Decl(logicalAssignment1.ts, 0, 11))
b ||= "foo"
>b : Symbol(b, Decl(logicalAssignment1.ts, 1, 11))
c ??= "foo"
>c : Symbol(c, Decl(logicalAssignment1.ts, 2, 11))
d &&= 42
>d : Symbol(d, Decl(logicalAssignment1.ts, 4, 11))
e ||= 42
>e : Symbol(e, Decl(logicalAssignment1.ts, 5, 11))
f ??= 42
>f : Symbol(f, Decl(logicalAssignment1.ts, 6, 11))
g &&= 42
>g : Symbol(g, Decl(logicalAssignment1.ts, 8, 11))
h ||= 42
>h : Symbol(h, Decl(logicalAssignment1.ts, 9, 11))
i ??= 42
>i : Symbol(i, Decl(logicalAssignment1.ts, 10, 11))

View file

@ -0,0 +1,75 @@
=== tests/cases/conformance/esnext/logicalAssignment/logicalAssignment1.ts ===
declare let a: string | undefined
>a : string | undefined
declare let b: string | undefined
>b : string | undefined
declare let c: string | undefined
>c : string | undefined
declare let d: number | undefined
>d : number | undefined
declare let e: number | undefined
>e : number | undefined
declare let f: number | undefined
>f : number | undefined
declare let g: 0 | 1 | 42
>g : 0 | 1 | 42
declare let h: 0 | 1 | 42
>h : 0 | 1 | 42
declare let i: 0 | 1 | 42
>i : 0 | 1 | 42
a &&= "foo"
>a &&= "foo" : "" | "foo" | undefined
>a : string | undefined
>"foo" : "foo"
b ||= "foo"
>b ||= "foo" : string
>b : string | undefined
>"foo" : "foo"
c ??= "foo"
>c ??= "foo" : string
>c : string | undefined
>"foo" : "foo"
d &&= 42
>d &&= 42 : 0 | 42 | undefined
>d : number | undefined
>42 : 42
e ||= 42
>e ||= 42 : number
>e : number | undefined
>42 : 42
f ??= 42
>f ??= 42 : number
>f : number | undefined
>42 : 42
g &&= 42
>g &&= 42 : 0 | 42
>g : number
>42 : 42
h ||= 42
>h ||= 42 : number
>h : number
>42 : 42
i ??= 42
>i ??= 42 : number
>i : number
>42 : 42

View file

@ -0,0 +1,39 @@
//// [logicalAssignment1.ts]
declare let a: string | undefined
declare let b: string | undefined
declare let c: string | undefined
declare let d: number | undefined
declare let e: number | undefined
declare let f: number | undefined
declare let g: 0 | 1 | 42
declare let h: 0 | 1 | 42
declare let i: 0 | 1 | 42
a &&= "foo"
b ||= "foo"
c ??= "foo"
d &&= 42
e ||= 42
f ??= 42
g &&= 42
h ||= 42
i ??= 42
//// [logicalAssignment1.js]
"use strict";
a &&= "foo";
b ||= "foo";
c ??= "foo";
d &&= 42;
e ||= 42;
f ??= 42;
g &&= 42;
h ||= 42;
i ??= 42;

View file

@ -0,0 +1,57 @@
=== tests/cases/conformance/esnext/logicalAssignment/logicalAssignment1.ts ===
declare let a: string | undefined
>a : Symbol(a, Decl(logicalAssignment1.ts, 0, 11))
declare let b: string | undefined
>b : Symbol(b, Decl(logicalAssignment1.ts, 1, 11))
declare let c: string | undefined
>c : Symbol(c, Decl(logicalAssignment1.ts, 2, 11))
declare let d: number | undefined
>d : Symbol(d, Decl(logicalAssignment1.ts, 4, 11))
declare let e: number | undefined
>e : Symbol(e, Decl(logicalAssignment1.ts, 5, 11))
declare let f: number | undefined
>f : Symbol(f, Decl(logicalAssignment1.ts, 6, 11))
declare let g: 0 | 1 | 42
>g : Symbol(g, Decl(logicalAssignment1.ts, 8, 11))
declare let h: 0 | 1 | 42
>h : Symbol(h, Decl(logicalAssignment1.ts, 9, 11))
declare let i: 0 | 1 | 42
>i : Symbol(i, Decl(logicalAssignment1.ts, 10, 11))
a &&= "foo"
>a : Symbol(a, Decl(logicalAssignment1.ts, 0, 11))
b ||= "foo"
>b : Symbol(b, Decl(logicalAssignment1.ts, 1, 11))
c ??= "foo"
>c : Symbol(c, Decl(logicalAssignment1.ts, 2, 11))
d &&= 42
>d : Symbol(d, Decl(logicalAssignment1.ts, 4, 11))
e ||= 42
>e : Symbol(e, Decl(logicalAssignment1.ts, 5, 11))
f ??= 42
>f : Symbol(f, Decl(logicalAssignment1.ts, 6, 11))
g &&= 42
>g : Symbol(g, Decl(logicalAssignment1.ts, 8, 11))
h ||= 42
>h : Symbol(h, Decl(logicalAssignment1.ts, 9, 11))
i ??= 42
>i : Symbol(i, Decl(logicalAssignment1.ts, 10, 11))

View file

@ -0,0 +1,75 @@
=== tests/cases/conformance/esnext/logicalAssignment/logicalAssignment1.ts ===
declare let a: string | undefined
>a : string | undefined
declare let b: string | undefined
>b : string | undefined
declare let c: string | undefined
>c : string | undefined
declare let d: number | undefined
>d : number | undefined
declare let e: number | undefined
>e : number | undefined
declare let f: number | undefined
>f : number | undefined
declare let g: 0 | 1 | 42
>g : 0 | 1 | 42
declare let h: 0 | 1 | 42
>h : 0 | 1 | 42
declare let i: 0 | 1 | 42
>i : 0 | 1 | 42
a &&= "foo"
>a &&= "foo" : "" | "foo" | undefined
>a : string | undefined
>"foo" : "foo"
b ||= "foo"
>b ||= "foo" : string
>b : string | undefined
>"foo" : "foo"
c ??= "foo"
>c ??= "foo" : string
>c : string | undefined
>"foo" : "foo"
d &&= 42
>d &&= 42 : 0 | 42 | undefined
>d : number | undefined
>42 : 42
e ||= 42
>e ||= 42 : number
>e : number | undefined
>42 : 42
f ??= 42
>f ??= 42 : number
>f : number | undefined
>42 : 42
g &&= 42
>g &&= 42 : 0 | 42
>g : number
>42 : 42
h ||= 42
>h ||= 42 : number
>h : number
>42 : 42
i ??= 42
>i ??= 42 : number
>i : number
>42 : 42

View file

@ -0,0 +1,27 @@
// @strict: true
// @target: esnext, es2020, es2015
declare let a: string | undefined
declare let b: string | undefined
declare let c: string | undefined
declare let d: number | undefined
declare let e: number | undefined
declare let f: number | undefined
declare let g: 0 | 1 | 42
declare let h: 0 | 1 | 42
declare let i: 0 | 1 | 42
a &&= "foo"
b ||= "foo"
c ??= "foo"
d &&= 42
e ||= 42
f ??= 42
g &&= 42
h ||= 42
i ??= 42