-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional Types cleanup #5719
Additional Types cleanup #5719
Changes from 3 commits
443abe6
4be0095
5915fbd
93af2b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -428,18 +428,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi | |
* var loop = function(x) { <code where 'arguments' is replaced witg 'arguments_1'> } | ||
* var arguments_1 = arguments | ||
* for (var x;;) loop(x); | ||
* otherwise semantics of the code will be different since 'arguments' inside converted loop body | ||
* otherwise semantics of the code will be different since 'arguments' inside converted loop body | ||
* will refer to function that holds converted loop. | ||
* This value is set on demand. | ||
*/ | ||
argumentsName?: string; | ||
|
||
/* | ||
* list of non-block scoped variable declarations that appear inside converted loop | ||
* such variable declarations should be moved outside the loop body | ||
* such variable declarations should be moved outside the loop body | ||
* for (let x;;) { | ||
* var y = 1; | ||
* ... | ||
* ... | ||
* } | ||
* should be converted to | ||
* var loop = function(x) { | ||
|
@@ -2651,7 +2651,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi | |
} | ||
|
||
function emitCallTarget(node: Expression): Expression { | ||
if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.ThisKeyword || node.kind === SyntaxKind.SuperKeyword) { | ||
if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.ThisKeyword || /*node.kind === SyntaxKind.ThisType ||*/ node.kind === SyntaxKind.SuperKeyword) { | ||
emit(node); | ||
return node; | ||
} | ||
|
@@ -3226,7 +3226,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi | |
} | ||
|
||
if (convertedLoopState && (getCombinedNodeFlags(decl) & NodeFlags.BlockScoped) === 0) { | ||
// we are inside a converted loop - this can only happen in downlevel scenarios | ||
// we are inside a converted loop - this can only happen in downlevel scenarios | ||
// record names for all variable declarations | ||
for (const varDecl of decl.declarations) { | ||
hoistVariableDeclarationFromLoop(convertedLoopState, varDecl); | ||
|
@@ -3551,7 +3551,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi | |
write(`case "${labelMarker}": `); | ||
// if there are no outer converted loop or outer label in question is located inside outer converted loop | ||
// then emit labeled break\continue | ||
// otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do | ||
// otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do | ||
if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { | ||
if (isBreak) { | ||
write("break "); | ||
|
@@ -6006,6 +6006,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi | |
case SyntaxKind.UnionType: | ||
case SyntaxKind.IntersectionType: | ||
case SyntaxKind.AnyKeyword: | ||
case SyntaxKind.ThisType: | ||
break; | ||
|
||
default: | ||
|
@@ -7868,6 +7869,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi | |
case SyntaxKind.GetAccessor: | ||
case SyntaxKind.SetAccessor: | ||
return emitAccessor(<AccessorDeclaration>node); | ||
// case SyntaxKind.ThisType: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like it's left over from development. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep. |
||
// console.log("ThisType: emitJavaScriptWorker"); | ||
case SyntaxKind.ThisKeyword: | ||
return emitThis(node); | ||
case SyntaxKind.SuperKeyword: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,6 +204,7 @@ namespace ts { | |
UnionType, | ||
IntersectionType, | ||
ParenthesizedType, | ||
ThisType, | ||
// Binding patterns | ||
ObjectBindingPattern, | ||
ArrayBindingPattern, | ||
|
@@ -349,7 +350,7 @@ namespace ts { | |
FirstFutureReservedWord = ImplementsKeyword, | ||
LastFutureReservedWord = YieldKeyword, | ||
FirstTypeNode = TypePredicate, | ||
LastTypeNode = ParenthesizedType, | ||
LastTypeNode = ThisType, | ||
FirstPunctuation = OpenBraceToken, | ||
LastPunctuation = CaretEqualsToken, | ||
FirstToken = Unknown, | ||
|
@@ -726,6 +727,7 @@ namespace ts { | |
// @kind(SyntaxKind.StringKeyword) | ||
// @kind(SyntaxKind.SymbolKeyword) | ||
// @kind(SyntaxKind.VoidKeyword) | ||
// @kind(SyntaxKind.ThisType) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about string literal types? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there would need to be a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @DanielRosenwasser, @weswigham: I primarily need this to disambiguate |
||
export interface TypeNode extends Node { | ||
_typeNodeBrand: any; | ||
} | ||
|
@@ -1075,7 +1077,6 @@ namespace ts { | |
export interface DebuggerStatement extends Statement { } | ||
|
||
// @kind(SyntaxKind.MissingDeclaration) | ||
// @factoryhidden("name", true) | ||
export interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement { | ||
name?: Identifier; | ||
} | ||
|
@@ -1232,7 +1233,6 @@ namespace ts { | |
export interface TypeElement extends Declaration { | ||
_typeElementBrand: any; | ||
name?: PropertyName; | ||
// @factoryparam | ||
questionToken?: Node; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this check be for ThisKeyword or ThisType? Or is the commented ThisType left over from development?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is left over.