Add logical assignment operator
This commit is contained in:
parent
33c3e9e2c6
commit
1d93db81cc
|
@ -3601,6 +3601,9 @@ namespace ts {
|
|||
if (operatorTokenKind === SyntaxKind.QuestionQuestionToken) {
|
||||
transformFlags |= TransformFlags.AssertES2020;
|
||||
}
|
||||
else if (isLogicalAssignmentOperator(operatorTokenKind)) {
|
||||
transformFlags |= TransformFlags.AssertESNext;
|
||||
}
|
||||
else if (operatorTokenKind === SyntaxKind.EqualsToken && leftKind === SyntaxKind.ObjectLiteralExpression) {
|
||||
// Destructuring object assignments with are ES2015 syntax
|
||||
// and possibly ES2018 if they contain rest
|
||||
|
|
|
@ -28579,17 +28579,35 @@ namespace ts {
|
|||
case SyntaxKind.InKeyword:
|
||||
return checkInExpression(left, right, leftType, rightType);
|
||||
case SyntaxKind.AmpersandAmpersandToken:
|
||||
return getTypeFacts(leftType) & TypeFacts.Truthy ?
|
||||
case SyntaxKind.AmpersandAmpersandEqualsToken: {
|
||||
const resultType = getTypeFacts(leftType) & TypeFacts.Truthy ?
|
||||
getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) :
|
||||
leftType;
|
||||
if (operator === SyntaxKind.AmpersandAmpersandEqualsToken) {
|
||||
checkAssignmentOperator(resultType);
|
||||
}
|
||||
return resultType;
|
||||
}
|
||||
case SyntaxKind.BarBarToken:
|
||||
return getTypeFacts(leftType) & TypeFacts.Falsy ?
|
||||
case SyntaxKind.BarBarEqualsToken: {
|
||||
const resultType = getTypeFacts(leftType) & TypeFacts.Falsy ?
|
||||
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], UnionReduction.Subtype) :
|
||||
leftType;
|
||||
if (operator === SyntaxKind.BarBarEqualsToken) {
|
||||
checkAssignmentOperator(resultType);
|
||||
}
|
||||
return resultType;
|
||||
}
|
||||
case SyntaxKind.QuestionQuestionToken:
|
||||
return getTypeFacts(leftType) & TypeFacts.EQUndefinedOrNull ?
|
||||
case SyntaxKind.QuestionQuestionEqualsToken: {
|
||||
const resultType = getTypeFacts(leftType) & TypeFacts.EQUndefinedOrNull ?
|
||||
getUnionType([getNonNullableType(leftType), rightType], UnionReduction.Subtype) :
|
||||
leftType;
|
||||
if (operator === SyntaxKind.QuestionQuestionEqualsToken) {
|
||||
checkAssignmentOperator(resultType);
|
||||
}
|
||||
return resultType;
|
||||
}
|
||||
case SyntaxKind.EqualsToken:
|
||||
const declKind = isBinaryExpression(left.parent) ? getAssignmentDeclarationKind(left.parent) : AssignmentDeclarationKind.None;
|
||||
checkAssignmentDeclaration(declKind, rightType);
|
||||
|
|
|
@ -208,6 +208,9 @@ namespace ts {
|
|||
"&=": SyntaxKind.AmpersandEqualsToken,
|
||||
"|=": SyntaxKind.BarEqualsToken,
|
||||
"^=": SyntaxKind.CaretEqualsToken,
|
||||
"||=": SyntaxKind.BarBarEqualsToken,
|
||||
"&&=": SyntaxKind.AmpersandAmpersandEqualsToken,
|
||||
"??=": SyntaxKind.QuestionQuestionEqualsToken,
|
||||
"@": SyntaxKind.AtToken,
|
||||
"`": SyntaxKind.BacktickToken
|
||||
});
|
||||
|
@ -1667,6 +1670,9 @@ namespace ts {
|
|||
return token = SyntaxKind.PercentToken;
|
||||
case 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;
|
||||
}
|
||||
if (text.charCodeAt(pos + 1) === CharacterCodes.equals) {
|
||||
|
@ -1928,15 +1934,16 @@ namespace ts {
|
|||
pos++;
|
||||
return token = SyntaxKind.GreaterThanToken;
|
||||
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++;
|
||||
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;
|
||||
case CharacterCodes.openBracket:
|
||||
pos++;
|
||||
|
@ -1965,6 +1972,9 @@ namespace ts {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
if (text.charCodeAt(pos + 1) === CharacterCodes.equals) {
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
/*@internal*/
|
||||
namespace ts {
|
||||
export function transformESNext(context: TransformationContext) {
|
||||
const {
|
||||
hoistVariableDeclaration
|
||||
} = context;
|
||||
|
||||
return chainBundle(transformSourceFile);
|
||||
|
||||
function transformSourceFile(node: SourceFile) {
|
||||
|
@ -16,9 +20,42 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.BinaryExpression:
|
||||
const binaryExpression = <BinaryExpression>node;
|
||||
if (isLogicalAssignmentOperator(binaryExpression.operatorToken.kind)) {
|
||||
return transformLogicalAssignmentOperators(binaryExpression);
|
||||
}
|
||||
// falls through
|
||||
default:
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -259,7 +259,7 @@ namespace ts {
|
|||
&& kind <= SyntaxKind.LastCompoundAssignment;
|
||||
}
|
||||
|
||||
export function getNonAssignmentOperatorForCompoundAssignment(kind: CompoundAssignmentOperator): BitwiseOperatorOrHigher {
|
||||
export function getNonAssignmentOperatorForCompoundAssignment(kind: CompoundAssignmentOperator): LogicalOperatorOrHigher | SyntaxKind.QuestionQuestionToken {
|
||||
switch (kind) {
|
||||
case SyntaxKind.PlusEqualsToken: return SyntaxKind.PlusToken;
|
||||
case SyntaxKind.MinusEqualsToken: return SyntaxKind.MinusToken;
|
||||
|
@ -273,9 +273,21 @@ namespace ts {
|
|||
case SyntaxKind.AmpersandEqualsToken: return SyntaxKind.AmpersandToken;
|
||||
case SyntaxKind.BarEqualsToken: return SyntaxKind.BarToken;
|
||||
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.
|
||||
*
|
||||
|
|
|
@ -203,6 +203,9 @@ namespace ts {
|
|||
GreaterThanGreaterThanGreaterThanEqualsToken,
|
||||
AmpersandEqualsToken,
|
||||
BarEqualsToken,
|
||||
BarBarEqualsToken,
|
||||
AmpersandAmpersandEqualsToken,
|
||||
QuestionQuestionEqualsToken,
|
||||
CaretEqualsToken,
|
||||
// Identifiers and PrivateIdentifiers
|
||||
Identifier,
|
||||
|
@ -1597,6 +1600,9 @@ namespace ts {
|
|||
| SyntaxKind.LessThanLessThanEqualsToken
|
||||
| SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken
|
||||
| SyntaxKind.GreaterThanGreaterThanEqualsToken
|
||||
| SyntaxKind.BarBarEqualsToken
|
||||
| SyntaxKind.AmpersandAmpersandEqualsToken
|
||||
| SyntaxKind.QuestionQuestionEqualsToken
|
||||
;
|
||||
|
||||
// see: https://tc39.github.io/ecma262/#prod-AssignmentExpression
|
||||
|
|
|
@ -3220,6 +3220,9 @@ namespace ts {
|
|||
case SyntaxKind.AmpersandEqualsToken:
|
||||
case SyntaxKind.CaretEqualsToken:
|
||||
case SyntaxKind.BarEqualsToken:
|
||||
case SyntaxKind.BarBarEqualsToken:
|
||||
case SyntaxKind.AmpersandAmpersandEqualsToken:
|
||||
case SyntaxKind.QuestionQuestionEqualsToken:
|
||||
return Associativity.Right;
|
||||
}
|
||||
}
|
||||
|
@ -3276,6 +3279,9 @@ namespace ts {
|
|||
case SyntaxKind.AmpersandEqualsToken:
|
||||
case SyntaxKind.CaretEqualsToken:
|
||||
case SyntaxKind.BarEqualsToken:
|
||||
case SyntaxKind.BarBarEqualsToken:
|
||||
case SyntaxKind.AmpersandAmpersandEqualsToken:
|
||||
case SyntaxKind.QuestionQuestionEqualsToken:
|
||||
return 3;
|
||||
|
||||
default:
|
||||
|
@ -3372,6 +3378,10 @@ namespace ts {
|
|||
return 14;
|
||||
case SyntaxKind.AsteriskAsteriskToken:
|
||||
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
|
||||
|
@ -4444,6 +4454,12 @@ namespace ts {
|
|||
|| 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 {
|
||||
return token >= SyntaxKind.FirstAssignment && token <= SyntaxKind.LastAssignment;
|
||||
}
|
||||
|
|
|
@ -392,6 +392,9 @@ namespace ts {
|
|||
case SyntaxKind.EqualsToken:
|
||||
case SyntaxKind.CommaToken:
|
||||
case SyntaxKind.QuestionQuestionToken:
|
||||
case SyntaxKind.BarBarEqualsToken:
|
||||
case SyntaxKind.AmpersandAmpersandEqualsToken:
|
||||
case SyntaxKind.QuestionQuestionEqualsToken:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -785,6 +785,12 @@ namespace ts.codefix {
|
|||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.BarBarEqualsToken:
|
||||
case SyntaxKind.QuestionQuestionEqualsToken:
|
||||
case SyntaxKind.AmpersandAmpersandEqualsToken:
|
||||
// TODO: infer here
|
||||
break;
|
||||
|
||||
case SyntaxKind.AmpersandAmpersandToken:
|
||||
case SyntaxKind.CommaToken:
|
||||
case SyntaxKind.InstanceOfKeyword:
|
||||
|
|
|
@ -77,6 +77,9 @@ namespace ts {
|
|||
checkRhs(SyntaxKind.AmpersandAmpersandToken, /*expectParens*/ true);
|
||||
checkRhs(SyntaxKind.QuestionQuestionToken, /*expectParens*/ true);
|
||||
checkRhs(SyntaxKind.EqualsEqualsToken, /*expectParens*/ true);
|
||||
checkRhs(SyntaxKind.BarBarEqualsToken, /*expectParens*/ false);
|
||||
checkRhs(SyntaxKind.AmpersandAmpersandEqualsToken, /*expectParens*/ false);
|
||||
checkRhs(SyntaxKind.QuestionQuestionEqualsToken, /*expectParens*/ false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
561
tests/baselines/reference/api/tsserverlibrary.d.ts
vendored
561
tests/baselines/reference/api/tsserverlibrary.d.ts
vendored
|
@ -149,280 +149,283 @@ declare namespace ts {
|
|||
GreaterThanGreaterThanGreaterThanEqualsToken = 71,
|
||||
AmpersandEqualsToken = 72,
|
||||
BarEqualsToken = 73,
|
||||
CaretEqualsToken = 74,
|
||||
Identifier = 75,
|
||||
PrivateIdentifier = 76,
|
||||
BreakKeyword = 77,
|
||||
CaseKeyword = 78,
|
||||
CatchKeyword = 79,
|
||||
ClassKeyword = 80,
|
||||
ConstKeyword = 81,
|
||||
ContinueKeyword = 82,
|
||||
DebuggerKeyword = 83,
|
||||
DefaultKeyword = 84,
|
||||
DeleteKeyword = 85,
|
||||
DoKeyword = 86,
|
||||
ElseKeyword = 87,
|
||||
EnumKeyword = 88,
|
||||
ExportKeyword = 89,
|
||||
ExtendsKeyword = 90,
|
||||
FalseKeyword = 91,
|
||||
FinallyKeyword = 92,
|
||||
ForKeyword = 93,
|
||||
FunctionKeyword = 94,
|
||||
IfKeyword = 95,
|
||||
ImportKeyword = 96,
|
||||
InKeyword = 97,
|
||||
InstanceOfKeyword = 98,
|
||||
NewKeyword = 99,
|
||||
NullKeyword = 100,
|
||||
ReturnKeyword = 101,
|
||||
SuperKeyword = 102,
|
||||
SwitchKeyword = 103,
|
||||
ThisKeyword = 104,
|
||||
ThrowKeyword = 105,
|
||||
TrueKeyword = 106,
|
||||
TryKeyword = 107,
|
||||
TypeOfKeyword = 108,
|
||||
VarKeyword = 109,
|
||||
VoidKeyword = 110,
|
||||
WhileKeyword = 111,
|
||||
WithKeyword = 112,
|
||||
ImplementsKeyword = 113,
|
||||
InterfaceKeyword = 114,
|
||||
LetKeyword = 115,
|
||||
PackageKeyword = 116,
|
||||
PrivateKeyword = 117,
|
||||
ProtectedKeyword = 118,
|
||||
PublicKeyword = 119,
|
||||
StaticKeyword = 120,
|
||||
YieldKeyword = 121,
|
||||
AbstractKeyword = 122,
|
||||
AsKeyword = 123,
|
||||
AssertsKeyword = 124,
|
||||
AnyKeyword = 125,
|
||||
AsyncKeyword = 126,
|
||||
AwaitKeyword = 127,
|
||||
BooleanKeyword = 128,
|
||||
ConstructorKeyword = 129,
|
||||
DeclareKeyword = 130,
|
||||
GetKeyword = 131,
|
||||
InferKeyword = 132,
|
||||
IsKeyword = 133,
|
||||
KeyOfKeyword = 134,
|
||||
ModuleKeyword = 135,
|
||||
NamespaceKeyword = 136,
|
||||
NeverKeyword = 137,
|
||||
ReadonlyKeyword = 138,
|
||||
RequireKeyword = 139,
|
||||
NumberKeyword = 140,
|
||||
ObjectKeyword = 141,
|
||||
SetKeyword = 142,
|
||||
StringKeyword = 143,
|
||||
SymbolKeyword = 144,
|
||||
TypeKeyword = 145,
|
||||
UndefinedKeyword = 146,
|
||||
UniqueKeyword = 147,
|
||||
UnknownKeyword = 148,
|
||||
FromKeyword = 149,
|
||||
GlobalKeyword = 150,
|
||||
BigIntKeyword = 151,
|
||||
OfKeyword = 152,
|
||||
QualifiedName = 153,
|
||||
ComputedPropertyName = 154,
|
||||
TypeParameter = 155,
|
||||
Parameter = 156,
|
||||
Decorator = 157,
|
||||
PropertySignature = 158,
|
||||
PropertyDeclaration = 159,
|
||||
MethodSignature = 160,
|
||||
MethodDeclaration = 161,
|
||||
Constructor = 162,
|
||||
GetAccessor = 163,
|
||||
SetAccessor = 164,
|
||||
CallSignature = 165,
|
||||
ConstructSignature = 166,
|
||||
IndexSignature = 167,
|
||||
TypePredicate = 168,
|
||||
TypeReference = 169,
|
||||
FunctionType = 170,
|
||||
ConstructorType = 171,
|
||||
TypeQuery = 172,
|
||||
TypeLiteral = 173,
|
||||
ArrayType = 174,
|
||||
TupleType = 175,
|
||||
OptionalType = 176,
|
||||
RestType = 177,
|
||||
UnionType = 178,
|
||||
IntersectionType = 179,
|
||||
ConditionalType = 180,
|
||||
InferType = 181,
|
||||
ParenthesizedType = 182,
|
||||
ThisType = 183,
|
||||
TypeOperator = 184,
|
||||
IndexedAccessType = 185,
|
||||
MappedType = 186,
|
||||
LiteralType = 187,
|
||||
ImportType = 188,
|
||||
ObjectBindingPattern = 189,
|
||||
ArrayBindingPattern = 190,
|
||||
BindingElement = 191,
|
||||
ArrayLiteralExpression = 192,
|
||||
ObjectLiteralExpression = 193,
|
||||
PropertyAccessExpression = 194,
|
||||
ElementAccessExpression = 195,
|
||||
CallExpression = 196,
|
||||
NewExpression = 197,
|
||||
TaggedTemplateExpression = 198,
|
||||
TypeAssertionExpression = 199,
|
||||
ParenthesizedExpression = 200,
|
||||
FunctionExpression = 201,
|
||||
ArrowFunction = 202,
|
||||
DeleteExpression = 203,
|
||||
TypeOfExpression = 204,
|
||||
VoidExpression = 205,
|
||||
AwaitExpression = 206,
|
||||
PrefixUnaryExpression = 207,
|
||||
PostfixUnaryExpression = 208,
|
||||
BinaryExpression = 209,
|
||||
ConditionalExpression = 210,
|
||||
TemplateExpression = 211,
|
||||
YieldExpression = 212,
|
||||
SpreadElement = 213,
|
||||
ClassExpression = 214,
|
||||
OmittedExpression = 215,
|
||||
ExpressionWithTypeArguments = 216,
|
||||
AsExpression = 217,
|
||||
NonNullExpression = 218,
|
||||
MetaProperty = 219,
|
||||
SyntheticExpression = 220,
|
||||
TemplateSpan = 221,
|
||||
SemicolonClassElement = 222,
|
||||
Block = 223,
|
||||
EmptyStatement = 224,
|
||||
VariableStatement = 225,
|
||||
ExpressionStatement = 226,
|
||||
IfStatement = 227,
|
||||
DoStatement = 228,
|
||||
WhileStatement = 229,
|
||||
ForStatement = 230,
|
||||
ForInStatement = 231,
|
||||
ForOfStatement = 232,
|
||||
ContinueStatement = 233,
|
||||
BreakStatement = 234,
|
||||
ReturnStatement = 235,
|
||||
WithStatement = 236,
|
||||
SwitchStatement = 237,
|
||||
LabeledStatement = 238,
|
||||
ThrowStatement = 239,
|
||||
TryStatement = 240,
|
||||
DebuggerStatement = 241,
|
||||
VariableDeclaration = 242,
|
||||
VariableDeclarationList = 243,
|
||||
FunctionDeclaration = 244,
|
||||
ClassDeclaration = 245,
|
||||
InterfaceDeclaration = 246,
|
||||
TypeAliasDeclaration = 247,
|
||||
EnumDeclaration = 248,
|
||||
ModuleDeclaration = 249,
|
||||
ModuleBlock = 250,
|
||||
CaseBlock = 251,
|
||||
NamespaceExportDeclaration = 252,
|
||||
ImportEqualsDeclaration = 253,
|
||||
ImportDeclaration = 254,
|
||||
ImportClause = 255,
|
||||
NamespaceImport = 256,
|
||||
NamedImports = 257,
|
||||
ImportSpecifier = 258,
|
||||
ExportAssignment = 259,
|
||||
ExportDeclaration = 260,
|
||||
NamedExports = 261,
|
||||
NamespaceExport = 262,
|
||||
ExportSpecifier = 263,
|
||||
MissingDeclaration = 264,
|
||||
ExternalModuleReference = 265,
|
||||
JsxElement = 266,
|
||||
JsxSelfClosingElement = 267,
|
||||
JsxOpeningElement = 268,
|
||||
JsxClosingElement = 269,
|
||||
JsxFragment = 270,
|
||||
JsxOpeningFragment = 271,
|
||||
JsxClosingFragment = 272,
|
||||
JsxAttribute = 273,
|
||||
JsxAttributes = 274,
|
||||
JsxSpreadAttribute = 275,
|
||||
JsxExpression = 276,
|
||||
CaseClause = 277,
|
||||
DefaultClause = 278,
|
||||
HeritageClause = 279,
|
||||
CatchClause = 280,
|
||||
PropertyAssignment = 281,
|
||||
ShorthandPropertyAssignment = 282,
|
||||
SpreadAssignment = 283,
|
||||
EnumMember = 284,
|
||||
UnparsedPrologue = 285,
|
||||
UnparsedPrepend = 286,
|
||||
UnparsedText = 287,
|
||||
UnparsedInternalText = 288,
|
||||
UnparsedSyntheticReference = 289,
|
||||
SourceFile = 290,
|
||||
Bundle = 291,
|
||||
UnparsedSource = 292,
|
||||
InputFiles = 293,
|
||||
JSDocTypeExpression = 294,
|
||||
JSDocAllType = 295,
|
||||
JSDocUnknownType = 296,
|
||||
JSDocNullableType = 297,
|
||||
JSDocNonNullableType = 298,
|
||||
JSDocOptionalType = 299,
|
||||
JSDocFunctionType = 300,
|
||||
JSDocVariadicType = 301,
|
||||
JSDocNamepathType = 302,
|
||||
JSDocComment = 303,
|
||||
JSDocTypeLiteral = 304,
|
||||
JSDocSignature = 305,
|
||||
JSDocTag = 306,
|
||||
JSDocAugmentsTag = 307,
|
||||
JSDocImplementsTag = 308,
|
||||
JSDocAuthorTag = 309,
|
||||
JSDocClassTag = 310,
|
||||
JSDocPublicTag = 311,
|
||||
JSDocPrivateTag = 312,
|
||||
JSDocProtectedTag = 313,
|
||||
JSDocReadonlyTag = 314,
|
||||
JSDocCallbackTag = 315,
|
||||
JSDocEnumTag = 316,
|
||||
JSDocParameterTag = 317,
|
||||
JSDocReturnTag = 318,
|
||||
JSDocThisTag = 319,
|
||||
JSDocTypeTag = 320,
|
||||
JSDocTemplateTag = 321,
|
||||
JSDocTypedefTag = 322,
|
||||
JSDocPropertyTag = 323,
|
||||
SyntaxList = 324,
|
||||
NotEmittedStatement = 325,
|
||||
PartiallyEmittedExpression = 326,
|
||||
CommaListExpression = 327,
|
||||
MergeDeclarationMarker = 328,
|
||||
EndOfDeclarationMarker = 329,
|
||||
SyntheticReferenceExpression = 330,
|
||||
Count = 331,
|
||||
BarBarEqualsToken = 74,
|
||||
AmpersandAmpersandEqualsToken = 75,
|
||||
QuestionQuestionEqualsToken = 76,
|
||||
CaretEqualsToken = 77,
|
||||
Identifier = 78,
|
||||
PrivateIdentifier = 79,
|
||||
BreakKeyword = 80,
|
||||
CaseKeyword = 81,
|
||||
CatchKeyword = 82,
|
||||
ClassKeyword = 83,
|
||||
ConstKeyword = 84,
|
||||
ContinueKeyword = 85,
|
||||
DebuggerKeyword = 86,
|
||||
DefaultKeyword = 87,
|
||||
DeleteKeyword = 88,
|
||||
DoKeyword = 89,
|
||||
ElseKeyword = 90,
|
||||
EnumKeyword = 91,
|
||||
ExportKeyword = 92,
|
||||
ExtendsKeyword = 93,
|
||||
FalseKeyword = 94,
|
||||
FinallyKeyword = 95,
|
||||
ForKeyword = 96,
|
||||
FunctionKeyword = 97,
|
||||
IfKeyword = 98,
|
||||
ImportKeyword = 99,
|
||||
InKeyword = 100,
|
||||
InstanceOfKeyword = 101,
|
||||
NewKeyword = 102,
|
||||
NullKeyword = 103,
|
||||
ReturnKeyword = 104,
|
||||
SuperKeyword = 105,
|
||||
SwitchKeyword = 106,
|
||||
ThisKeyword = 107,
|
||||
ThrowKeyword = 108,
|
||||
TrueKeyword = 109,
|
||||
TryKeyword = 110,
|
||||
TypeOfKeyword = 111,
|
||||
VarKeyword = 112,
|
||||
VoidKeyword = 113,
|
||||
WhileKeyword = 114,
|
||||
WithKeyword = 115,
|
||||
ImplementsKeyword = 116,
|
||||
InterfaceKeyword = 117,
|
||||
LetKeyword = 118,
|
||||
PackageKeyword = 119,
|
||||
PrivateKeyword = 120,
|
||||
ProtectedKeyword = 121,
|
||||
PublicKeyword = 122,
|
||||
StaticKeyword = 123,
|
||||
YieldKeyword = 124,
|
||||
AbstractKeyword = 125,
|
||||
AsKeyword = 126,
|
||||
AssertsKeyword = 127,
|
||||
AnyKeyword = 128,
|
||||
AsyncKeyword = 129,
|
||||
AwaitKeyword = 130,
|
||||
BooleanKeyword = 131,
|
||||
ConstructorKeyword = 132,
|
||||
DeclareKeyword = 133,
|
||||
GetKeyword = 134,
|
||||
InferKeyword = 135,
|
||||
IsKeyword = 136,
|
||||
KeyOfKeyword = 137,
|
||||
ModuleKeyword = 138,
|
||||
NamespaceKeyword = 139,
|
||||
NeverKeyword = 140,
|
||||
ReadonlyKeyword = 141,
|
||||
RequireKeyword = 142,
|
||||
NumberKeyword = 143,
|
||||
ObjectKeyword = 144,
|
||||
SetKeyword = 145,
|
||||
StringKeyword = 146,
|
||||
SymbolKeyword = 147,
|
||||
TypeKeyword = 148,
|
||||
UndefinedKeyword = 149,
|
||||
UniqueKeyword = 150,
|
||||
UnknownKeyword = 151,
|
||||
FromKeyword = 152,
|
||||
GlobalKeyword = 153,
|
||||
BigIntKeyword = 154,
|
||||
OfKeyword = 155,
|
||||
QualifiedName = 156,
|
||||
ComputedPropertyName = 157,
|
||||
TypeParameter = 158,
|
||||
Parameter = 159,
|
||||
Decorator = 160,
|
||||
PropertySignature = 161,
|
||||
PropertyDeclaration = 162,
|
||||
MethodSignature = 163,
|
||||
MethodDeclaration = 164,
|
||||
Constructor = 165,
|
||||
GetAccessor = 166,
|
||||
SetAccessor = 167,
|
||||
CallSignature = 168,
|
||||
ConstructSignature = 169,
|
||||
IndexSignature = 170,
|
||||
TypePredicate = 171,
|
||||
TypeReference = 172,
|
||||
FunctionType = 173,
|
||||
ConstructorType = 174,
|
||||
TypeQuery = 175,
|
||||
TypeLiteral = 176,
|
||||
ArrayType = 177,
|
||||
TupleType = 178,
|
||||
OptionalType = 179,
|
||||
RestType = 180,
|
||||
UnionType = 181,
|
||||
IntersectionType = 182,
|
||||
ConditionalType = 183,
|
||||
InferType = 184,
|
||||
ParenthesizedType = 185,
|
||||
ThisType = 186,
|
||||
TypeOperator = 187,
|
||||
IndexedAccessType = 188,
|
||||
MappedType = 189,
|
||||
LiteralType = 190,
|
||||
ImportType = 191,
|
||||
ObjectBindingPattern = 192,
|
||||
ArrayBindingPattern = 193,
|
||||
BindingElement = 194,
|
||||
ArrayLiteralExpression = 195,
|
||||
ObjectLiteralExpression = 196,
|
||||
PropertyAccessExpression = 197,
|
||||
ElementAccessExpression = 198,
|
||||
CallExpression = 199,
|
||||
NewExpression = 200,
|
||||
TaggedTemplateExpression = 201,
|
||||
TypeAssertionExpression = 202,
|
||||
ParenthesizedExpression = 203,
|
||||
FunctionExpression = 204,
|
||||
ArrowFunction = 205,
|
||||
DeleteExpression = 206,
|
||||
TypeOfExpression = 207,
|
||||
VoidExpression = 208,
|
||||
AwaitExpression = 209,
|
||||
PrefixUnaryExpression = 210,
|
||||
PostfixUnaryExpression = 211,
|
||||
BinaryExpression = 212,
|
||||
ConditionalExpression = 213,
|
||||
TemplateExpression = 214,
|
||||
YieldExpression = 215,
|
||||
SpreadElement = 216,
|
||||
ClassExpression = 217,
|
||||
OmittedExpression = 218,
|
||||
ExpressionWithTypeArguments = 219,
|
||||
AsExpression = 220,
|
||||
NonNullExpression = 221,
|
||||
MetaProperty = 222,
|
||||
SyntheticExpression = 223,
|
||||
TemplateSpan = 224,
|
||||
SemicolonClassElement = 225,
|
||||
Block = 226,
|
||||
EmptyStatement = 227,
|
||||
VariableStatement = 228,
|
||||
ExpressionStatement = 229,
|
||||
IfStatement = 230,
|
||||
DoStatement = 231,
|
||||
WhileStatement = 232,
|
||||
ForStatement = 233,
|
||||
ForInStatement = 234,
|
||||
ForOfStatement = 235,
|
||||
ContinueStatement = 236,
|
||||
BreakStatement = 237,
|
||||
ReturnStatement = 238,
|
||||
WithStatement = 239,
|
||||
SwitchStatement = 240,
|
||||
LabeledStatement = 241,
|
||||
ThrowStatement = 242,
|
||||
TryStatement = 243,
|
||||
DebuggerStatement = 244,
|
||||
VariableDeclaration = 245,
|
||||
VariableDeclarationList = 246,
|
||||
FunctionDeclaration = 247,
|
||||
ClassDeclaration = 248,
|
||||
InterfaceDeclaration = 249,
|
||||
TypeAliasDeclaration = 250,
|
||||
EnumDeclaration = 251,
|
||||
ModuleDeclaration = 252,
|
||||
ModuleBlock = 253,
|
||||
CaseBlock = 254,
|
||||
NamespaceExportDeclaration = 255,
|
||||
ImportEqualsDeclaration = 256,
|
||||
ImportDeclaration = 257,
|
||||
ImportClause = 258,
|
||||
NamespaceImport = 259,
|
||||
NamedImports = 260,
|
||||
ImportSpecifier = 261,
|
||||
ExportAssignment = 262,
|
||||
ExportDeclaration = 263,
|
||||
NamedExports = 264,
|
||||
NamespaceExport = 265,
|
||||
ExportSpecifier = 266,
|
||||
MissingDeclaration = 267,
|
||||
ExternalModuleReference = 268,
|
||||
JsxElement = 269,
|
||||
JsxSelfClosingElement = 270,
|
||||
JsxOpeningElement = 271,
|
||||
JsxClosingElement = 272,
|
||||
JsxFragment = 273,
|
||||
JsxOpeningFragment = 274,
|
||||
JsxClosingFragment = 275,
|
||||
JsxAttribute = 276,
|
||||
JsxAttributes = 277,
|
||||
JsxSpreadAttribute = 278,
|
||||
JsxExpression = 279,
|
||||
CaseClause = 280,
|
||||
DefaultClause = 281,
|
||||
HeritageClause = 282,
|
||||
CatchClause = 283,
|
||||
PropertyAssignment = 284,
|
||||
ShorthandPropertyAssignment = 285,
|
||||
SpreadAssignment = 286,
|
||||
EnumMember = 287,
|
||||
UnparsedPrologue = 288,
|
||||
UnparsedPrepend = 289,
|
||||
UnparsedText = 290,
|
||||
UnparsedInternalText = 291,
|
||||
UnparsedSyntheticReference = 292,
|
||||
SourceFile = 293,
|
||||
Bundle = 294,
|
||||
UnparsedSource = 295,
|
||||
InputFiles = 296,
|
||||
JSDocTypeExpression = 297,
|
||||
JSDocAllType = 298,
|
||||
JSDocUnknownType = 299,
|
||||
JSDocNullableType = 300,
|
||||
JSDocNonNullableType = 301,
|
||||
JSDocOptionalType = 302,
|
||||
JSDocFunctionType = 303,
|
||||
JSDocVariadicType = 304,
|
||||
JSDocNamepathType = 305,
|
||||
JSDocComment = 306,
|
||||
JSDocTypeLiteral = 307,
|
||||
JSDocSignature = 308,
|
||||
JSDocTag = 309,
|
||||
JSDocAugmentsTag = 310,
|
||||
JSDocImplementsTag = 311,
|
||||
JSDocAuthorTag = 312,
|
||||
JSDocClassTag = 313,
|
||||
JSDocPublicTag = 314,
|
||||
JSDocPrivateTag = 315,
|
||||
JSDocProtectedTag = 316,
|
||||
JSDocReadonlyTag = 317,
|
||||
JSDocCallbackTag = 318,
|
||||
JSDocEnumTag = 319,
|
||||
JSDocParameterTag = 320,
|
||||
JSDocReturnTag = 321,
|
||||
JSDocThisTag = 322,
|
||||
JSDocTypeTag = 323,
|
||||
JSDocTemplateTag = 324,
|
||||
JSDocTypedefTag = 325,
|
||||
JSDocPropertyTag = 326,
|
||||
SyntaxList = 327,
|
||||
NotEmittedStatement = 328,
|
||||
PartiallyEmittedExpression = 329,
|
||||
CommaListExpression = 330,
|
||||
MergeDeclarationMarker = 331,
|
||||
EndOfDeclarationMarker = 332,
|
||||
SyntheticReferenceExpression = 333,
|
||||
Count = 334,
|
||||
FirstAssignment = 62,
|
||||
LastAssignment = 74,
|
||||
LastAssignment = 77,
|
||||
FirstCompoundAssignment = 63,
|
||||
LastCompoundAssignment = 74,
|
||||
FirstReservedWord = 77,
|
||||
LastReservedWord = 112,
|
||||
FirstKeyword = 77,
|
||||
LastKeyword = 152,
|
||||
FirstFutureReservedWord = 113,
|
||||
LastFutureReservedWord = 121,
|
||||
FirstTypeNode = 168,
|
||||
LastTypeNode = 188,
|
||||
LastCompoundAssignment = 77,
|
||||
FirstReservedWord = 80,
|
||||
LastReservedWord = 115,
|
||||
FirstKeyword = 80,
|
||||
LastKeyword = 155,
|
||||
FirstFutureReservedWord = 116,
|
||||
LastFutureReservedWord = 124,
|
||||
FirstTypeNode = 171,
|
||||
LastTypeNode = 191,
|
||||
FirstPunctuation = 18,
|
||||
LastPunctuation = 74,
|
||||
LastPunctuation = 77,
|
||||
FirstToken = 0,
|
||||
LastToken = 152,
|
||||
LastToken = 155,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 7,
|
||||
FirstLiteralToken = 8,
|
||||
|
@ -430,14 +433,14 @@ declare namespace ts {
|
|||
FirstTemplateToken = 14,
|
||||
LastTemplateToken = 17,
|
||||
FirstBinaryOperator = 29,
|
||||
LastBinaryOperator = 74,
|
||||
FirstStatement = 225,
|
||||
LastStatement = 241,
|
||||
FirstNode = 153,
|
||||
FirstJSDocNode = 294,
|
||||
LastJSDocNode = 323,
|
||||
FirstJSDocTagNode = 306,
|
||||
LastJSDocTagNode = 323,
|
||||
LastBinaryOperator = 77,
|
||||
FirstStatement = 228,
|
||||
LastStatement = 244,
|
||||
FirstNode = 156,
|
||||
FirstJSDocNode = 297,
|
||||
LastJSDocNode = 326,
|
||||
FirstJSDocTagNode = 309,
|
||||
LastJSDocTagNode = 326,
|
||||
}
|
||||
export enum NodeFlags {
|
||||
None = 0,
|
||||
|
@ -963,7 +966,7 @@ declare namespace ts {
|
|||
export type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator;
|
||||
export type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken;
|
||||
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 AssignmentOperatorOrHigher = SyntaxKind.QuestionQuestionToken | LogicalOperatorOrHigher | AssignmentOperator;
|
||||
export type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken;
|
||||
|
|
561
tests/baselines/reference/api/typescript.d.ts
vendored
561
tests/baselines/reference/api/typescript.d.ts
vendored
|
@ -149,280 +149,283 @@ declare namespace ts {
|
|||
GreaterThanGreaterThanGreaterThanEqualsToken = 71,
|
||||
AmpersandEqualsToken = 72,
|
||||
BarEqualsToken = 73,
|
||||
CaretEqualsToken = 74,
|
||||
Identifier = 75,
|
||||
PrivateIdentifier = 76,
|
||||
BreakKeyword = 77,
|
||||
CaseKeyword = 78,
|
||||
CatchKeyword = 79,
|
||||
ClassKeyword = 80,
|
||||
ConstKeyword = 81,
|
||||
ContinueKeyword = 82,
|
||||
DebuggerKeyword = 83,
|
||||
DefaultKeyword = 84,
|
||||
DeleteKeyword = 85,
|
||||
DoKeyword = 86,
|
||||
ElseKeyword = 87,
|
||||
EnumKeyword = 88,
|
||||
ExportKeyword = 89,
|
||||
ExtendsKeyword = 90,
|
||||
FalseKeyword = 91,
|
||||
FinallyKeyword = 92,
|
||||
ForKeyword = 93,
|
||||
FunctionKeyword = 94,
|
||||
IfKeyword = 95,
|
||||
ImportKeyword = 96,
|
||||
InKeyword = 97,
|
||||
InstanceOfKeyword = 98,
|
||||
NewKeyword = 99,
|
||||
NullKeyword = 100,
|
||||
ReturnKeyword = 101,
|
||||
SuperKeyword = 102,
|
||||
SwitchKeyword = 103,
|
||||
ThisKeyword = 104,
|
||||
ThrowKeyword = 105,
|
||||
TrueKeyword = 106,
|
||||
TryKeyword = 107,
|
||||
TypeOfKeyword = 108,
|
||||
VarKeyword = 109,
|
||||
VoidKeyword = 110,
|
||||
WhileKeyword = 111,
|
||||
WithKeyword = 112,
|
||||
ImplementsKeyword = 113,
|
||||
InterfaceKeyword = 114,
|
||||
LetKeyword = 115,
|
||||
PackageKeyword = 116,
|
||||
PrivateKeyword = 117,
|
||||
ProtectedKeyword = 118,
|
||||
PublicKeyword = 119,
|
||||
StaticKeyword = 120,
|
||||
YieldKeyword = 121,
|
||||
AbstractKeyword = 122,
|
||||
AsKeyword = 123,
|
||||
AssertsKeyword = 124,
|
||||
AnyKeyword = 125,
|
||||
AsyncKeyword = 126,
|
||||
AwaitKeyword = 127,
|
||||
BooleanKeyword = 128,
|
||||
ConstructorKeyword = 129,
|
||||
DeclareKeyword = 130,
|
||||
GetKeyword = 131,
|
||||
InferKeyword = 132,
|
||||
IsKeyword = 133,
|
||||
KeyOfKeyword = 134,
|
||||
ModuleKeyword = 135,
|
||||
NamespaceKeyword = 136,
|
||||
NeverKeyword = 137,
|
||||
ReadonlyKeyword = 138,
|
||||
RequireKeyword = 139,
|
||||
NumberKeyword = 140,
|
||||
ObjectKeyword = 141,
|
||||
SetKeyword = 142,
|
||||
StringKeyword = 143,
|
||||
SymbolKeyword = 144,
|
||||
TypeKeyword = 145,
|
||||
UndefinedKeyword = 146,
|
||||
UniqueKeyword = 147,
|
||||
UnknownKeyword = 148,
|
||||
FromKeyword = 149,
|
||||
GlobalKeyword = 150,
|
||||
BigIntKeyword = 151,
|
||||
OfKeyword = 152,
|
||||
QualifiedName = 153,
|
||||
ComputedPropertyName = 154,
|
||||
TypeParameter = 155,
|
||||
Parameter = 156,
|
||||
Decorator = 157,
|
||||
PropertySignature = 158,
|
||||
PropertyDeclaration = 159,
|
||||
MethodSignature = 160,
|
||||
MethodDeclaration = 161,
|
||||
Constructor = 162,
|
||||
GetAccessor = 163,
|
||||
SetAccessor = 164,
|
||||
CallSignature = 165,
|
||||
ConstructSignature = 166,
|
||||
IndexSignature = 167,
|
||||
TypePredicate = 168,
|
||||
TypeReference = 169,
|
||||
FunctionType = 170,
|
||||
ConstructorType = 171,
|
||||
TypeQuery = 172,
|
||||
TypeLiteral = 173,
|
||||
ArrayType = 174,
|
||||
TupleType = 175,
|
||||
OptionalType = 176,
|
||||
RestType = 177,
|
||||
UnionType = 178,
|
||||
IntersectionType = 179,
|
||||
ConditionalType = 180,
|
||||
InferType = 181,
|
||||
ParenthesizedType = 182,
|
||||
ThisType = 183,
|
||||
TypeOperator = 184,
|
||||
IndexedAccessType = 185,
|
||||
MappedType = 186,
|
||||
LiteralType = 187,
|
||||
ImportType = 188,
|
||||
ObjectBindingPattern = 189,
|
||||
ArrayBindingPattern = 190,
|
||||
BindingElement = 191,
|
||||
ArrayLiteralExpression = 192,
|
||||
ObjectLiteralExpression = 193,
|
||||
PropertyAccessExpression = 194,
|
||||
ElementAccessExpression = 195,
|
||||
CallExpression = 196,
|
||||
NewExpression = 197,
|
||||
TaggedTemplateExpression = 198,
|
||||
TypeAssertionExpression = 199,
|
||||
ParenthesizedExpression = 200,
|
||||
FunctionExpression = 201,
|
||||
ArrowFunction = 202,
|
||||
DeleteExpression = 203,
|
||||
TypeOfExpression = 204,
|
||||
VoidExpression = 205,
|
||||
AwaitExpression = 206,
|
||||
PrefixUnaryExpression = 207,
|
||||
PostfixUnaryExpression = 208,
|
||||
BinaryExpression = 209,
|
||||
ConditionalExpression = 210,
|
||||
TemplateExpression = 211,
|
||||
YieldExpression = 212,
|
||||
SpreadElement = 213,
|
||||
ClassExpression = 214,
|
||||
OmittedExpression = 215,
|
||||
ExpressionWithTypeArguments = 216,
|
||||
AsExpression = 217,
|
||||
NonNullExpression = 218,
|
||||
MetaProperty = 219,
|
||||
SyntheticExpression = 220,
|
||||
TemplateSpan = 221,
|
||||
SemicolonClassElement = 222,
|
||||
Block = 223,
|
||||
EmptyStatement = 224,
|
||||
VariableStatement = 225,
|
||||
ExpressionStatement = 226,
|
||||
IfStatement = 227,
|
||||
DoStatement = 228,
|
||||
WhileStatement = 229,
|
||||
ForStatement = 230,
|
||||
ForInStatement = 231,
|
||||
ForOfStatement = 232,
|
||||
ContinueStatement = 233,
|
||||
BreakStatement = 234,
|
||||
ReturnStatement = 235,
|
||||
WithStatement = 236,
|
||||
SwitchStatement = 237,
|
||||
LabeledStatement = 238,
|
||||
ThrowStatement = 239,
|
||||
TryStatement = 240,
|
||||
DebuggerStatement = 241,
|
||||
VariableDeclaration = 242,
|
||||
VariableDeclarationList = 243,
|
||||
FunctionDeclaration = 244,
|
||||
ClassDeclaration = 245,
|
||||
InterfaceDeclaration = 246,
|
||||
TypeAliasDeclaration = 247,
|
||||
EnumDeclaration = 248,
|
||||
ModuleDeclaration = 249,
|
||||
ModuleBlock = 250,
|
||||
CaseBlock = 251,
|
||||
NamespaceExportDeclaration = 252,
|
||||
ImportEqualsDeclaration = 253,
|
||||
ImportDeclaration = 254,
|
||||
ImportClause = 255,
|
||||
NamespaceImport = 256,
|
||||
NamedImports = 257,
|
||||
ImportSpecifier = 258,
|
||||
ExportAssignment = 259,
|
||||
ExportDeclaration = 260,
|
||||
NamedExports = 261,
|
||||
NamespaceExport = 262,
|
||||
ExportSpecifier = 263,
|
||||
MissingDeclaration = 264,
|
||||
ExternalModuleReference = 265,
|
||||
JsxElement = 266,
|
||||
JsxSelfClosingElement = 267,
|
||||
JsxOpeningElement = 268,
|
||||
JsxClosingElement = 269,
|
||||
JsxFragment = 270,
|
||||
JsxOpeningFragment = 271,
|
||||
JsxClosingFragment = 272,
|
||||
JsxAttribute = 273,
|
||||
JsxAttributes = 274,
|
||||
JsxSpreadAttribute = 275,
|
||||
JsxExpression = 276,
|
||||
CaseClause = 277,
|
||||
DefaultClause = 278,
|
||||
HeritageClause = 279,
|
||||
CatchClause = 280,
|
||||
PropertyAssignment = 281,
|
||||
ShorthandPropertyAssignment = 282,
|
||||
SpreadAssignment = 283,
|
||||
EnumMember = 284,
|
||||
UnparsedPrologue = 285,
|
||||
UnparsedPrepend = 286,
|
||||
UnparsedText = 287,
|
||||
UnparsedInternalText = 288,
|
||||
UnparsedSyntheticReference = 289,
|
||||
SourceFile = 290,
|
||||
Bundle = 291,
|
||||
UnparsedSource = 292,
|
||||
InputFiles = 293,
|
||||
JSDocTypeExpression = 294,
|
||||
JSDocAllType = 295,
|
||||
JSDocUnknownType = 296,
|
||||
JSDocNullableType = 297,
|
||||
JSDocNonNullableType = 298,
|
||||
JSDocOptionalType = 299,
|
||||
JSDocFunctionType = 300,
|
||||
JSDocVariadicType = 301,
|
||||
JSDocNamepathType = 302,
|
||||
JSDocComment = 303,
|
||||
JSDocTypeLiteral = 304,
|
||||
JSDocSignature = 305,
|
||||
JSDocTag = 306,
|
||||
JSDocAugmentsTag = 307,
|
||||
JSDocImplementsTag = 308,
|
||||
JSDocAuthorTag = 309,
|
||||
JSDocClassTag = 310,
|
||||
JSDocPublicTag = 311,
|
||||
JSDocPrivateTag = 312,
|
||||
JSDocProtectedTag = 313,
|
||||
JSDocReadonlyTag = 314,
|
||||
JSDocCallbackTag = 315,
|
||||
JSDocEnumTag = 316,
|
||||
JSDocParameterTag = 317,
|
||||
JSDocReturnTag = 318,
|
||||
JSDocThisTag = 319,
|
||||
JSDocTypeTag = 320,
|
||||
JSDocTemplateTag = 321,
|
||||
JSDocTypedefTag = 322,
|
||||
JSDocPropertyTag = 323,
|
||||
SyntaxList = 324,
|
||||
NotEmittedStatement = 325,
|
||||
PartiallyEmittedExpression = 326,
|
||||
CommaListExpression = 327,
|
||||
MergeDeclarationMarker = 328,
|
||||
EndOfDeclarationMarker = 329,
|
||||
SyntheticReferenceExpression = 330,
|
||||
Count = 331,
|
||||
BarBarEqualsToken = 74,
|
||||
AmpersandAmpersandEqualsToken = 75,
|
||||
QuestionQuestionEqualsToken = 76,
|
||||
CaretEqualsToken = 77,
|
||||
Identifier = 78,
|
||||
PrivateIdentifier = 79,
|
||||
BreakKeyword = 80,
|
||||
CaseKeyword = 81,
|
||||
CatchKeyword = 82,
|
||||
ClassKeyword = 83,
|
||||
ConstKeyword = 84,
|
||||
ContinueKeyword = 85,
|
||||
DebuggerKeyword = 86,
|
||||
DefaultKeyword = 87,
|
||||
DeleteKeyword = 88,
|
||||
DoKeyword = 89,
|
||||
ElseKeyword = 90,
|
||||
EnumKeyword = 91,
|
||||
ExportKeyword = 92,
|
||||
ExtendsKeyword = 93,
|
||||
FalseKeyword = 94,
|
||||
FinallyKeyword = 95,
|
||||
ForKeyword = 96,
|
||||
FunctionKeyword = 97,
|
||||
IfKeyword = 98,
|
||||
ImportKeyword = 99,
|
||||
InKeyword = 100,
|
||||
InstanceOfKeyword = 101,
|
||||
NewKeyword = 102,
|
||||
NullKeyword = 103,
|
||||
ReturnKeyword = 104,
|
||||
SuperKeyword = 105,
|
||||
SwitchKeyword = 106,
|
||||
ThisKeyword = 107,
|
||||
ThrowKeyword = 108,
|
||||
TrueKeyword = 109,
|
||||
TryKeyword = 110,
|
||||
TypeOfKeyword = 111,
|
||||
VarKeyword = 112,
|
||||
VoidKeyword = 113,
|
||||
WhileKeyword = 114,
|
||||
WithKeyword = 115,
|
||||
ImplementsKeyword = 116,
|
||||
InterfaceKeyword = 117,
|
||||
LetKeyword = 118,
|
||||
PackageKeyword = 119,
|
||||
PrivateKeyword = 120,
|
||||
ProtectedKeyword = 121,
|
||||
PublicKeyword = 122,
|
||||
StaticKeyword = 123,
|
||||
YieldKeyword = 124,
|
||||
AbstractKeyword = 125,
|
||||
AsKeyword = 126,
|
||||
AssertsKeyword = 127,
|
||||
AnyKeyword = 128,
|
||||
AsyncKeyword = 129,
|
||||
AwaitKeyword = 130,
|
||||
BooleanKeyword = 131,
|
||||
ConstructorKeyword = 132,
|
||||
DeclareKeyword = 133,
|
||||
GetKeyword = 134,
|
||||
InferKeyword = 135,
|
||||
IsKeyword = 136,
|
||||
KeyOfKeyword = 137,
|
||||
ModuleKeyword = 138,
|
||||
NamespaceKeyword = 139,
|
||||
NeverKeyword = 140,
|
||||
ReadonlyKeyword = 141,
|
||||
RequireKeyword = 142,
|
||||
NumberKeyword = 143,
|
||||
ObjectKeyword = 144,
|
||||
SetKeyword = 145,
|
||||
StringKeyword = 146,
|
||||
SymbolKeyword = 147,
|
||||
TypeKeyword = 148,
|
||||
UndefinedKeyword = 149,
|
||||
UniqueKeyword = 150,
|
||||
UnknownKeyword = 151,
|
||||
FromKeyword = 152,
|
||||
GlobalKeyword = 153,
|
||||
BigIntKeyword = 154,
|
||||
OfKeyword = 155,
|
||||
QualifiedName = 156,
|
||||
ComputedPropertyName = 157,
|
||||
TypeParameter = 158,
|
||||
Parameter = 159,
|
||||
Decorator = 160,
|
||||
PropertySignature = 161,
|
||||
PropertyDeclaration = 162,
|
||||
MethodSignature = 163,
|
||||
MethodDeclaration = 164,
|
||||
Constructor = 165,
|
||||
GetAccessor = 166,
|
||||
SetAccessor = 167,
|
||||
CallSignature = 168,
|
||||
ConstructSignature = 169,
|
||||
IndexSignature = 170,
|
||||
TypePredicate = 171,
|
||||
TypeReference = 172,
|
||||
FunctionType = 173,
|
||||
ConstructorType = 174,
|
||||
TypeQuery = 175,
|
||||
TypeLiteral = 176,
|
||||
ArrayType = 177,
|
||||
TupleType = 178,
|
||||
OptionalType = 179,
|
||||
RestType = 180,
|
||||
UnionType = 181,
|
||||
IntersectionType = 182,
|
||||
ConditionalType = 183,
|
||||
InferType = 184,
|
||||
ParenthesizedType = 185,
|
||||
ThisType = 186,
|
||||
TypeOperator = 187,
|
||||
IndexedAccessType = 188,
|
||||
MappedType = 189,
|
||||
LiteralType = 190,
|
||||
ImportType = 191,
|
||||
ObjectBindingPattern = 192,
|
||||
ArrayBindingPattern = 193,
|
||||
BindingElement = 194,
|
||||
ArrayLiteralExpression = 195,
|
||||
ObjectLiteralExpression = 196,
|
||||
PropertyAccessExpression = 197,
|
||||
ElementAccessExpression = 198,
|
||||
CallExpression = 199,
|
||||
NewExpression = 200,
|
||||
TaggedTemplateExpression = 201,
|
||||
TypeAssertionExpression = 202,
|
||||
ParenthesizedExpression = 203,
|
||||
FunctionExpression = 204,
|
||||
ArrowFunction = 205,
|
||||
DeleteExpression = 206,
|
||||
TypeOfExpression = 207,
|
||||
VoidExpression = 208,
|
||||
AwaitExpression = 209,
|
||||
PrefixUnaryExpression = 210,
|
||||
PostfixUnaryExpression = 211,
|
||||
BinaryExpression = 212,
|
||||
ConditionalExpression = 213,
|
||||
TemplateExpression = 214,
|
||||
YieldExpression = 215,
|
||||
SpreadElement = 216,
|
||||
ClassExpression = 217,
|
||||
OmittedExpression = 218,
|
||||
ExpressionWithTypeArguments = 219,
|
||||
AsExpression = 220,
|
||||
NonNullExpression = 221,
|
||||
MetaProperty = 222,
|
||||
SyntheticExpression = 223,
|
||||
TemplateSpan = 224,
|
||||
SemicolonClassElement = 225,
|
||||
Block = 226,
|
||||
EmptyStatement = 227,
|
||||
VariableStatement = 228,
|
||||
ExpressionStatement = 229,
|
||||
IfStatement = 230,
|
||||
DoStatement = 231,
|
||||
WhileStatement = 232,
|
||||
ForStatement = 233,
|
||||
ForInStatement = 234,
|
||||
ForOfStatement = 235,
|
||||
ContinueStatement = 236,
|
||||
BreakStatement = 237,
|
||||
ReturnStatement = 238,
|
||||
WithStatement = 239,
|
||||
SwitchStatement = 240,
|
||||
LabeledStatement = 241,
|
||||
ThrowStatement = 242,
|
||||
TryStatement = 243,
|
||||
DebuggerStatement = 244,
|
||||
VariableDeclaration = 245,
|
||||
VariableDeclarationList = 246,
|
||||
FunctionDeclaration = 247,
|
||||
ClassDeclaration = 248,
|
||||
InterfaceDeclaration = 249,
|
||||
TypeAliasDeclaration = 250,
|
||||
EnumDeclaration = 251,
|
||||
ModuleDeclaration = 252,
|
||||
ModuleBlock = 253,
|
||||
CaseBlock = 254,
|
||||
NamespaceExportDeclaration = 255,
|
||||
ImportEqualsDeclaration = 256,
|
||||
ImportDeclaration = 257,
|
||||
ImportClause = 258,
|
||||
NamespaceImport = 259,
|
||||
NamedImports = 260,
|
||||
ImportSpecifier = 261,
|
||||
ExportAssignment = 262,
|
||||
ExportDeclaration = 263,
|
||||
NamedExports = 264,
|
||||
NamespaceExport = 265,
|
||||
ExportSpecifier = 266,
|
||||
MissingDeclaration = 267,
|
||||
ExternalModuleReference = 268,
|
||||
JsxElement = 269,
|
||||
JsxSelfClosingElement = 270,
|
||||
JsxOpeningElement = 271,
|
||||
JsxClosingElement = 272,
|
||||
JsxFragment = 273,
|
||||
JsxOpeningFragment = 274,
|
||||
JsxClosingFragment = 275,
|
||||
JsxAttribute = 276,
|
||||
JsxAttributes = 277,
|
||||
JsxSpreadAttribute = 278,
|
||||
JsxExpression = 279,
|
||||
CaseClause = 280,
|
||||
DefaultClause = 281,
|
||||
HeritageClause = 282,
|
||||
CatchClause = 283,
|
||||
PropertyAssignment = 284,
|
||||
ShorthandPropertyAssignment = 285,
|
||||
SpreadAssignment = 286,
|
||||
EnumMember = 287,
|
||||
UnparsedPrologue = 288,
|
||||
UnparsedPrepend = 289,
|
||||
UnparsedText = 290,
|
||||
UnparsedInternalText = 291,
|
||||
UnparsedSyntheticReference = 292,
|
||||
SourceFile = 293,
|
||||
Bundle = 294,
|
||||
UnparsedSource = 295,
|
||||
InputFiles = 296,
|
||||
JSDocTypeExpression = 297,
|
||||
JSDocAllType = 298,
|
||||
JSDocUnknownType = 299,
|
||||
JSDocNullableType = 300,
|
||||
JSDocNonNullableType = 301,
|
||||
JSDocOptionalType = 302,
|
||||
JSDocFunctionType = 303,
|
||||
JSDocVariadicType = 304,
|
||||
JSDocNamepathType = 305,
|
||||
JSDocComment = 306,
|
||||
JSDocTypeLiteral = 307,
|
||||
JSDocSignature = 308,
|
||||
JSDocTag = 309,
|
||||
JSDocAugmentsTag = 310,
|
||||
JSDocImplementsTag = 311,
|
||||
JSDocAuthorTag = 312,
|
||||
JSDocClassTag = 313,
|
||||
JSDocPublicTag = 314,
|
||||
JSDocPrivateTag = 315,
|
||||
JSDocProtectedTag = 316,
|
||||
JSDocReadonlyTag = 317,
|
||||
JSDocCallbackTag = 318,
|
||||
JSDocEnumTag = 319,
|
||||
JSDocParameterTag = 320,
|
||||
JSDocReturnTag = 321,
|
||||
JSDocThisTag = 322,
|
||||
JSDocTypeTag = 323,
|
||||
JSDocTemplateTag = 324,
|
||||
JSDocTypedefTag = 325,
|
||||
JSDocPropertyTag = 326,
|
||||
SyntaxList = 327,
|
||||
NotEmittedStatement = 328,
|
||||
PartiallyEmittedExpression = 329,
|
||||
CommaListExpression = 330,
|
||||
MergeDeclarationMarker = 331,
|
||||
EndOfDeclarationMarker = 332,
|
||||
SyntheticReferenceExpression = 333,
|
||||
Count = 334,
|
||||
FirstAssignment = 62,
|
||||
LastAssignment = 74,
|
||||
LastAssignment = 77,
|
||||
FirstCompoundAssignment = 63,
|
||||
LastCompoundAssignment = 74,
|
||||
FirstReservedWord = 77,
|
||||
LastReservedWord = 112,
|
||||
FirstKeyword = 77,
|
||||
LastKeyword = 152,
|
||||
FirstFutureReservedWord = 113,
|
||||
LastFutureReservedWord = 121,
|
||||
FirstTypeNode = 168,
|
||||
LastTypeNode = 188,
|
||||
LastCompoundAssignment = 77,
|
||||
FirstReservedWord = 80,
|
||||
LastReservedWord = 115,
|
||||
FirstKeyword = 80,
|
||||
LastKeyword = 155,
|
||||
FirstFutureReservedWord = 116,
|
||||
LastFutureReservedWord = 124,
|
||||
FirstTypeNode = 171,
|
||||
LastTypeNode = 191,
|
||||
FirstPunctuation = 18,
|
||||
LastPunctuation = 74,
|
||||
LastPunctuation = 77,
|
||||
FirstToken = 0,
|
||||
LastToken = 152,
|
||||
LastToken = 155,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 7,
|
||||
FirstLiteralToken = 8,
|
||||
|
@ -430,14 +433,14 @@ declare namespace ts {
|
|||
FirstTemplateToken = 14,
|
||||
LastTemplateToken = 17,
|
||||
FirstBinaryOperator = 29,
|
||||
LastBinaryOperator = 74,
|
||||
FirstStatement = 225,
|
||||
LastStatement = 241,
|
||||
FirstNode = 153,
|
||||
FirstJSDocNode = 294,
|
||||
LastJSDocNode = 323,
|
||||
FirstJSDocTagNode = 306,
|
||||
LastJSDocTagNode = 323,
|
||||
LastBinaryOperator = 77,
|
||||
FirstStatement = 228,
|
||||
LastStatement = 244,
|
||||
FirstNode = 156,
|
||||
FirstJSDocNode = 297,
|
||||
LastJSDocNode = 326,
|
||||
FirstJSDocTagNode = 309,
|
||||
LastJSDocTagNode = 326,
|
||||
}
|
||||
export enum NodeFlags {
|
||||
None = 0,
|
||||
|
@ -963,7 +966,7 @@ declare namespace ts {
|
|||
export type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator;
|
||||
export type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken;
|
||||
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 AssignmentOperatorOrHigher = SyntaxKind.QuestionQuestionToken | LogicalOperatorOrHigher | AssignmentOperator;
|
||||
export type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken;
|
||||
|
|
|
@ -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);
|
|
@ -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))
|
||||
|
|
@ -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
|
||||
|
|
@ -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);
|
|
@ -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))
|
||||
|
|
@ -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
|
||||
|
|
@ -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;
|
|
@ -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))
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
Loading…
Reference in a new issue