Much better comment preservation (#22141)

* Retain comments on (and produce sourcemaps on) the equals token in initializers

* Improved comments/sourcemaps for await, yield, while, and for

* Retain comments on block curly-braces

* Emit comments for if statements

* Improved switch case comment emit

* Improve comment and sourcemap emit for try/catch, throw, and continue statements

* Improve sourcemap emit and comments for with statements

* More accurate sourcemaps+comments emit for new, typeof, void, and delete

* Improve comment emit for element access expressions

* Preserve more comments on imports and exports

* Make function a bit more defensive like other usages of emitTrailingCommentsOfPosition

* Support preserving comments within empty lists

* Handle leading comments of tokens, conditionally indent leading comments

* Stop heuristically sourcemapping tokens

When the transform was trivial it worked, but was unneeded, but when it was complex, it was brittle - best leave source mapping up to the transformers

* Fix unneeded +1

* Tighten up element access comments

* Handle comments on parenthesized expression tokens

* Fix nit
This commit is contained in:
Wesley Wigham
2018-03-02 17:23:59 -08:00
committed by GitHub
parent 25525bc9d6
commit 1c93744a9c
951 changed files with 22314 additions and 25785 deletions

View File

@@ -998,7 +998,8 @@ namespace ts {
else {
emitTypeAnnotation(node.type);
}
emitInitializer(node.initializer);
// The comment position has to fallback to any present node within the parameterdeclaration because as it turns out, the parser can make parameter declarations with _just_ an initializer.
emitInitializer(node.initializer, node.type ? node.type.end : node.questionToken ? node.questionToken.end : node.name ? node.name.end : node.modifiers ? node.modifiers.end : node.decorators ? node.decorators.end : node.pos, node);
}
function emitDecorator(decorator: Decorator) {
@@ -1026,7 +1027,7 @@ namespace ts {
emitIfPresent(node.questionToken);
emitIfPresent(node.exclamationToken);
emitTypeAnnotation(node.type);
emitInitializer(node.initializer);
emitInitializer(node.initializer, node.type ? node.type.end : node.questionToken ? node.questionToken.end : node.name.end, node);
writeSemicolon();
}
@@ -1308,7 +1309,7 @@ namespace ts {
writeSpace();
}
emit(node.name);
emitInitializer(node.initializer);
emitInitializer(node.initializer, node.name.end, node);
}
//
@@ -1353,7 +1354,10 @@ namespace ts {
increaseIndentIf(indentBeforeDot);
const shouldEmitDotDot = !indentBeforeDot && needsDotDotForPropertyAccess(node.expression);
writePunctuation(shouldEmitDotDot ? ".." : ".");
if (shouldEmitDotDot) {
writePunctuation(".");
}
emitTokenWithComment(SyntaxKind.DotToken, node.expression.end, writePunctuation, node);
increaseIndentIf(indentAfterDot);
emit(node.name);
@@ -1382,9 +1386,9 @@ namespace ts {
function emitElementAccessExpression(node: ElementAccessExpression) {
emitExpression(node.expression);
writePunctuation("[");
const openPos = emitTokenWithComment(SyntaxKind.OpenBracketToken, node.expression.end, writePunctuation, node);
emitExpression(node.argumentExpression);
writePunctuation("]");
emitTokenWithComment(SyntaxKind.CloseBracketToken, node.argumentExpression ? node.argumentExpression.end : openPos, writePunctuation, node);
}
function emitCallExpression(node: CallExpression) {
@@ -1394,7 +1398,7 @@ namespace ts {
}
function emitNewExpression(node: NewExpression) {
writeKeyword("new");
emitTokenWithComment(SyntaxKind.NewKeyword, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTypeArguments(node, node.typeArguments);
@@ -1415,9 +1419,9 @@ namespace ts {
}
function emitParenthesizedExpression(node: ParenthesizedExpression) {
writePunctuation("(");
const openParenPos = emitTokenWithComment(SyntaxKind.OpenParenToken, node.pos, writePunctuation, node);
emitExpression(node.expression);
writePunctuation(")");
emitTokenWithComment(SyntaxKind.CloseParenToken, node.expression ? node.expression.end : openParenPos, writePunctuation, node);
}
function emitFunctionExpression(node: FunctionExpression) {
@@ -1439,25 +1443,25 @@ namespace ts {
}
function emitDeleteExpression(node: DeleteExpression) {
writeKeyword("delete");
emitTokenWithComment(SyntaxKind.DeleteKeyword, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitTypeOfExpression(node: TypeOfExpression) {
writeKeyword("typeof");
emitTokenWithComment(SyntaxKind.TypeOfKeyword, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitVoidExpression(node: VoidExpression) {
writeKeyword("void");
emitTokenWithComment(SyntaxKind.VoidKeyword, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitAwaitExpression(node: AwaitExpression) {
writeKeyword("await");
emitTokenWithComment(SyntaxKind.AwaitKeyword, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
@@ -1535,7 +1539,7 @@ namespace ts {
}
function emitYieldExpression(node: YieldExpression) {
writeKeyword("yield");
emitTokenWithComment(SyntaxKind.YieldKeyword, node.pos, writeKeyword, node);
emit(node.asteriskToken);
emitExpressionWithLeadingSpace(node.expression);
}
@@ -1589,18 +1593,14 @@ namespace ts {
//
function emitBlock(node: Block) {
writeToken(SyntaxKind.OpenBraceToken, node.pos, writePunctuation, /*contextNode*/ node);
emitBlockStatements(node, /*forceSingleLine*/ !node.multiLine && isEmptyBlock(node));
// We have to call emitLeadingComments explicitly here because otherwise leading comments of the close brace token will not be emitted
increaseIndent();
emitLeadingCommentsOfPosition(node.statements.end);
decreaseIndent();
writeToken(SyntaxKind.CloseBraceToken, node.statements.end, writePunctuation, /*contextNode*/ node);
}
function emitBlockStatements(node: BlockLike, forceSingleLine: boolean) {
emitTokenWithComment(SyntaxKind.OpenBraceToken, node.pos, writePunctuation, /*contextNode*/ node);
const format = forceSingleLine || getEmitFlags(node) & EmitFlags.SingleLine ? ListFormat.SingleLineBlockStatements : ListFormat.MultiLineBlockStatements;
emitList(node, node.statements, format);
emitTokenWithComment(SyntaxKind.CloseBraceToken, node.statements.end, writePunctuation, /*contextNode*/ node, /*indentLeading*/ !!(format & ListFormat.MultiLine));
}
function emitVariableStatement(node: VariableStatement) {
@@ -1619,15 +1619,15 @@ namespace ts {
}
function emitIfStatement(node: IfStatement) {
const openParenPos = writeToken(SyntaxKind.IfKeyword, node.pos, writeKeyword, node);
const openParenPos = emitTokenWithComment(SyntaxKind.IfKeyword, node.pos, writeKeyword, node);
writeSpace();
writeToken(SyntaxKind.OpenParenToken, openParenPos, writePunctuation, node);
emitTokenWithComment(SyntaxKind.OpenParenToken, openParenPos, writePunctuation, node);
emitExpression(node.expression);
writeToken(SyntaxKind.CloseParenToken, node.expression.end, writePunctuation, node);
emitTokenWithComment(SyntaxKind.CloseParenToken, node.expression.end, writePunctuation, node);
emitEmbeddedStatement(node, node.thenStatement);
if (node.elseStatement) {
writeLineOrSpace(node);
writeToken(SyntaxKind.ElseKeyword, node.thenStatement.end, writeKeyword, node);
emitTokenWithComment(SyntaxKind.ElseKeyword, node.thenStatement.end, writeKeyword, node);
if (node.elseStatement.kind === SyntaxKind.IfStatement) {
writeSpace();
emit(node.elseStatement);
@@ -1638,8 +1638,16 @@ namespace ts {
}
}
function emitWhileClause(node: WhileStatement | DoStatement, startPos: number) {
const openParenPos = emitTokenWithComment(SyntaxKind.WhileKeyword, startPos, writeKeyword, node);
writeSpace();
emitTokenWithComment(SyntaxKind.OpenParenToken, openParenPos, writePunctuation, node);
emitExpression(node.expression);
emitTokenWithComment(SyntaxKind.CloseParenToken, node.expression.end, writePunctuation, node);
}
function emitDoStatement(node: DoStatement) {
writeKeyword("do");
emitTokenWithComment(SyntaxKind.DoKeyword, node.pos, writeKeyword, node);
emitEmbeddedStatement(node, node.statement);
if (isBlock(node.statement)) {
writeSpace();
@@ -1648,59 +1656,52 @@ namespace ts {
writeLineOrSpace(node);
}
writeKeyword("while");
writeSpace();
writePunctuation("(");
emitExpression(node.expression);
writePunctuation(");");
emitWhileClause(node, node.statement.end);
writePunctuation(";");
}
function emitWhileStatement(node: WhileStatement) {
writeKeyword("while");
writeSpace();
writePunctuation("(");
emitExpression(node.expression);
writePunctuation(")");
emitWhileClause(node, node.pos);
emitEmbeddedStatement(node, node.statement);
}
function emitForStatement(node: ForStatement) {
const openParenPos = writeToken(SyntaxKind.ForKeyword, node.pos, writeKeyword);
const openParenPos = emitTokenWithComment(SyntaxKind.ForKeyword, node.pos, writeKeyword, node);
writeSpace();
writeToken(SyntaxKind.OpenParenToken, openParenPos, writePunctuation, /*contextNode*/ node);
let pos = emitTokenWithComment(SyntaxKind.OpenParenToken, openParenPos, writePunctuation, /*contextNode*/ node);
emitForBinding(node.initializer);
writeSemicolon();
pos = emitTokenWithComment(SyntaxKind.SemicolonToken, node.initializer ? node.initializer.end : pos, writeSemicolon, node);
emitExpressionWithLeadingSpace(node.condition);
writeSemicolon();
pos = emitTokenWithComment(SyntaxKind.SemicolonToken, node.condition ? node.condition.end : pos, writeSemicolon, node);
emitExpressionWithLeadingSpace(node.incrementor);
writePunctuation(")");
emitTokenWithComment(SyntaxKind.CloseParenToken, node.incrementor ? node.incrementor.end : pos, writePunctuation, node);
emitEmbeddedStatement(node, node.statement);
}
function emitForInStatement(node: ForInStatement) {
const openParenPos = writeToken(SyntaxKind.ForKeyword, node.pos, writeKeyword);
const openParenPos = emitTokenWithComment(SyntaxKind.ForKeyword, node.pos, writeKeyword, node);
writeSpace();
writeToken(SyntaxKind.OpenParenToken, openParenPos, writePunctuation);
emitTokenWithComment(SyntaxKind.OpenParenToken, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
writeKeyword("in");
emitTokenWithComment(SyntaxKind.InKeyword, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
writeToken(SyntaxKind.CloseParenToken, node.expression.end, writePunctuation);
emitTokenWithComment(SyntaxKind.CloseParenToken, node.expression.end, writePunctuation, node);
emitEmbeddedStatement(node, node.statement);
}
function emitForOfStatement(node: ForOfStatement) {
const openParenPos = writeToken(SyntaxKind.ForKeyword, node.pos, writeKeyword);
const openParenPos = emitTokenWithComment(SyntaxKind.ForKeyword, node.pos, writeKeyword, node);
writeSpace();
emitWithTrailingSpace(node.awaitModifier);
writeToken(SyntaxKind.OpenParenToken, openParenPos, writePunctuation);
emitTokenWithComment(SyntaxKind.OpenParenToken, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
writeKeyword("of");
emitTokenWithComment(SyntaxKind.OfKeyword, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
writeToken(SyntaxKind.CloseParenToken, node.expression.end, writePunctuation);
emitTokenWithComment(SyntaxKind.CloseParenToken, node.expression.end, writePunctuation, node);
emitEmbeddedStatement(node, node.statement);
}
@@ -1716,24 +1717,36 @@ namespace ts {
}
function emitContinueStatement(node: ContinueStatement) {
writeToken(SyntaxKind.ContinueKeyword, node.pos, writeKeyword);
emitTokenWithComment(SyntaxKind.ContinueKeyword, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeSemicolon();
}
function emitBreakStatement(node: BreakStatement) {
writeToken(SyntaxKind.BreakKeyword, node.pos, writeKeyword);
emitTokenWithComment(SyntaxKind.BreakKeyword, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeSemicolon();
}
function emitTokenWithComment(token: SyntaxKind, pos: number, writer: (s: string) => void, contextNode?: Node) {
function emitTokenWithComment(token: SyntaxKind, pos: number, writer: (s: string) => void, contextNode?: Node, indentLeading?: boolean) {
const node = contextNode && getParseTreeNode(contextNode);
if (node && node.kind === contextNode.kind) {
const isSimilarNode = node && node.kind === contextNode.kind;
const startPos = pos;
if (isSimilarNode) {
pos = skipTrivia(currentSourceFile.text, pos);
}
pos = writeToken(token, pos, writer, /*contextNode*/ contextNode);
if (node && node.kind === contextNode.kind) {
if (emitLeadingCommentsOfPosition && isSimilarNode) {
const needsIndent = indentLeading && !positionsAreOnSameLine(startPos, pos, currentSourceFile);
if (needsIndent) {
increaseIndent();
}
emitLeadingCommentsOfPosition(startPos);
if (needsIndent) {
decreaseIndent();
}
}
pos = writeTokenText(token, writer, pos);
if (emitTrailingCommentsOfPosition && isSimilarNode) {
emitTrailingCommentsOfPosition(pos, /*prefixSpace*/ true);
}
return pos;
@@ -1746,39 +1759,39 @@ namespace ts {
}
function emitWithStatement(node: WithStatement) {
writeKeyword("with");
const openParenPos = emitTokenWithComment(SyntaxKind.WithKeyword, node.pos, writeKeyword, node);
writeSpace();
writePunctuation("(");
emitTokenWithComment(SyntaxKind.OpenParenToken, openParenPos, writePunctuation, node);
emitExpression(node.expression);
writePunctuation(")");
emitTokenWithComment(SyntaxKind.CloseParenToken, node.expression.end, writePunctuation, node);
emitEmbeddedStatement(node, node.statement);
}
function emitSwitchStatement(node: SwitchStatement) {
const openParenPos = writeToken(SyntaxKind.SwitchKeyword, node.pos, writeKeyword);
const openParenPos = emitTokenWithComment(SyntaxKind.SwitchKeyword, node.pos, writeKeyword, node);
writeSpace();
writeToken(SyntaxKind.OpenParenToken, openParenPos, writePunctuation);
emitTokenWithComment(SyntaxKind.OpenParenToken, openParenPos, writePunctuation, node);
emitExpression(node.expression);
writeToken(SyntaxKind.CloseParenToken, node.expression.end, writePunctuation);
emitTokenWithComment(SyntaxKind.CloseParenToken, node.expression.end, writePunctuation, node);
writeSpace();
emit(node.caseBlock);
}
function emitLabeledStatement(node: LabeledStatement) {
emit(node.label);
writePunctuation(":");
emitTokenWithComment(SyntaxKind.ColonToken, node.label.end, writePunctuation, node);
writeSpace();
emit(node.statement);
}
function emitThrowStatement(node: ThrowStatement) {
writeKeyword("throw");
emitTokenWithComment(SyntaxKind.ThrowKeyword, node.pos, writeKeyword, node);
emitExpressionWithLeadingSpace(node.expression);
writeSemicolon();
}
function emitTryStatement(node: TryStatement) {
writeKeyword("try");
emitTokenWithComment(SyntaxKind.TryKeyword, node.pos, writeKeyword, node);
writeSpace();
emit(node.tryBlock);
if (node.catchClause) {
@@ -1787,7 +1800,7 @@ namespace ts {
}
if (node.finallyBlock) {
writeLineOrSpace(node);
writeKeyword("finally");
emitTokenWithComment(SyntaxKind.FinallyKeyword, (node.catchClause || node.tryBlock).end, writeKeyword, node);
writeSpace();
emit(node.finallyBlock);
}
@@ -1805,7 +1818,7 @@ namespace ts {
function emitVariableDeclaration(node: VariableDeclaration) {
emit(node.name);
emitTypeAnnotation(node.type);
emitInitializer(node.initializer);
emitInitializer(node.initializer, node.type ? node.type.end : node.name.end, node);
}
function emitVariableDeclarationList(node: VariableDeclarationList) {
@@ -2043,25 +2056,23 @@ namespace ts {
function emitModuleBlock(node: ModuleBlock) {
pushNameGenerationScope(node);
writePunctuation("{");
emitBlockStatements(node, /*forceSingleLine*/ isEmptyBlock(node));
writePunctuation("}");
popNameGenerationScope(node);
}
function emitCaseBlock(node: CaseBlock) {
writeToken(SyntaxKind.OpenBraceToken, node.pos, writePunctuation);
emitTokenWithComment(SyntaxKind.OpenBraceToken, node.pos, writePunctuation, node);
emitList(node, node.clauses, ListFormat.CaseBlockClauses);
writeToken(SyntaxKind.CloseBraceToken, node.clauses.end, writePunctuation);
emitTokenWithComment(SyntaxKind.CloseBraceToken, node.clauses.end, writePunctuation, node, /*indentLeading*/ true);
}
function emitImportEqualsDeclaration(node: ImportEqualsDeclaration) {
emitModifiers(node, node.modifiers);
writeKeyword("import");
emitTokenWithComment(SyntaxKind.ImportKeyword, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
emit(node.name);
writeSpace();
writePunctuation("=");
emitTokenWithComment(SyntaxKind.EqualsToken, node.name.end, writePunctuation, node);
writeSpace();
emitModuleReference(node.moduleReference);
writeSemicolon();
@@ -2078,12 +2089,12 @@ namespace ts {
function emitImportDeclaration(node: ImportDeclaration) {
emitModifiers(node, node.modifiers);
writeKeyword("import");
emitTokenWithComment(SyntaxKind.ImportKeyword, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
if (node.importClause) {
emit(node.importClause);
writeSpace();
writeKeyword("from");
emitTokenWithComment(SyntaxKind.FromKeyword, node.importClause.end, writeKeyword, node);
writeSpace();
}
emitExpression(node.moduleSpecifier);
@@ -2093,16 +2104,16 @@ namespace ts {
function emitImportClause(node: ImportClause) {
emit(node.name);
if (node.name && node.namedBindings) {
writePunctuation(",");
emitTokenWithComment(SyntaxKind.CommaToken, node.name.end, writePunctuation, node);
writeSpace();
}
emit(node.namedBindings);
}
function emitNamespaceImport(node: NamespaceImport) {
writePunctuation("*");
const asPos = emitTokenWithComment(SyntaxKind.AsteriskToken, node.pos, writePunctuation, node);
writeSpace();
writeKeyword("as");
emitTokenWithComment(SyntaxKind.AsKeyword, asPos, writeKeyword, node);
writeSpace();
emit(node.name);
}
@@ -2116,13 +2127,13 @@ namespace ts {
}
function emitExportAssignment(node: ExportAssignment) {
writeKeyword("export");
const nextPos = emitTokenWithComment(SyntaxKind.ExportKeyword, node.pos, writeKeyword, node);
writeSpace();
if (node.isExportEquals) {
writeOperator("=");
emitTokenWithComment(SyntaxKind.EqualsToken, nextPos, writeOperator, node);
}
else {
writeKeyword("default");
emitTokenWithComment(SyntaxKind.DefaultKeyword, nextPos, writeKeyword, node);
}
writeSpace();
emitExpression(node.expression);
@@ -2130,17 +2141,18 @@ namespace ts {
}
function emitExportDeclaration(node: ExportDeclaration) {
writeKeyword("export");
let nextPos = emitTokenWithComment(SyntaxKind.ExportKeyword, node.pos, writeKeyword, node);
writeSpace();
if (node.exportClause) {
emit(node.exportClause);
}
else {
writePunctuation("*");
nextPos = emitTokenWithComment(SyntaxKind.AsteriskToken, nextPos, writePunctuation, node);
}
if (node.moduleSpecifier) {
writeSpace();
writeKeyword("from");
const fromPos = node.exportClause ? node.exportClause.end : nextPos;
emitTokenWithComment(SyntaxKind.FromKeyword, fromPos, writeKeyword, node);
writeSpace();
emitExpression(node.moduleSpecifier);
}
@@ -2148,11 +2160,11 @@ namespace ts {
}
function emitNamespaceExportDeclaration(node: NamespaceExportDeclaration) {
writeKeyword("export");
let nextPos = emitTokenWithComment(SyntaxKind.ExportKeyword, node.pos, writeKeyword, node);
writeSpace();
writeKeyword("as");
nextPos = emitTokenWithComment(SyntaxKind.AsKeyword, nextPos, writeKeyword, node);
writeSpace();
writeKeyword("namespace");
nextPos = emitTokenWithComment(SyntaxKind.NamespaceKeyword, nextPos, writeKeyword, node);
writeSpace();
emit(node.name);
writeSemicolon();
@@ -2176,7 +2188,7 @@ namespace ts {
if (node.propertyName) {
emit(node.propertyName);
writeSpace();
writeKeyword("as");
emitTokenWithComment(SyntaxKind.AsKeyword, node.propertyName.end, writeKeyword, node);
writeSpace();
}
@@ -2287,21 +2299,19 @@ namespace ts {
//
function emitCaseClause(node: CaseClause) {
writeKeyword("case");
emitTokenWithComment(SyntaxKind.CaseKeyword, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
writePunctuation(":");
emitCaseOrDefaultClauseStatements(node, node.statements);
emitCaseOrDefaultClauseRest(node, node.statements, node.expression.end);
}
function emitDefaultClause(node: DefaultClause) {
writeKeyword("default");
writePunctuation(":");
emitCaseOrDefaultClauseStatements(node, node.statements);
const pos = emitTokenWithComment(SyntaxKind.DefaultKeyword, node.pos, writeKeyword, node);
emitCaseOrDefaultClauseRest(node, node.statements, pos);
}
function emitCaseOrDefaultClauseStatements(parentNode: Node, statements: NodeArray<Statement>) {
function emitCaseOrDefaultClauseRest(parentNode: Node, statements: NodeArray<Statement>, colonPos: number) {
const emitAsSingleStatement =
statements.length === 1 &&
(
@@ -2311,27 +2321,15 @@ namespace ts {
rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile)
);
// e.g:
// case 0: // Zero
// case 1: // One
// case 2: // two
// return "hi";
// If there is no statements, emitNodeWithComments of the parentNode which is caseClause will take care of trailing comment.
// So in example above, comment "// Zero" and "// One" will be emit in emitTrailingComments in emitNodeWithComments.
// However, for "case 2", because parentNode which is caseClause has an "end" property to be end of the statements (in this case return statement)
// comment "// two" will not be emitted in emitNodeWithComments.
// Therefore, we have to do the check here to emit such comment.
if (statements.length > 0) {
// We use emitTrailingCommentsOfPosition instead of emitLeadingCommentsOfPosition because leading comments is defined as comments before the node after newline character separating it from previous line
// Note: we can't use parentNode.end as such position includes statements.
emitTrailingCommentsOfPosition(statements.pos);
}
let format = ListFormat.CaseOrDefaultClauseStatements;
if (emitAsSingleStatement) {
writeToken(SyntaxKind.ColonToken, colonPos, writePunctuation, parentNode);
writeSpace();
format &= ~(ListFormat.MultiLine | ListFormat.Indented);
}
else {
emitTokenWithComment(SyntaxKind.ColonToken, colonPos, writePunctuation, parentNode);
}
emitList(parentNode, statements, format);
}
@@ -2343,12 +2341,12 @@ namespace ts {
}
function emitCatchClause(node: CatchClause) {
const openParenPos = writeToken(SyntaxKind.CatchKeyword, node.pos, writeKeyword);
const openParenPos = emitTokenWithComment(SyntaxKind.CatchKeyword, node.pos, writeKeyword, node);
writeSpace();
if (node.variableDeclaration) {
writeToken(SyntaxKind.OpenParenToken, openParenPos, writePunctuation);
emitTokenWithComment(SyntaxKind.OpenParenToken, openParenPos, writePunctuation, node);
emit(node.variableDeclaration);
writeToken(SyntaxKind.CloseParenToken, node.variableDeclaration.end, writePunctuation);
emitTokenWithComment(SyntaxKind.CloseParenToken, node.variableDeclaration.end, writePunctuation, node);
writeSpace();
}
emit(node.block);
@@ -2400,7 +2398,7 @@ namespace ts {
function emitEnumMember(node: EnumMember) {
emit(node.name);
emitInitializer(node.initializer);
emitInitializer(node.initializer, node.name.end, node);
}
//
@@ -2530,10 +2528,10 @@ namespace ts {
}
}
function emitInitializer(node: Expression | undefined) {
function emitInitializer(node: Expression | undefined, equalCommentStartPos: number, container: Node) {
if (node) {
writeSpace();
writeOperator("=");
emitTokenWithComment(SyntaxKind.EqualsToken, equalCommentStartPos, writeOperator, container);
writeSpace();
emitExpression(node);
}
@@ -2674,6 +2672,9 @@ namespace ts {
if (format & ListFormat.BracketsMask) {
writePunctuation(getOpeningBracket(format));
if (isEmpty) {
emitTrailingCommentsOfPosition(children.pos, /*prefixSpace*/ true); // Emit comments within empty bracketed lists
}
}
if (onBeforeEmitNodeArray) {
@@ -2799,6 +2800,9 @@ namespace ts {
}
if (format & ListFormat.BracketsMask) {
if (isEmpty) {
emitLeadingCommentsOfPosition(children.end); // Emit leading comments within empty lists
}
writePunctuation(getClosingBracket(format));
}
}

View File

@@ -1,2 +1,2 @@
//// [ES5For-of1.js.map]
{"version":3,"file":"ES5For-of1.js","sourceRoot":"","sources":["ES5For-of1.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe;IAAxB,IAAI,CAAC,SAAA;IACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClB"}
{"version":3,"file":"ES5For-of1.js","sourceRoot":"","sources":["ES5For-of1.ts"],"names":[],"mappings":"AAAA,KAAc,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe;IAAxB,IAAI,CAAC,SAAA;IACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClB"}

View File

@@ -10,56 +10,50 @@ sourceFile:ES5For-of1.ts
-------------------------------------------------------------------
>>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) {
1 >
2 >^^^
3 > ^
4 > ^
5 > ^^^^^^^^^^
6 > ^^
7 > ^^^^^^
8 > ^^^
9 > ^^
10> ^^^
11> ^^
12> ^^^
13> ^
14> ^^
15> ^^^^^^^^^^^^^^
16> ^^
17> ^^^^
2 >^^^^^
3 > ^^^^^^^^^^
4 > ^^
5 > ^^^^^^
6 > ^^^
7 > ^^
8 > ^^^
9 > ^^
10> ^^^
11> ^
12> ^^
13> ^^^^^^^^^^^^^^
14> ^^
15> ^^^^
1 >
2 >for
3 >
4 > (var v of
5 > ['a', 'b', 'c']
6 >
7 > [
8 > 'a'
9 > ,
10> 'b'
11> ,
12> 'c'
13> ]
14>
15> ['a', 'b', 'c']
16>
17> ['a', 'b', 'c']
2 >for (var v of
3 > ['a', 'b', 'c']
4 >
5 > [
6 > 'a'
7 > ,
8 > 'b'
9 > ,
10> 'c'
11> ]
12>
13> ['a', 'b', 'c']
14>
15> ['a', 'b', 'c']
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0)
3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
4 >Emitted(1, 6) Source(1, 15) + SourceIndex(0)
5 >Emitted(1, 16) Source(1, 30) + SourceIndex(0)
6 >Emitted(1, 18) Source(1, 15) + SourceIndex(0)
7 >Emitted(1, 24) Source(1, 16) + SourceIndex(0)
8 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
9 >Emitted(1, 29) Source(1, 21) + SourceIndex(0)
10>Emitted(1, 32) Source(1, 24) + SourceIndex(0)
11>Emitted(1, 34) Source(1, 26) + SourceIndex(0)
12>Emitted(1, 37) Source(1, 29) + SourceIndex(0)
13>Emitted(1, 38) Source(1, 30) + SourceIndex(0)
14>Emitted(1, 40) Source(1, 15) + SourceIndex(0)
15>Emitted(1, 54) Source(1, 30) + SourceIndex(0)
16>Emitted(1, 56) Source(1, 15) + SourceIndex(0)
17>Emitted(1, 60) Source(1, 30) + SourceIndex(0)
2 >Emitted(1, 6) Source(1, 15) + SourceIndex(0)
3 >Emitted(1, 16) Source(1, 30) + SourceIndex(0)
4 >Emitted(1, 18) Source(1, 15) + SourceIndex(0)
5 >Emitted(1, 24) Source(1, 16) + SourceIndex(0)
6 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
7 >Emitted(1, 29) Source(1, 21) + SourceIndex(0)
8 >Emitted(1, 32) Source(1, 24) + SourceIndex(0)
9 >Emitted(1, 34) Source(1, 26) + SourceIndex(0)
10>Emitted(1, 37) Source(1, 29) + SourceIndex(0)
11>Emitted(1, 38) Source(1, 30) + SourceIndex(0)
12>Emitted(1, 40) Source(1, 15) + SourceIndex(0)
13>Emitted(1, 54) Source(1, 30) + SourceIndex(0)
14>Emitted(1, 56) Source(1, 15) + SourceIndex(0)
15>Emitted(1, 60) Source(1, 30) + SourceIndex(0)
---
>>> var v = _a[_i];
1 >^^^^

View File

@@ -1,2 +1,2 @@
//// [ES5For-of13.js.map]
{"version":3,"file":"ES5For-of13.js","sourceRoot":"","sources":["ES5For-of13.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe;IAAxB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CACb"}
{"version":3,"file":"ES5For-of13.js","sourceRoot":"","sources":["ES5For-of13.ts"],"names":[],"mappings":"AAAA,KAAc,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe;IAAxB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CACb"}

View File

@@ -10,56 +10,50 @@ sourceFile:ES5For-of13.ts
-------------------------------------------------------------------
>>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) {
1 >
2 >^^^
3 > ^
4 > ^
5 > ^^^^^^^^^^
6 > ^^
7 > ^^^^^^
8 > ^^^
9 > ^^
10> ^^^
11> ^^
12> ^^^
13> ^
14> ^^
15> ^^^^^^^^^^^^^^
16> ^^
17> ^^^^
2 >^^^^^
3 > ^^^^^^^^^^
4 > ^^
5 > ^^^^^^
6 > ^^^
7 > ^^
8 > ^^^
9 > ^^
10> ^^^
11> ^
12> ^^
13> ^^^^^^^^^^^^^^
14> ^^
15> ^^^^
1 >
2 >for
3 >
4 > (let v of
5 > ['a', 'b', 'c']
6 >
7 > [
8 > 'a'
9 > ,
10> 'b'
11> ,
12> 'c'
13> ]
14>
15> ['a', 'b', 'c']
16>
17> ['a', 'b', 'c']
2 >for (let v of
3 > ['a', 'b', 'c']
4 >
5 > [
6 > 'a'
7 > ,
8 > 'b'
9 > ,
10> 'c'
11> ]
12>
13> ['a', 'b', 'c']
14>
15> ['a', 'b', 'c']
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0)
3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
4 >Emitted(1, 6) Source(1, 15) + SourceIndex(0)
5 >Emitted(1, 16) Source(1, 30) + SourceIndex(0)
6 >Emitted(1, 18) Source(1, 15) + SourceIndex(0)
7 >Emitted(1, 24) Source(1, 16) + SourceIndex(0)
8 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
9 >Emitted(1, 29) Source(1, 21) + SourceIndex(0)
10>Emitted(1, 32) Source(1, 24) + SourceIndex(0)
11>Emitted(1, 34) Source(1, 26) + SourceIndex(0)
12>Emitted(1, 37) Source(1, 29) + SourceIndex(0)
13>Emitted(1, 38) Source(1, 30) + SourceIndex(0)
14>Emitted(1, 40) Source(1, 15) + SourceIndex(0)
15>Emitted(1, 54) Source(1, 30) + SourceIndex(0)
16>Emitted(1, 56) Source(1, 15) + SourceIndex(0)
17>Emitted(1, 60) Source(1, 30) + SourceIndex(0)
2 >Emitted(1, 6) Source(1, 15) + SourceIndex(0)
3 >Emitted(1, 16) Source(1, 30) + SourceIndex(0)
4 >Emitted(1, 18) Source(1, 15) + SourceIndex(0)
5 >Emitted(1, 24) Source(1, 16) + SourceIndex(0)
6 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
7 >Emitted(1, 29) Source(1, 21) + SourceIndex(0)
8 >Emitted(1, 32) Source(1, 24) + SourceIndex(0)
9 >Emitted(1, 34) Source(1, 26) + SourceIndex(0)
10>Emitted(1, 37) Source(1, 29) + SourceIndex(0)
11>Emitted(1, 38) Source(1, 30) + SourceIndex(0)
12>Emitted(1, 40) Source(1, 15) + SourceIndex(0)
13>Emitted(1, 54) Source(1, 30) + SourceIndex(0)
14>Emitted(1, 56) Source(1, 15) + SourceIndex(0)
15>Emitted(1, 60) Source(1, 30) + SourceIndex(0)
---
>>> var v = _a[_i];
1 >^^^^

View File

@@ -1,2 +1,2 @@
//// [ES5For-of25.js.map]
{"version":3,"file":"ES5For-of25.js","sourceRoot":"","sources":["ES5For-of25.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,GAAG,CAAC,CAAU,UAAC,EAAD,OAAC,EAAD,eAAC,EAAD,IAAC;IAAV,IAAI,CAAC,UAAA;IACN,CAAC,CAAC;IACF,CAAC,CAAC;CACL"}
{"version":3,"file":"ES5For-of25.js","sourceRoot":"","sources":["ES5For-of25.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,KAAc,UAAC,EAAD,OAAC,EAAD,eAAC,EAAD,IAAC;IAAV,IAAI,CAAC,UAAA;IACN,CAAC,CAAC;IACF,CAAC,CAAC;CACL"}

View File

@@ -49,39 +49,33 @@ sourceFile:ES5For-of25.ts
---
>>>for (var _i = 0, a_1 = a; _i < a_1.length; _i++) {
1->
2 >^^^
3 > ^
4 > ^
5 > ^^^^^^^^^^
6 > ^^
7 > ^^^^^^^
8 > ^^
9 > ^^^^^^^^^^^^^^^
10> ^^
11> ^^^^
2 >^^^^^
3 > ^^^^^^^^^^
4 > ^^
5 > ^^^^^^^
6 > ^^
7 > ^^^^^^^^^^^^^^^
8 > ^^
9 > ^^^^
1->
>
2 >for
3 >
4 > (var v of
5 > a
6 >
7 > a
8 >
9 > a
10>
11> a
2 >for (var v of
3 > a
4 >
5 > a
6 >
7 > a
8 >
9 > a
1->Emitted(2, 1) Source(2, 1) + SourceIndex(0)
2 >Emitted(2, 4) Source(2, 4) + SourceIndex(0)
3 >Emitted(2, 5) Source(2, 5) + SourceIndex(0)
4 >Emitted(2, 6) Source(2, 15) + SourceIndex(0)
5 >Emitted(2, 16) Source(2, 16) + SourceIndex(0)
6 >Emitted(2, 18) Source(2, 15) + SourceIndex(0)
7 >Emitted(2, 25) Source(2, 16) + SourceIndex(0)
8 >Emitted(2, 27) Source(2, 15) + SourceIndex(0)
9 >Emitted(2, 42) Source(2, 16) + SourceIndex(0)
10>Emitted(2, 44) Source(2, 15) + SourceIndex(0)
11>Emitted(2, 48) Source(2, 16) + SourceIndex(0)
2 >Emitted(2, 6) Source(2, 15) + SourceIndex(0)
3 >Emitted(2, 16) Source(2, 16) + SourceIndex(0)
4 >Emitted(2, 18) Source(2, 15) + SourceIndex(0)
5 >Emitted(2, 25) Source(2, 16) + SourceIndex(0)
6 >Emitted(2, 27) Source(2, 15) + SourceIndex(0)
7 >Emitted(2, 42) Source(2, 16) + SourceIndex(0)
8 >Emitted(2, 44) Source(2, 15) + SourceIndex(0)
9 >Emitted(2, 48) Source(2, 16) + SourceIndex(0)
---
>>> var v = a_1[_i];
1 >^^^^

View File

@@ -1,2 +1,2 @@
//// [ES5For-of26.js.map]
{"version":3,"file":"ES5For-of26.js","sourceRoot":"","sources":["ES5For-of26.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAuB,UAAM,EAAN,MAAC,CAAC,EAAE,CAAC,CAAC,EAAN,cAAM,EAAN,IAAM;IAAxB,IAAA,WAAc,EAAb,UAAK,EAAL,0BAAK,EAAE,UAAK,EAAL,0BAAK;IAClB,CAAC,CAAC;IACF,CAAC,CAAC;CACL"}
{"version":3,"file":"ES5For-of26.js","sourceRoot":"","sources":["ES5For-of26.ts"],"names":[],"mappings":"AAAA,KAA2B,UAAM,EAAN,MAAC,CAAC,EAAE,CAAC,CAAC,EAAN,cAAM,EAAN,IAAM;IAAxB,IAAA,WAAc,EAAb,UAAK,EAAL,0BAAK,EAAE,UAAK,EAAL,0BAAK;IAClB,CAAC,CAAC;IACF,CAAC,CAAC;CACL"}

View File

@@ -10,51 +10,45 @@ sourceFile:ES5For-of26.ts
-------------------------------------------------------------------
>>>for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) {
1 >
2 >^^^
3 > ^
4 > ^
5 > ^^^^^^^^^^
6 > ^^
7 > ^^^^^^
8 > ^
9 > ^^
10> ^
11> ^
12> ^^
13> ^^^^^^^^^^^^^^
14> ^^
15> ^^^^
16> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
2 >^^^^^
3 > ^^^^^^^^^^
4 > ^^
5 > ^^^^^^
6 > ^
7 > ^^
8 > ^
9 > ^
10> ^^
11> ^^^^^^^^^^^^^^
12> ^^
13> ^^^^
14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >for
3 >
4 > (var [a = 0, b = 1] of
5 > [2, 3]
6 >
7 > [
8 > 2
9 > ,
10> 3
11> ]
12>
13> [2, 3]
14>
15> [2, 3]
2 >for (var [a = 0, b = 1] of
3 > [2, 3]
4 >
5 > [
6 > 2
7 > ,
8 > 3
9 > ]
10>
11> [2, 3]
12>
13> [2, 3]
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0)
3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
4 >Emitted(1, 6) Source(1, 28) + SourceIndex(0)
5 >Emitted(1, 16) Source(1, 34) + SourceIndex(0)
6 >Emitted(1, 18) Source(1, 28) + SourceIndex(0)
7 >Emitted(1, 24) Source(1, 29) + SourceIndex(0)
8 >Emitted(1, 25) Source(1, 30) + SourceIndex(0)
9 >Emitted(1, 27) Source(1, 32) + SourceIndex(0)
10>Emitted(1, 28) Source(1, 33) + SourceIndex(0)
11>Emitted(1, 29) Source(1, 34) + SourceIndex(0)
12>Emitted(1, 31) Source(1, 28) + SourceIndex(0)
13>Emitted(1, 45) Source(1, 34) + SourceIndex(0)
14>Emitted(1, 47) Source(1, 28) + SourceIndex(0)
15>Emitted(1, 51) Source(1, 34) + SourceIndex(0)
2 >Emitted(1, 6) Source(1, 28) + SourceIndex(0)
3 >Emitted(1, 16) Source(1, 34) + SourceIndex(0)
4 >Emitted(1, 18) Source(1, 28) + SourceIndex(0)
5 >Emitted(1, 24) Source(1, 29) + SourceIndex(0)
6 >Emitted(1, 25) Source(1, 30) + SourceIndex(0)
7 >Emitted(1, 27) Source(1, 32) + SourceIndex(0)
8 >Emitted(1, 28) Source(1, 33) + SourceIndex(0)
9 >Emitted(1, 29) Source(1, 34) + SourceIndex(0)
10>Emitted(1, 31) Source(1, 28) + SourceIndex(0)
11>Emitted(1, 45) Source(1, 34) + SourceIndex(0)
12>Emitted(1, 47) Source(1, 28) + SourceIndex(0)
13>Emitted(1, 51) Source(1, 34) + SourceIndex(0)
---
>>> var _b = _a[_i], _c = _b[0], a = _c === void 0 ? 0 : _c, _d = _b[1], b = _d === void 0 ? 1 : _d;
1->^^^^

View File

@@ -1,2 +1,2 @@
//// [ES5For-of3.js.map]
{"version":3,"file":"ES5For-of3.js","sourceRoot":"","sources":["ES5For-of3.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe;IAAxB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CAAA"}
{"version":3,"file":"ES5For-of3.js","sourceRoot":"","sources":["ES5For-of3.ts"],"names":[],"mappings":"AAAA,KAAc,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe;IAAxB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CAAA"}

View File

@@ -10,56 +10,50 @@ sourceFile:ES5For-of3.ts
-------------------------------------------------------------------
>>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) {
1 >
2 >^^^
3 > ^
4 > ^
5 > ^^^^^^^^^^
6 > ^^
7 > ^^^^^^
8 > ^^^
9 > ^^
10> ^^^
11> ^^
12> ^^^
13> ^
14> ^^
15> ^^^^^^^^^^^^^^
16> ^^
17> ^^^^
2 >^^^^^
3 > ^^^^^^^^^^
4 > ^^
5 > ^^^^^^
6 > ^^^
7 > ^^
8 > ^^^
9 > ^^
10> ^^^
11> ^
12> ^^
13> ^^^^^^^^^^^^^^
14> ^^
15> ^^^^
1 >
2 >for
3 >
4 > (var v of
5 > ['a', 'b', 'c']
6 >
7 > [
8 > 'a'
9 > ,
10> 'b'
11> ,
12> 'c'
13> ]
14>
15> ['a', 'b', 'c']
16>
17> ['a', 'b', 'c']
2 >for (var v of
3 > ['a', 'b', 'c']
4 >
5 > [
6 > 'a'
7 > ,
8 > 'b'
9 > ,
10> 'c'
11> ]
12>
13> ['a', 'b', 'c']
14>
15> ['a', 'b', 'c']
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0)
3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
4 >Emitted(1, 6) Source(1, 15) + SourceIndex(0)
5 >Emitted(1, 16) Source(1, 30) + SourceIndex(0)
6 >Emitted(1, 18) Source(1, 15) + SourceIndex(0)
7 >Emitted(1, 24) Source(1, 16) + SourceIndex(0)
8 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
9 >Emitted(1, 29) Source(1, 21) + SourceIndex(0)
10>Emitted(1, 32) Source(1, 24) + SourceIndex(0)
11>Emitted(1, 34) Source(1, 26) + SourceIndex(0)
12>Emitted(1, 37) Source(1, 29) + SourceIndex(0)
13>Emitted(1, 38) Source(1, 30) + SourceIndex(0)
14>Emitted(1, 40) Source(1, 15) + SourceIndex(0)
15>Emitted(1, 54) Source(1, 30) + SourceIndex(0)
16>Emitted(1, 56) Source(1, 15) + SourceIndex(0)
17>Emitted(1, 60) Source(1, 30) + SourceIndex(0)
2 >Emitted(1, 6) Source(1, 15) + SourceIndex(0)
3 >Emitted(1, 16) Source(1, 30) + SourceIndex(0)
4 >Emitted(1, 18) Source(1, 15) + SourceIndex(0)
5 >Emitted(1, 24) Source(1, 16) + SourceIndex(0)
6 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
7 >Emitted(1, 29) Source(1, 21) + SourceIndex(0)
8 >Emitted(1, 32) Source(1, 24) + SourceIndex(0)
9 >Emitted(1, 34) Source(1, 26) + SourceIndex(0)
10>Emitted(1, 37) Source(1, 29) + SourceIndex(0)
11>Emitted(1, 38) Source(1, 30) + SourceIndex(0)
12>Emitted(1, 40) Source(1, 15) + SourceIndex(0)
13>Emitted(1, 54) Source(1, 30) + SourceIndex(0)
14>Emitted(1, 56) Source(1, 15) + SourceIndex(0)
15>Emitted(1, 60) Source(1, 30) + SourceIndex(0)
---
>>> var v = _a[_i];
1 >^^^^

View File

@@ -1,2 +1,2 @@
//// [ES5For-of33.js.map]
{"version":3,"file":"ES5For-of33.js","sourceRoot":"","sources":["ES5For-of33.ts"],"names":[],"mappings":";;;;;;;;;;;IAAA,GAAG,CAAC,CAAU,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA;QAAxB,IAAI,CAAC,WAAA;QACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAClB"}
{"version":3,"file":"ES5For-of33.js","sourceRoot":"","sources":["ES5For-of33.ts"],"names":[],"mappings":";;;;;;;;;;;IAAA,KAAc,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA;QAAxB,IAAI,CAAC,WAAA;QACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAClB"}

View File

@@ -21,53 +21,47 @@ sourceFile:ES5For-of33.ts
>>>try {
>>> for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) {
1 >^^^^
2 > ^^^
3 > ^
4 > ^
5 > ^^^^
6 > ^^^^^
7 > ^^^^^^^^^
8 > ^
9 > ^^^
10> ^^
11> ^^^
12> ^^
13> ^^^
14> ^
15> ^
16> ^^^^^^^^^^^^^^^^
2 > ^^^^^
3 > ^^^^
4 > ^^^^^
5 > ^^^^^^^^^
6 > ^
7 > ^^^
8 > ^^
9 > ^^^
10> ^^
11> ^^^
12> ^
13> ^
14> ^^^^^^^^^^^^^^^^
1 >
2 > for
3 >
4 > (var v of
5 >
6 >
7 >
8 > [
9 > 'a'
10> ,
11> 'b'
12> ,
13> 'c'
14> ]
15>
16>
2 > for (var v of
3 >
4 >
5 >
6 > [
7 > 'a'
8 > ,
9 > 'b'
10> ,
11> 'c'
12> ]
13>
14>
1 >Emitted(12, 5) Source(1, 1) + SourceIndex(0)
2 >Emitted(12, 8) Source(1, 4) + SourceIndex(0)
3 >Emitted(12, 9) Source(1, 5) + SourceIndex(0)
4 >Emitted(12, 10) Source(1, 15) + SourceIndex(0)
5 >Emitted(12, 14) Source(1, 15) + SourceIndex(0)
6 >Emitted(12, 19) Source(1, 15) + SourceIndex(0)
7 >Emitted(12, 28) Source(1, 15) + SourceIndex(0)
8 >Emitted(12, 29) Source(1, 16) + SourceIndex(0)
9 >Emitted(12, 32) Source(1, 19) + SourceIndex(0)
10>Emitted(12, 34) Source(1, 21) + SourceIndex(0)
11>Emitted(12, 37) Source(1, 24) + SourceIndex(0)
12>Emitted(12, 39) Source(1, 26) + SourceIndex(0)
13>Emitted(12, 42) Source(1, 29) + SourceIndex(0)
14>Emitted(12, 43) Source(1, 30) + SourceIndex(0)
15>Emitted(12, 44) Source(1, 30) + SourceIndex(0)
16>Emitted(12, 60) Source(1, 30) + SourceIndex(0)
2 >Emitted(12, 10) Source(1, 15) + SourceIndex(0)
3 >Emitted(12, 14) Source(1, 15) + SourceIndex(0)
4 >Emitted(12, 19) Source(1, 15) + SourceIndex(0)
5 >Emitted(12, 28) Source(1, 15) + SourceIndex(0)
6 >Emitted(12, 29) Source(1, 16) + SourceIndex(0)
7 >Emitted(12, 32) Source(1, 19) + SourceIndex(0)
8 >Emitted(12, 34) Source(1, 21) + SourceIndex(0)
9 >Emitted(12, 37) Source(1, 24) + SourceIndex(0)
10>Emitted(12, 39) Source(1, 26) + SourceIndex(0)
11>Emitted(12, 42) Source(1, 29) + SourceIndex(0)
12>Emitted(12, 43) Source(1, 30) + SourceIndex(0)
13>Emitted(12, 44) Source(1, 30) + SourceIndex(0)
14>Emitted(12, 60) Source(1, 30) + SourceIndex(0)
---
>>> var v = _b.value;
1 >^^^^^^^^

View File

@@ -1,2 +1,2 @@
//// [ES5For-of34.js.map]
{"version":3,"file":"ES5For-of34.js","sourceRoot":"","sources":["ES5For-of34.ts"],"names":[],"mappings":";;;;;;;;;;AAAA;IACI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;;IACD,GAAG,CAAC,CAAY,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA;QAA1B,GAAG,EAAE,CAAC,CAAC,WAAA;QACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;KACnB"}
{"version":3,"file":"ES5For-of34.js","sourceRoot":"","sources":["ES5For-of34.ts"],"names":[],"mappings":";;;;;;;;;;AAAA;IACI,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;;IACD,KAAgB,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA;QAA1B,GAAG,EAAE,CAAC,CAAC,WAAA;QACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;KACnB"}

View File

@@ -26,33 +26,30 @@ sourceFile:ES5For-of34.ts
---
>>> return { x: 0 };
1->^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
6 > ^^
7 > ^
8 > ^^
9 > ^
2 > ^^^^^^^
3 > ^^
4 > ^
5 > ^^
6 > ^
7 > ^^
8 > ^
1->function foo() {
>
2 > return
3 >
4 > {
5 > x
6 > :
7 > 0
8 > }
9 > ;
2 > return
3 > {
4 > x
5 > :
6 > 0
7 > }
8 > ;
1->Emitted(12, 5) Source(2, 5) + SourceIndex(0)
2 >Emitted(12, 11) Source(2, 11) + SourceIndex(0)
3 >Emitted(12, 12) Source(2, 12) + SourceIndex(0)
4 >Emitted(12, 14) Source(2, 14) + SourceIndex(0)
5 >Emitted(12, 15) Source(2, 15) + SourceIndex(0)
6 >Emitted(12, 17) Source(2, 17) + SourceIndex(0)
7 >Emitted(12, 18) Source(2, 18) + SourceIndex(0)
8 >Emitted(12, 20) Source(2, 20) + SourceIndex(0)
9 >Emitted(12, 21) Source(2, 21) + SourceIndex(0)
2 >Emitted(12, 12) Source(2, 12) + SourceIndex(0)
3 >Emitted(12, 14) Source(2, 14) + SourceIndex(0)
4 >Emitted(12, 15) Source(2, 15) + SourceIndex(0)
5 >Emitted(12, 17) Source(2, 17) + SourceIndex(0)
6 >Emitted(12, 18) Source(2, 18) + SourceIndex(0)
7 >Emitted(12, 20) Source(2, 20) + SourceIndex(0)
8 >Emitted(12, 21) Source(2, 21) + SourceIndex(0)
---
>>>}
1 >
@@ -67,54 +64,48 @@ sourceFile:ES5For-of34.ts
>>>try {
>>> for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) {
1->^^^^
2 > ^^^
3 > ^
4 > ^
5 > ^^^^
6 > ^^^^^
7 > ^^^^^^^^^
8 > ^
9 > ^^^
10> ^^
11> ^^^
12> ^^
13> ^^^
14> ^
15> ^
16> ^^^^^^^^^^^^^^^^
2 > ^^^^^
3 > ^^^^
4 > ^^^^^
5 > ^^^^^^^^^
6 > ^
7 > ^^^
8 > ^^
9 > ^^^
10> ^^
11> ^^^
12> ^
13> ^
14> ^^^^^^^^^^^^^^^^
1->
>
2 > for
3 >
4 > (foo().x of
5 >
6 >
7 >
8 > [
9 > 'a'
10> ,
11> 'b'
12> ,
13> 'c'
14> ]
15>
16>
2 > for (foo().x of
3 >
4 >
5 >
6 > [
7 > 'a'
8 > ,
9 > 'b'
10> ,
11> 'c'
12> ]
13>
14>
1->Emitted(15, 5) Source(4, 1) + SourceIndex(0)
2 >Emitted(15, 8) Source(4, 4) + SourceIndex(0)
3 >Emitted(15, 9) Source(4, 5) + SourceIndex(0)
4 >Emitted(15, 10) Source(4, 17) + SourceIndex(0)
5 >Emitted(15, 14) Source(4, 17) + SourceIndex(0)
6 >Emitted(15, 19) Source(4, 17) + SourceIndex(0)
7 >Emitted(15, 28) Source(4, 17) + SourceIndex(0)
8 >Emitted(15, 29) Source(4, 18) + SourceIndex(0)
9 >Emitted(15, 32) Source(4, 21) + SourceIndex(0)
10>Emitted(15, 34) Source(4, 23) + SourceIndex(0)
11>Emitted(15, 37) Source(4, 26) + SourceIndex(0)
12>Emitted(15, 39) Source(4, 28) + SourceIndex(0)
13>Emitted(15, 42) Source(4, 31) + SourceIndex(0)
14>Emitted(15, 43) Source(4, 32) + SourceIndex(0)
15>Emitted(15, 44) Source(4, 32) + SourceIndex(0)
16>Emitted(15, 60) Source(4, 32) + SourceIndex(0)
2 >Emitted(15, 10) Source(4, 17) + SourceIndex(0)
3 >Emitted(15, 14) Source(4, 17) + SourceIndex(0)
4 >Emitted(15, 19) Source(4, 17) + SourceIndex(0)
5 >Emitted(15, 28) Source(4, 17) + SourceIndex(0)
6 >Emitted(15, 29) Source(4, 18) + SourceIndex(0)
7 >Emitted(15, 32) Source(4, 21) + SourceIndex(0)
8 >Emitted(15, 34) Source(4, 23) + SourceIndex(0)
9 >Emitted(15, 37) Source(4, 26) + SourceIndex(0)
10>Emitted(15, 39) Source(4, 28) + SourceIndex(0)
11>Emitted(15, 42) Source(4, 31) + SourceIndex(0)
12>Emitted(15, 43) Source(4, 32) + SourceIndex(0)
13>Emitted(15, 44) Source(4, 32) + SourceIndex(0)
14>Emitted(15, 60) Source(4, 32) + SourceIndex(0)
---
>>> foo().x = _b.value;
1 >^^^^^^^^

View File

@@ -1,2 +1,2 @@
//// [ES5For-of35.js.map]
{"version":3,"file":"ES5For-of35.js","sourceRoot":"","sources":["ES5For-of35.ts"],"names":[],"mappings":";;;;;;;;;;;IAAA,GAAG,CAAC,CAA+B,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA;QAA9B,IAAA,aAAoB,EAAnB,SAAQ,EAAR,0BAAQ,EAAE,SAAQ,EAAR,0BAAQ;QAC1B,CAAC,CAAC;QACF,CAAC,CAAC;KACL"}
{"version":3,"file":"ES5For-of35.js","sourceRoot":"","sources":["ES5For-of35.ts"],"names":[],"mappings":";;;;;;;;;;;IAAA,KAAmC,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA;QAA9B,IAAA,aAAoB,EAAnB,SAAQ,EAAR,0BAAQ,EAAE,SAAQ,EAAR,0BAAQ;QAC1B,CAAC,CAAC;QACF,CAAC,CAAC;KACL"}

View File

@@ -21,48 +21,42 @@ sourceFile:ES5For-of35.ts
>>>try {
>>> for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) {
1 >^^^^
2 > ^^^
3 > ^
4 > ^
5 > ^^^^
6 > ^^^^^
7 > ^^^^^^^^^
8 > ^
9 > ^
10> ^^
11> ^
12> ^
13> ^
14> ^^^^^^^^^^^^^^^^
15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
2 > ^^^^^
3 > ^^^^
4 > ^^^^^
5 > ^^^^^^^^^
6 > ^
7 > ^
8 > ^^
9 > ^
10> ^
11> ^
12> ^^^^^^^^^^^^^^^^
13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 > for
3 >
4 > (const {x: a = 0, y: b = 1} of
5 >
6 >
7 >
8 > [
9 > 2
10> ,
11> 3
12> ]
13>
14>
2 > for (const {x: a = 0, y: b = 1} of
3 >
4 >
5 >
6 > [
7 > 2
8 > ,
9 > 3
10> ]
11>
12>
1 >Emitted(12, 5) Source(1, 1) + SourceIndex(0)
2 >Emitted(12, 8) Source(1, 4) + SourceIndex(0)
3 >Emitted(12, 9) Source(1, 5) + SourceIndex(0)
4 >Emitted(12, 10) Source(1, 36) + SourceIndex(0)
5 >Emitted(12, 14) Source(1, 36) + SourceIndex(0)
6 >Emitted(12, 19) Source(1, 36) + SourceIndex(0)
7 >Emitted(12, 28) Source(1, 36) + SourceIndex(0)
8 >Emitted(12, 29) Source(1, 37) + SourceIndex(0)
9 >Emitted(12, 30) Source(1, 38) + SourceIndex(0)
10>Emitted(12, 32) Source(1, 40) + SourceIndex(0)
11>Emitted(12, 33) Source(1, 41) + SourceIndex(0)
12>Emitted(12, 34) Source(1, 42) + SourceIndex(0)
13>Emitted(12, 35) Source(1, 42) + SourceIndex(0)
14>Emitted(12, 51) Source(1, 42) + SourceIndex(0)
2 >Emitted(12, 10) Source(1, 36) + SourceIndex(0)
3 >Emitted(12, 14) Source(1, 36) + SourceIndex(0)
4 >Emitted(12, 19) Source(1, 36) + SourceIndex(0)
5 >Emitted(12, 28) Source(1, 36) + SourceIndex(0)
6 >Emitted(12, 29) Source(1, 37) + SourceIndex(0)
7 >Emitted(12, 30) Source(1, 38) + SourceIndex(0)
8 >Emitted(12, 32) Source(1, 40) + SourceIndex(0)
9 >Emitted(12, 33) Source(1, 41) + SourceIndex(0)
10>Emitted(12, 34) Source(1, 42) + SourceIndex(0)
11>Emitted(12, 35) Source(1, 42) + SourceIndex(0)
12>Emitted(12, 51) Source(1, 42) + SourceIndex(0)
---
>>> var _c = _b.value, _d = _c.x, a = _d === void 0 ? 0 : _d, _e = _c.y, b = _e === void 0 ? 1 : _e;
1->^^^^^^^^

View File

@@ -1,2 +1,2 @@
//// [ES5For-of36.js.map]
{"version":3,"file":"ES5For-of36.js","sourceRoot":"","sources":["ES5For-of36.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA,GAAG,CAAC,CAAuB,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA;QAAxB,IAAA,wBAAc,EAAb,UAAK,EAAL,0BAAK,EAAE,UAAK,EAAL,0BAAK;QAClB,CAAC,CAAC;QACF,CAAC,CAAC;KACL"}
{"version":3,"file":"ES5For-of36.js","sourceRoot":"","sources":["ES5For-of36.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA,KAA2B,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA;QAAxB,IAAA,wBAAc,EAAb,UAAK,EAAL,0BAAK,EAAE,UAAK,EAAL,0BAAK;QAClB,CAAC,CAAC;QACF,CAAC,CAAC;KACL"}

View File

@@ -37,48 +37,42 @@ sourceFile:ES5For-of36.ts
>>>try {
>>> for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) {
1 >^^^^
2 > ^^^
3 > ^
4 > ^
5 > ^^^^
6 > ^^^^^
7 > ^^^^^^^^^
8 > ^
9 > ^
10> ^^
11> ^
12> ^
13> ^
14> ^^^^^^^^^^^^^^^^
15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
2 > ^^^^^
3 > ^^^^
4 > ^^^^^
5 > ^^^^^^^^^
6 > ^
7 > ^
8 > ^^
9 > ^
10> ^
11> ^
12> ^^^^^^^^^^^^^^^^
13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 > for
3 >
4 > (let [a = 0, b = 1] of
5 >
6 >
7 >
8 > [
9 > 2
10> ,
11> 3
12> ]
13>
14>
2 > for (let [a = 0, b = 1] of
3 >
4 >
5 >
6 > [
7 > 2
8 > ,
9 > 3
10> ]
11>
12>
1 >Emitted(28, 5) Source(1, 1) + SourceIndex(0)
2 >Emitted(28, 8) Source(1, 4) + SourceIndex(0)
3 >Emitted(28, 9) Source(1, 5) + SourceIndex(0)
4 >Emitted(28, 10) Source(1, 28) + SourceIndex(0)
5 >Emitted(28, 14) Source(1, 28) + SourceIndex(0)
6 >Emitted(28, 19) Source(1, 28) + SourceIndex(0)
7 >Emitted(28, 28) Source(1, 28) + SourceIndex(0)
8 >Emitted(28, 29) Source(1, 29) + SourceIndex(0)
9 >Emitted(28, 30) Source(1, 30) + SourceIndex(0)
10>Emitted(28, 32) Source(1, 32) + SourceIndex(0)
11>Emitted(28, 33) Source(1, 33) + SourceIndex(0)
12>Emitted(28, 34) Source(1, 34) + SourceIndex(0)
13>Emitted(28, 35) Source(1, 34) + SourceIndex(0)
14>Emitted(28, 51) Source(1, 34) + SourceIndex(0)
2 >Emitted(28, 10) Source(1, 28) + SourceIndex(0)
3 >Emitted(28, 14) Source(1, 28) + SourceIndex(0)
4 >Emitted(28, 19) Source(1, 28) + SourceIndex(0)
5 >Emitted(28, 28) Source(1, 28) + SourceIndex(0)
6 >Emitted(28, 29) Source(1, 29) + SourceIndex(0)
7 >Emitted(28, 30) Source(1, 30) + SourceIndex(0)
8 >Emitted(28, 32) Source(1, 32) + SourceIndex(0)
9 >Emitted(28, 33) Source(1, 33) + SourceIndex(0)
10>Emitted(28, 34) Source(1, 34) + SourceIndex(0)
11>Emitted(28, 35) Source(1, 34) + SourceIndex(0)
12>Emitted(28, 51) Source(1, 34) + SourceIndex(0)
---
>>> var _c = __read(_b.value, 2), _d = _c[0], a = _d === void 0 ? 0 : _d, _e = _c[1], b = _e === void 0 ? 1 : _e;
1->^^^^^^^^

View File

@@ -1,2 +1,2 @@
//// [ES5For-of8.js.map]
{"version":3,"file":"ES5For-of8.js","sourceRoot":"","sources":["ES5For-of8.ts"],"names":[],"mappings":"AAAA;IACI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;AACD,GAAG,CAAC,CAAY,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe;IAA1B,GAAG,EAAE,CAAC,CAAC,SAAA;IACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;CACnB"}
{"version":3,"file":"ES5For-of8.js","sourceRoot":"","sources":["ES5For-of8.ts"],"names":[],"mappings":"AAAA;IACI,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;AACD,KAAgB,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe;IAA1B,GAAG,EAAE,CAAC,CAAC,SAAA;IACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;CACnB"}

View File

@@ -16,33 +16,30 @@ sourceFile:ES5For-of8.ts
---
>>> return { x: 0 };
1->^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
6 > ^^
7 > ^
8 > ^^
9 > ^
2 > ^^^^^^^
3 > ^^
4 > ^
5 > ^^
6 > ^
7 > ^^
8 > ^
1->function foo() {
>
2 > return
3 >
4 > {
5 > x
6 > :
7 > 0
8 > }
9 > ;
2 > return
3 > {
4 > x
5 > :
6 > 0
7 > }
8 > ;
1->Emitted(2, 5) Source(2, 5) + SourceIndex(0)
2 >Emitted(2, 11) Source(2, 11) + SourceIndex(0)
3 >Emitted(2, 12) Source(2, 12) + SourceIndex(0)
4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0)
5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0)
6 >Emitted(2, 17) Source(2, 17) + SourceIndex(0)
7 >Emitted(2, 18) Source(2, 18) + SourceIndex(0)
8 >Emitted(2, 20) Source(2, 20) + SourceIndex(0)
9 >Emitted(2, 21) Source(2, 21) + SourceIndex(0)
2 >Emitted(2, 12) Source(2, 12) + SourceIndex(0)
3 >Emitted(2, 14) Source(2, 14) + SourceIndex(0)
4 >Emitted(2, 15) Source(2, 15) + SourceIndex(0)
5 >Emitted(2, 17) Source(2, 17) + SourceIndex(0)
6 >Emitted(2, 18) Source(2, 18) + SourceIndex(0)
7 >Emitted(2, 20) Source(2, 20) + SourceIndex(0)
8 >Emitted(2, 21) Source(2, 21) + SourceIndex(0)
---
>>>}
1 >
@@ -56,57 +53,51 @@ sourceFile:ES5For-of8.ts
---
>>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) {
1->
2 >^^^
3 > ^
4 > ^
5 > ^^^^^^^^^^
6 > ^^
7 > ^^^^^^
8 > ^^^
9 > ^^
10> ^^^
11> ^^
12> ^^^
13> ^
14> ^^
15> ^^^^^^^^^^^^^^
16> ^^
17> ^^^^
2 >^^^^^
3 > ^^^^^^^^^^
4 > ^^
5 > ^^^^^^
6 > ^^^
7 > ^^
8 > ^^^
9 > ^^
10> ^^^
11> ^
12> ^^
13> ^^^^^^^^^^^^^^
14> ^^
15> ^^^^
1->
>
2 >for
3 >
4 > (foo().x of
5 > ['a', 'b', 'c']
6 >
7 > [
8 > 'a'
9 > ,
10> 'b'
11> ,
12> 'c'
13> ]
14>
15> ['a', 'b', 'c']
16>
17> ['a', 'b', 'c']
2 >for (foo().x of
3 > ['a', 'b', 'c']
4 >
5 > [
6 > 'a'
7 > ,
8 > 'b'
9 > ,
10> 'c'
11> ]
12>
13> ['a', 'b', 'c']
14>
15> ['a', 'b', 'c']
1->Emitted(4, 1) Source(4, 1) + SourceIndex(0)
2 >Emitted(4, 4) Source(4, 4) + SourceIndex(0)
3 >Emitted(4, 5) Source(4, 5) + SourceIndex(0)
4 >Emitted(4, 6) Source(4, 17) + SourceIndex(0)
5 >Emitted(4, 16) Source(4, 32) + SourceIndex(0)
6 >Emitted(4, 18) Source(4, 17) + SourceIndex(0)
7 >Emitted(4, 24) Source(4, 18) + SourceIndex(0)
8 >Emitted(4, 27) Source(4, 21) + SourceIndex(0)
9 >Emitted(4, 29) Source(4, 23) + SourceIndex(0)
10>Emitted(4, 32) Source(4, 26) + SourceIndex(0)
11>Emitted(4, 34) Source(4, 28) + SourceIndex(0)
12>Emitted(4, 37) Source(4, 31) + SourceIndex(0)
13>Emitted(4, 38) Source(4, 32) + SourceIndex(0)
14>Emitted(4, 40) Source(4, 17) + SourceIndex(0)
15>Emitted(4, 54) Source(4, 32) + SourceIndex(0)
16>Emitted(4, 56) Source(4, 17) + SourceIndex(0)
17>Emitted(4, 60) Source(4, 32) + SourceIndex(0)
2 >Emitted(4, 6) Source(4, 17) + SourceIndex(0)
3 >Emitted(4, 16) Source(4, 32) + SourceIndex(0)
4 >Emitted(4, 18) Source(4, 17) + SourceIndex(0)
5 >Emitted(4, 24) Source(4, 18) + SourceIndex(0)
6 >Emitted(4, 27) Source(4, 21) + SourceIndex(0)
7 >Emitted(4, 29) Source(4, 23) + SourceIndex(0)
8 >Emitted(4, 32) Source(4, 26) + SourceIndex(0)
9 >Emitted(4, 34) Source(4, 28) + SourceIndex(0)
10>Emitted(4, 37) Source(4, 31) + SourceIndex(0)
11>Emitted(4, 38) Source(4, 32) + SourceIndex(0)
12>Emitted(4, 40) Source(4, 17) + SourceIndex(0)
13>Emitted(4, 54) Source(4, 32) + SourceIndex(0)
14>Emitted(4, 56) Source(4, 17) + SourceIndex(0)
15>Emitted(4, 60) Source(4, 32) + SourceIndex(0)
---
>>> foo().x = _a[_i];
1 >^^^^

View File

@@ -0,0 +1,13 @@
//// [awaitExpressionInnerCommentEmit.ts]
async function foo() {
/*comment1*/ await 1;
await /*comment2*/ 2;
await 3 /*comment3*/
}
//// [awaitExpressionInnerCommentEmit.js]
async function foo() {
/*comment1*/ await 1;
await /*comment2*/ 2;
await 3; /*comment3*/
}

View File

@@ -0,0 +1,8 @@
=== tests/cases/compiler/awaitExpressionInnerCommentEmit.ts ===
async function foo() {
>foo : Symbol(foo, Decl(awaitExpressionInnerCommentEmit.ts, 0, 0))
/*comment1*/ await 1;
await /*comment2*/ 2;
await 3 /*comment3*/
}

View File

@@ -0,0 +1,16 @@
=== tests/cases/compiler/awaitExpressionInnerCommentEmit.ts ===
async function foo() {
>foo : () => Promise<void>
/*comment1*/ await 1;
>await 1 : 1
>1 : 1
await /*comment2*/ 2;
>await /*comment2*/ 2 : 2
>2 : 2
await 3 /*comment3*/
>await 3 : 3
>3 : 3
}

View File

@@ -3,5 +3,5 @@ function foo(/** nothing */) {
}
//// [commentInEmptyParameterList1.js]
function foo() {
function foo( /** nothing */) {
}

View File

@@ -7,4 +7,4 @@ var f: () => any;
//// [commentOnParenthesizedExpressionOpenParen1.js]
var j;
var f;
(j = f());
( /* Preserve */j = f());

View File

@@ -19,13 +19,13 @@ function getSecurity(level) {
switch (level) {
case 0: // Zero
case 1: // one
case 2:// two
case 2: // two
return "Hi";
case 3: // three
case 4:// four
case 4: // four
return "hello";
case 5: // five
default:// default
default: // default
return "world";
}
}

View File

@@ -22,15 +22,16 @@ function getSecurity(level) {
switch (level) {
case 0: // Zero
case 1: // one
case 2:// two
case 2: // two
// Leading comments
return "Hi";
case 3: // three
case 4:// four
case 4: // four
return "hello";
case 5: // five
default:// default
default: // default
return "world";
// Comment After
} /*Comment 1*/ // Comment After 1
// Comment After 2
}

View File

@@ -21,14 +21,14 @@ function getSecurity(level) {
switch (level) {
case 0: /*Zero*/
case 1: /*One*/
case 2:/*two*/
case 2: /*two*/
// Leading comments
return "Hi";
case 3: /*three*/
case 4:/*four*/
case 4: /*four*/
return "hello";
case 5: /*five*/
default:/*six*/
default: /*six*/
return "world";
}
}

View File

@@ -73,8 +73,8 @@ var fooFunc = function FooFunctionValue(/** fooFunctionValue param */ b) {
return b;
};
/// lamdaFoo var comment
var lambdaFoo = function (/**param a*/ a, /**param b*/ b) { return a + b; };
var lambddaNoVarComment = function (/**param a*/ a, /**param b*/ b) { return a * b; };
var lambdaFoo = /** this is lambda comment*/ function (/**param a*/ a, /**param b*/ b) { return a + b; };
var lambddaNoVarComment = /** this is lambda multiplication*/ function (/**param a*/ a, /**param b*/ b) { return a * b; };
lambdaFoo(10, 20);
lambddaNoVarComment(10, 20);
function blah(a /* multiline trailing comment

View File

@@ -63,13 +63,13 @@ x = myVariable;
/** jsdocstyle comment - only this comment should be in .d.ts file*/
var n = 30;
/** var deckaration with comment on type as well*/
var y = 20;
var y = /** value comment */ 20;
/// var deckaration with comment on type as well
var yy =
/// value comment
20;
/** comment2 */
var z = function (x, y) { return x + y; };
var z = /** lambda comment */ function (x, y) { return x + y; };
var z2;
var x2 = z2;
var n4;

View File

@@ -1,2 +1,2 @@
//// [computedPropertyNamesSourceMap1_ES5.js.map]
{"version":3,"file":"computedPropertyNamesSourceMap1_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES5.ts"],"names":[],"mappings":"AAAA;IAAA;IAOA,CAAC;IANG,YAAC,OAAO,CAAC,GAAT;QACI,QAAQ,CAAC;IACb,CAAC;IACD,sBAAI,sBAAW;aAAf;YACF,MAAM,CAAC,CAAC,CAAC;QACP,CAAC;;;OAAA;IACL,QAAC;AAAD,CAAC,AAPD,IAOC"}
{"version":3,"file":"computedPropertyNamesSourceMap1_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES5.ts"],"names":[],"mappings":"AAAA;IAAA;IAOA,CAAC;IANG,YAAC,OAAO,CAAC,GAAT;QACI,QAAQ,CAAC;IACb,CAAC;IACD,sBAAI,sBAAW;aAAf;YACF,OAAO,CAAC,CAAC;QACP,CAAC;;;OAAA;IACL,QAAC;AAAD,CAAC,AAPD,IAOC"}

View File

@@ -95,21 +95,18 @@ sourceFile:computedPropertyNamesSourceMap1_ES5.ts
---
>>> return 0;
1->^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^
5 > ^
2 > ^^^^^^^
3 > ^
4 > ^
1->get ["goodbye"]() {
>
2 > return
3 >
4 > 0
5 > ;
2 > return
3 > 0
4 > ;
1->Emitted(9, 13) Source(6, 3) + SourceIndex(0)
2 >Emitted(9, 19) Source(6, 9) + SourceIndex(0)
3 >Emitted(9, 20) Source(6, 10) + SourceIndex(0)
4 >Emitted(9, 21) Source(6, 11) + SourceIndex(0)
5 >Emitted(9, 22) Source(6, 12) + SourceIndex(0)
2 >Emitted(9, 20) Source(6, 10) + SourceIndex(0)
3 >Emitted(9, 21) Source(6, 11) + SourceIndex(0)
4 >Emitted(9, 22) Source(6, 12) + SourceIndex(0)
---
>>> },
1 >^^^^^^^^

View File

@@ -1,2 +1,2 @@
//// [computedPropertyNamesSourceMap1_ES6.js.map]
{"version":3,"file":"computedPropertyNamesSourceMap1_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES6.ts"],"names":[],"mappings":"AAAA;IACI,CAAC,OAAO,CAAC;QACL,QAAQ,CAAC;IAChB,CAAC;IACD,IAAI,CAAC,SAAS,CAAC;QACd,MAAM,CAAC,CAAC,CAAC;IACV,CAAC;CACD"}
{"version":3,"file":"computedPropertyNamesSourceMap1_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES6.ts"],"names":[],"mappings":"AAAA;IACI,CAAC,OAAO,CAAC;QACL,QAAQ,CAAC;IAChB,CAAC;IACD,IAAI,CAAC,SAAS,CAAC;QACd,OAAO,CAAC,CAAC;IACV,CAAC;CACD"}

View File

@@ -72,21 +72,18 @@ sourceFile:computedPropertyNamesSourceMap1_ES6.ts
---
>>> return 0;
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^
5 > ^
2 > ^^^^^^^
3 > ^
4 > ^
1 >() {
>
2 > return
3 >
4 > 0
5 > ;
2 > return
3 > 0
4 > ;
1 >Emitted(6, 9) Source(6, 3) + SourceIndex(0)
2 >Emitted(6, 15) Source(6, 9) + SourceIndex(0)
3 >Emitted(6, 16) Source(6, 10) + SourceIndex(0)
4 >Emitted(6, 17) Source(6, 11) + SourceIndex(0)
5 >Emitted(6, 18) Source(6, 12) + SourceIndex(0)
2 >Emitted(6, 16) Source(6, 10) + SourceIndex(0)
3 >Emitted(6, 17) Source(6, 11) + SourceIndex(0)
4 >Emitted(6, 18) Source(6, 12) + SourceIndex(0)
---
>>> }
1 >^^^^

View File

@@ -1,2 +1,2 @@
//// [computedPropertyNamesSourceMap2_ES5.js.map]
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC;IACD,GAAC,OAAO,IAAR;QACI,QAAQ,CAAC;IAChB,CAAC;0BACM,aAAW;aAAf;YACF,MAAM,CAAC,CAAC,CAAC;QACV,CAAC;;;;OACD,CAAA"}
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC;IACD,GAAC,OAAO,IAAR;QACI,QAAQ,CAAC;IAChB,CAAC;0BACM,aAAW;aAAf;YACF,OAAO,CAAC,CAAC;QACV,CAAC;;;;OACD,CAAA"}

View File

@@ -74,21 +74,18 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
---
>>> return 0;
1->^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^
5 > ^
2 > ^^^^^^^
3 > ^
4 > ^
1->get ["goodbye"]() {
>
2 > return
3 >
4 > 0
5 > ;
2 > return
3 > 0
4 > ;
1->Emitted(7, 13) Source(6, 3) + SourceIndex(0)
2 >Emitted(7, 19) Source(6, 9) + SourceIndex(0)
3 >Emitted(7, 20) Source(6, 10) + SourceIndex(0)
4 >Emitted(7, 21) Source(6, 11) + SourceIndex(0)
5 >Emitted(7, 22) Source(6, 12) + SourceIndex(0)
2 >Emitted(7, 20) Source(6, 10) + SourceIndex(0)
3 >Emitted(7, 21) Source(6, 11) + SourceIndex(0)
4 >Emitted(7, 22) Source(6, 12) + SourceIndex(0)
---
>>> },
1 >^^^^^^^^

View File

@@ -1,2 +1,2 @@
//// [computedPropertyNamesSourceMap2_ES6.js.map]
{"version":3,"file":"computedPropertyNamesSourceMap2_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES6.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACL,QAAQ,CAAC;IAChB,CAAC;IACD,IAAI,CAAC,SAAS,CAAC;QACd,MAAM,CAAC,CAAC,CAAC;IACV,CAAC;CACD,CAAA"}
{"version":3,"file":"computedPropertyNamesSourceMap2_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES6.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACL,QAAQ,CAAC;IAChB,CAAC;IACD,IAAI,CAAC,SAAS,CAAC;QACd,OAAO,CAAC,CAAC;IACV,CAAC;CACD,CAAA"}

View File

@@ -81,21 +81,18 @@ sourceFile:computedPropertyNamesSourceMap2_ES6.ts
---
>>> return 0;
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^
5 > ^
2 > ^^^^^^^
3 > ^
4 > ^
1 >() {
>
2 > return
3 >
4 > 0
5 > ;
2 > return
3 > 0
4 > ;
1 >Emitted(6, 9) Source(6, 3) + SourceIndex(0)
2 >Emitted(6, 15) Source(6, 9) + SourceIndex(0)
3 >Emitted(6, 16) Source(6, 10) + SourceIndex(0)
4 >Emitted(6, 17) Source(6, 11) + SourceIndex(0)
5 >Emitted(6, 18) Source(6, 12) + SourceIndex(0)
2 >Emitted(6, 16) Source(6, 10) + SourceIndex(0)
3 >Emitted(6, 17) Source(6, 11) + SourceIndex(0)
4 >Emitted(6, 18) Source(6, 12) + SourceIndex(0)
---
>>> }
1 >^^^^

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
//// [continueStatementInternalComments.ts]
foo: for (;;) {
/*1*/ continue /*2*/ foo /*3*/;
}
//// [continueStatementInternalComments.js]
foo: for (;;) {
/*1*/ continue /*2*/ foo /*3*/;
}

View File

@@ -0,0 +1,5 @@
=== tests/cases/compiler/continueStatementInternalComments.ts ===
foo: for (;;) {
No type information for this code. /*1*/ continue /*2*/ foo /*3*/;
No type information for this code.}
No type information for this code.

View File

@@ -0,0 +1,7 @@
=== tests/cases/compiler/continueStatementInternalComments.ts ===
foo: for (;;) {
>foo : any
/*1*/ continue /*2*/ foo /*3*/;
>foo : any
}

View File

@@ -283,7 +283,7 @@ function f10() {
}
function f11() {
var x = [];
if (x.length === 0) {
if (x.length === 0) { // x.length ok on implicit any[]
x.push("hello");
}
return x;
@@ -291,7 +291,7 @@ function f11() {
function f12() {
var x;
x = [];
if (x.length === 0) {
if (x.length === 0) { // x.length ok on implicit any[]
x.push("hello");
}
return x;

View File

@@ -21,7 +21,7 @@ function makePoint(x) {
;
var /*4*/ point = makePoint(2);
var /*2*/ x = point.x;
point.x = 30;
point. /*3*/x = 30;
//// [declFileObjectLiteralWithAccessors.d.ts]

View File

@@ -16,7 +16,7 @@ function makePoint(x) {
}
;
var /*4*/ point = makePoint(2);
var /*2*/ x = point.x;
var /*2*/ x = point. /*3*/x;
//// [declFileObjectLiteralWithOnlyGetter.d.ts]

View File

@@ -17,7 +17,7 @@ function makePoint(x) {
}
;
var /*3*/ point = makePoint(2);
point.x = 30;
point. /*2*/x = 30;
//// [declFileObjectLiteralWithOnlySetter.d.ts]

View File

@@ -1,2 +1,2 @@
//// [derivedClassConstructorWithExplicitReturns01.js.map]
{"version":3,"file":"derivedClassConstructorWithExplicitReturns01.js","sourceRoot":"","sources":["derivedClassConstructorWithExplicitReturns01.ts"],"names":[],"mappings":";;;;;;;;;;AAAA;IAKI,WAAY,KAAa;QAJzB,UAAK,GAAG,EAAE,CAAC;QAKP,MAAM,CAAC;YACH,KAAK,EAAE,KAAK;YACZ,GAAG;gBACC,MAAM,CAAC,8BAA8B,CAAC;YAC1C,CAAC;SACJ,CAAA;IACL,CAAC;IATD,eAAG,GAAH,cAAQ,MAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAU7C,QAAC;AAAD,CAAC,AAbD,IAaC;AAED;IAAgB,qBAAC;IAGb,WAAY,CAAO;QAAP,kBAAA,EAAA,OAAO;QAAnB,YACI,kBAAM,CAAC,CAAC,SAYX;QAfD,WAAK,GAAG,cAAM,OAAA,KAAI,EAAJ,CAAI,CAAC;QAKf,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;YACtB,UAAU,CAAA;YACV,MAAM,CAAC;gBACH,KAAK,EAAE,CAAC;gBACR,KAAK,EAAE,cAAM,OAAA,KAAI,EAAJ,CAAI;gBACjB,GAAG,gBAAK,MAAM,CAAC,cAAc,CAAA,CAAC,CAAC;aAClC,CAAC;QACN,CAAC;QACD,IAAI;YACA,MAAM,CAAC,IAAI,CAAC;IACpB,CAAC;IACL,QAAC;AAAD,CAAC,AAjBD,CAAgB,CAAC,GAiBhB"}
{"version":3,"file":"derivedClassConstructorWithExplicitReturns01.js","sourceRoot":"","sources":["derivedClassConstructorWithExplicitReturns01.ts"],"names":[],"mappings":";;;;;;;;;;AAAA;IAKI,WAAY,KAAa;QAJzB,UAAK,GAAG,EAAE,CAAC;QAKP,OAAO;YACH,KAAK,EAAE,KAAK;YACZ,GAAG;gBACC,OAAO,8BAA8B,CAAC;YAC1C,CAAC;SACJ,CAAA;IACL,CAAC;IATD,eAAG,GAAH,cAAQ,OAAO,uBAAuB,CAAC,CAAC,CAAC;IAU7C,QAAC;AAAD,CAAC,AAbD,IAaC;AAED;IAAgB,qBAAC;IAGb,WAAY,CAAO;QAAP,kBAAA,EAAA,OAAO;QAAnB,YACI,kBAAM,CAAC,CAAC,SAYX;QAfD,WAAK,GAAG,cAAM,OAAA,KAAI,EAAJ,CAAI,CAAC;QAKf,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE;YACrB,UAAU,CAAA;YACV,OAAO;gBACH,KAAK,EAAE,CAAC;gBACR,KAAK,EAAE,cAAM,OAAA,KAAI,EAAJ,CAAI;gBACjB,GAAG,gBAAK,OAAO,cAAc,CAAA,CAAC,CAAC;aAClC,CAAC;SACL;;YAEG,OAAO,IAAI,CAAC;IACpB,CAAC;IACL,QAAC;AAAD,CAAC,AAjBD,CAAgB,CAAC,GAiBhB"}

View File

@@ -60,20 +60,17 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts
---
>>> return {
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^^^^^->
2 > ^^^^^^^
3 > ^^^^^^^^^^^->
1 >
>
> foo() { return "this never gets used."; }
>
> constructor(value: number) {
>
2 > return
3 >
2 > return
1 >Emitted(14, 9) Source(7, 9) + SourceIndex(0)
2 >Emitted(14, 15) Source(7, 15) + SourceIndex(0)
3 >Emitted(14, 16) Source(7, 16) + SourceIndex(0)
2 >Emitted(14, 16) Source(7, 16) + SourceIndex(0)
---
>>> cProp: value,
1->^^^^^^^^^^^^
@@ -103,21 +100,18 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts
---
>>> return "well this looks kinda C-ish.";
1->^^^^^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5 > ^
2 > ^^^^^^^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 > ^
1->() {
>
2 > return
3 >
4 > "well this looks kinda C-ish."
5 > ;
2 > return
3 > "well this looks kinda C-ish."
4 > ;
1->Emitted(17, 17) Source(10, 17) + SourceIndex(0)
2 >Emitted(17, 23) Source(10, 23) + SourceIndex(0)
3 >Emitted(17, 24) Source(10, 24) + SourceIndex(0)
4 >Emitted(17, 54) Source(10, 54) + SourceIndex(0)
5 >Emitted(17, 55) Source(10, 55) + SourceIndex(0)
2 >Emitted(17, 24) Source(10, 24) + SourceIndex(0)
3 >Emitted(17, 54) Source(10, 54) + SourceIndex(0)
4 >Emitted(17, 55) Source(10, 55) + SourceIndex(0)
---
>>> }
1 >^^^^^^^^^^^^
@@ -152,32 +146,29 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts
2 > ^^^^^^^^^^^^^^^
3 > ^^^
4 > ^^^^^^^^^^^^^^
5 > ^^^^^^
6 > ^
7 > ^^^^^^^^^^^^^^^^^^^^^^^
8 > ^
9 > ^
10> ^
5 > ^^^^^^^
6 > ^^^^^^^^^^^^^^^^^^^^^^^
7 > ^
8 > ^
9 > ^
1->
2 > foo
3 >
4 > foo() {
5 > return
6 >
7 > "this never gets used."
8 > ;
9 >
10> }
5 > return
6 > "this never gets used."
7 > ;
8 >
9 > }
1->Emitted(21, 5) Source(4, 5) + SourceIndex(0)
2 >Emitted(21, 20) Source(4, 8) + SourceIndex(0)
3 >Emitted(21, 23) Source(4, 5) + SourceIndex(0)
4 >Emitted(21, 37) Source(4, 13) + SourceIndex(0)
5 >Emitted(21, 43) Source(4, 19) + SourceIndex(0)
6 >Emitted(21, 44) Source(4, 20) + SourceIndex(0)
7 >Emitted(21, 67) Source(4, 43) + SourceIndex(0)
8 >Emitted(21, 68) Source(4, 44) + SourceIndex(0)
9 >Emitted(21, 69) Source(4, 45) + SourceIndex(0)
10>Emitted(21, 70) Source(4, 46) + SourceIndex(0)
5 >Emitted(21, 44) Source(4, 20) + SourceIndex(0)
6 >Emitted(21, 67) Source(4, 43) + SourceIndex(0)
7 >Emitted(21, 68) Source(4, 44) + SourceIndex(0)
8 >Emitted(21, 69) Source(4, 45) + SourceIndex(0)
9 >Emitted(21, 70) Source(4, 46) + SourceIndex(0)
---
>>> return C;
1 >^^^^
@@ -336,55 +327,43 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts
---
>>> if (Math.random() < 0.5) {
1 >^^^^^^^^
2 > ^^
3 > ^
4 > ^
5 > ^^^^
6 > ^
7 > ^^^^^^
8 > ^^
9 > ^^^
10> ^^^
11> ^
12> ^
13> ^
2 > ^^^^
3 > ^^^^
4 > ^
5 > ^^^^^^
6 > ^^
7 > ^^^
8 > ^^^
9 > ^^
1 >
>
> constructor(a = 100) {
> super(a);
>
>
2 > if
3 >
4 > (
5 > Math
6 > .
7 > random
8 > ()
9 > <
10> 0.5
11> )
12>
13> {
2 > if (
3 > Math
4 > .
5 > random
6 > ()
7 > <
8 > 0.5
9 > )
1 >Emitted(30, 9) Source(22, 9) + SourceIndex(0)
2 >Emitted(30, 11) Source(22, 11) + SourceIndex(0)
3 >Emitted(30, 12) Source(22, 12) + SourceIndex(0)
4 >Emitted(30, 13) Source(22, 13) + SourceIndex(0)
5 >Emitted(30, 17) Source(22, 17) + SourceIndex(0)
6 >Emitted(30, 18) Source(22, 18) + SourceIndex(0)
7 >Emitted(30, 24) Source(22, 24) + SourceIndex(0)
8 >Emitted(30, 26) Source(22, 26) + SourceIndex(0)
9 >Emitted(30, 29) Source(22, 29) + SourceIndex(0)
10>Emitted(30, 32) Source(22, 32) + SourceIndex(0)
11>Emitted(30, 33) Source(22, 33) + SourceIndex(0)
12>Emitted(30, 34) Source(22, 34) + SourceIndex(0)
13>Emitted(30, 35) Source(22, 35) + SourceIndex(0)
2 >Emitted(30, 13) Source(22, 13) + SourceIndex(0)
3 >Emitted(30, 17) Source(22, 17) + SourceIndex(0)
4 >Emitted(30, 18) Source(22, 18) + SourceIndex(0)
5 >Emitted(30, 24) Source(22, 24) + SourceIndex(0)
6 >Emitted(30, 26) Source(22, 26) + SourceIndex(0)
7 >Emitted(30, 29) Source(22, 29) + SourceIndex(0)
8 >Emitted(30, 32) Source(22, 32) + SourceIndex(0)
9 >Emitted(30, 34) Source(22, 34) + SourceIndex(0)
---
>>> "You win!";
1 >^^^^^^^^^^^^
2 > ^^^^^^^^^^
3 > ^
1 >
1 >{
>
2 > "You win!"
3 >
@@ -394,16 +373,13 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts
---
>>> return {
1 >^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^->
2 > ^^^^^^^
3 > ^^^^^^^->
1 >
>
2 > return
3 >
2 > return
1 >Emitted(32, 13) Source(24, 13) + SourceIndex(0)
2 >Emitted(32, 19) Source(24, 19) + SourceIndex(0)
3 >Emitted(32, 20) Source(24, 20) + SourceIndex(0)
2 >Emitted(32, 20) Source(24, 20) + SourceIndex(0)
---
>>> cProp: 1,
1->^^^^^^^^^^^^^^^^
@@ -453,31 +429,28 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts
1->^^^^^^^^^^^^^^^^
2 > ^^^
3 > ^^^^^^^^^^^^^^^^
4 > ^^^^^^
5 > ^
6 > ^^^^^^^^^^^^^^
7 > ^
8 > ^
9 > ^
4 > ^^^^^^^
5 > ^^^^^^^^^^^^^^
6 > ^
7 > ^
8 > ^
1->,
>
2 > foo
3 > () {
4 > return
5 >
6 > "You win!!!!!"
7 >
8 >
9 > }
4 > return
5 > "You win!!!!!"
6 >
7 >
8 > }
1->Emitted(35, 17) Source(27, 17) + SourceIndex(0)
2 >Emitted(35, 20) Source(27, 20) + SourceIndex(0)
3 >Emitted(35, 36) Source(27, 25) + SourceIndex(0)
4 >Emitted(35, 42) Source(27, 31) + SourceIndex(0)
5 >Emitted(35, 43) Source(27, 32) + SourceIndex(0)
6 >Emitted(35, 57) Source(27, 46) + SourceIndex(0)
7 >Emitted(35, 58) Source(27, 46) + SourceIndex(0)
8 >Emitted(35, 59) Source(27, 47) + SourceIndex(0)
9 >Emitted(35, 60) Source(27, 48) + SourceIndex(0)
4 >Emitted(35, 43) Source(27, 32) + SourceIndex(0)
5 >Emitted(35, 57) Source(27, 46) + SourceIndex(0)
6 >Emitted(35, 58) Source(27, 46) + SourceIndex(0)
7 >Emitted(35, 59) Source(27, 47) + SourceIndex(0)
8 >Emitted(35, 60) Source(27, 48) + SourceIndex(0)
---
>>> };
1 >^^^^^^^^^^^^^
@@ -489,42 +462,28 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts
2 >Emitted(36, 15) Source(28, 15) + SourceIndex(0)
---
>>> }
1 >^^^^^^^^
2 > ^
3 > ^^^^->
1 >^^^^^^^^^
2 > ^^^^->
1 >
>
2 > }
1 >Emitted(37, 9) Source(29, 9) + SourceIndex(0)
2 >Emitted(37, 10) Source(29, 10) + SourceIndex(0)
> }
1 >Emitted(37, 10) Source(29, 10) + SourceIndex(0)
---
>>> else
1->^^^^^^^^
2 > ^^^^
3 > ^^^^^^^^^^^^^->
1->
>
2 > else
1->Emitted(38, 9) Source(30, 9) + SourceIndex(0)
2 >Emitted(38, 13) Source(30, 13) + SourceIndex(0)
---
>>> return null;
1->^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^
5 > ^
2 > ^^^^^^^
3 > ^^^^
4 > ^
1->
> else
>
2 > return
3 >
4 > null
5 > ;
2 > return
3 > null
4 > ;
1->Emitted(39, 13) Source(31, 13) + SourceIndex(0)
2 >Emitted(39, 19) Source(31, 19) + SourceIndex(0)
3 >Emitted(39, 20) Source(31, 20) + SourceIndex(0)
4 >Emitted(39, 24) Source(31, 24) + SourceIndex(0)
5 >Emitted(39, 25) Source(31, 25) + SourceIndex(0)
2 >Emitted(39, 20) Source(31, 20) + SourceIndex(0)
3 >Emitted(39, 24) Source(31, 24) + SourceIndex(0)
4 >Emitted(39, 25) Source(31, 25) + SourceIndex(0)
---
>>> }
1 >^^^^

View File

@@ -53,6 +53,6 @@ catch (_c) {
// Test of comment ranges. A fix to GH#11755 should update this.
try {
}
catch (_e) {
catch ( /*Test comment ranges*/_e) {
var /*a*/ a = _e[0];
}

View File

@@ -382,7 +382,7 @@ var TestRunner = /** @class */ (function () {
exception = true;
testResult = false;
if (typeof testcase.errorMessageRegEx === "string") {
if (testcase.errorMessageRegEx === "") {
if (testcase.errorMessageRegEx === "") { // Any error is fine
testResult = true;
}
else if (e.message) {

View File

@@ -0,0 +1,17 @@
//// [elementAccessExpressionInternalComments.ts]
/*0*/ Array /*1*/[ /*2*/ "toString" /*3*/ ] /*4*/; /*5*/
/*0*/ Array
// single line
/*1*/[ /*2*/ "toString"
// single line
/*3*/ ] /*4*/
//// [elementAccessExpressionInternalComments.js]
/*0*/ Array /*1*/[ /*2*/"toString" /*3*/] /*4*/; /*5*/
/*0*/ Array
// single line
/*1*/ [ /*2*/"toString"
// single line
/*3*/ ]; /*4*/

View File

@@ -0,0 +1,15 @@
=== tests/cases/compiler/elementAccessExpressionInternalComments.ts ===
/*0*/ Array /*1*/[ /*2*/ "toString" /*3*/ ] /*4*/; /*5*/
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>"toString" : Symbol(Function.toString, Decl(lib.d.ts, --, --))
/*0*/ Array
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
// single line
/*1*/[ /*2*/ "toString"
>"toString" : Symbol(Function.toString, Decl(lib.d.ts, --, --))
// single line
/*3*/ ] /*4*/

View File

@@ -0,0 +1,17 @@
=== tests/cases/compiler/elementAccessExpressionInternalComments.ts ===
/*0*/ Array /*1*/[ /*2*/ "toString" /*3*/ ] /*4*/; /*5*/
>Array /*1*/[ /*2*/ "toString" /*3*/ ] : () => string
>Array : ArrayConstructor
>"toString" : "toString"
/*0*/ Array
>Array // single line /*1*/[ /*2*/ "toString" // single line /*3*/ ] : () => string
>Array : ArrayConstructor
// single line
/*1*/[ /*2*/ "toString"
>"toString" : "toString"
// single line
/*3*/ ] /*4*/

View File

@@ -0,0 +1,22 @@
//// [emptyArgumentsListComment.ts]
declare var a;
a(/*1*/);
a(
/*first*/
// foo
/*middle*/
// bar
/*last*/
);
//// [emptyArgumentsListComment.js]
a( /*1*/);
a(
/*first*/
// foo
/*middle*/
// bar
/*last*/
);

View File

@@ -0,0 +1,17 @@
=== tests/cases/compiler/emptyArgumentsListComment.ts ===
declare var a;
>a : Symbol(a, Decl(emptyArgumentsListComment.ts, 0, 11))
a(/*1*/);
>a : Symbol(a, Decl(emptyArgumentsListComment.ts, 0, 11))
a(
>a : Symbol(a, Decl(emptyArgumentsListComment.ts, 0, 11))
/*first*/
// foo
/*middle*/
// bar
/*last*/
);

View File

@@ -0,0 +1,19 @@
=== tests/cases/compiler/emptyArgumentsListComment.ts ===
declare var a;
>a : any
a(/*1*/);
>a(/*1*/) : any
>a : any
a(
>a( /*first*/ // foo /*middle*/ // bar /*last*/) : any
>a : any
/*first*/
// foo
/*middle*/
// bar
/*last*/
);

View File

@@ -1,2 +1,2 @@
//// [es3-sourcemap-amd.js.map]
{"version":3,"file":"es3-sourcemap-amd.js","sourceRoot":"","sources":["es3-sourcemap-amd.ts"],"names":[],"mappings":"AAAA;IAEI;IAGA,CAAC;IAEM,aAAC,GAAR;QAEI,MAAM,CAAC,EAAE,CAAC;IACd,CAAC;IACL,QAAC;AAAD,CAAC,AAXD,IAWC"}
{"version":3,"file":"es3-sourcemap-amd.js","sourceRoot":"","sources":["es3-sourcemap-amd.ts"],"names":[],"mappings":"AAAA;IAEI;IAGA,CAAC;IAEM,aAAC,GAAR;QAEI,OAAO,EAAE,CAAC;IACd,CAAC;IACL,QAAC;AAAD,CAAC,AAXD,IAWC"}

View File

@@ -49,22 +49,19 @@ sourceFile:es3-sourcemap-amd.ts
---
>>> return 42;
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
2 > ^^^^^^^
3 > ^^
4 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
2 > return
3 > 42
4 > ;
1 >Emitted(5, 9) Source(10, 9) + SourceIndex(0)
2 >Emitted(5, 15) Source(10, 15) + SourceIndex(0)
3 >Emitted(5, 16) Source(10, 16) + SourceIndex(0)
4 >Emitted(5, 18) Source(10, 18) + SourceIndex(0)
5 >Emitted(5, 19) Source(10, 19) + SourceIndex(0)
2 >Emitted(5, 16) Source(10, 16) + SourceIndex(0)
3 >Emitted(5, 18) Source(10, 18) + SourceIndex(0)
4 >Emitted(5, 19) Source(10, 19) + SourceIndex(0)
---
>>> };
1 >^^^^

View File

@@ -1,2 +1,2 @@
//// [es5-souremap-amd.js.map]
{"version":3,"file":"es5-souremap-amd.js","sourceRoot":"","sources":["es5-souremap-amd.ts"],"names":[],"mappings":"AAAA;IAEI;IAGA,CAAC;IAEM,aAAC,GAAR;QAEI,MAAM,CAAC,EAAE,CAAC;IACd,CAAC;IACL,QAAC;AAAD,CAAC,AAXD,IAWC"}
{"version":3,"file":"es5-souremap-amd.js","sourceRoot":"","sources":["es5-souremap-amd.ts"],"names":[],"mappings":"AAAA;IAEI;IAGA,CAAC;IAEM,aAAC,GAAR;QAEI,OAAO,EAAE,CAAC;IACd,CAAC;IACL,QAAC;AAAD,CAAC,AAXD,IAWC"}

View File

@@ -49,22 +49,19 @@ sourceFile:es5-souremap-amd.ts
---
>>> return 42;
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
2 > ^^^^^^^
3 > ^^
4 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
2 > return
3 > 42
4 > ;
1 >Emitted(5, 9) Source(10, 9) + SourceIndex(0)
2 >Emitted(5, 15) Source(10, 15) + SourceIndex(0)
3 >Emitted(5, 16) Source(10, 16) + SourceIndex(0)
4 >Emitted(5, 18) Source(10, 18) + SourceIndex(0)
5 >Emitted(5, 19) Source(10, 19) + SourceIndex(0)
2 >Emitted(5, 16) Source(10, 16) + SourceIndex(0)
3 >Emitted(5, 18) Source(10, 18) + SourceIndex(0)
4 >Emitted(5, 19) Source(10, 19) + SourceIndex(0)
---
>>> };
1 >^^^^

View File

@@ -1,2 +1,2 @@
//// [es6-sourcemap-amd.js.map]
{"version":3,"file":"es6-sourcemap-amd.js","sourceRoot":"","sources":["es6-sourcemap-amd.ts"],"names":[],"mappings":"AAAA;IAEI;IAGA,CAAC;IAEM,CAAC;QAEJ,MAAM,CAAC,EAAE,CAAC;IACd,CAAC;CACJ"}
{"version":3,"file":"es6-sourcemap-amd.js","sourceRoot":"","sources":["es6-sourcemap-amd.ts"],"names":[],"mappings":"AAAA;IAEI;IAGA,CAAC;IAEM,CAAC;QAEJ,OAAO,EAAE,CAAC;IACd,CAAC;CACJ"}

View File

@@ -47,22 +47,19 @@ sourceFile:es6-sourcemap-amd.ts
---
>>> return 42;
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
2 > ^^^^^^^
3 > ^^
4 > ^
1->()
> {
>
2 > return
3 >
4 > 42
5 > ;
2 > return
3 > 42
4 > ;
1->Emitted(5, 9) Source(10, 9) + SourceIndex(0)
2 >Emitted(5, 15) Source(10, 15) + SourceIndex(0)
3 >Emitted(5, 16) Source(10, 16) + SourceIndex(0)
4 >Emitted(5, 18) Source(10, 18) + SourceIndex(0)
5 >Emitted(5, 19) Source(10, 19) + SourceIndex(0)
2 >Emitted(5, 16) Source(10, 16) + SourceIndex(0)
3 >Emitted(5, 18) Source(10, 18) + SourceIndex(0)
4 >Emitted(5, 19) Source(10, 19) + SourceIndex(0)
---
>>> }
1 >^^^^

View File

@@ -31,26 +31,27 @@ for () { // error
}
//// [for.js]
for (var i = 0; i < 10; i++) {
for (var i = 0; i < 10; i++) { // ok
var x1 = i;
}
for (var j = 0; j < 10; j++) {
for (var j = 0; j < 10; j++) { // ok
var x2 = j;
}
for (var k = 0; k < 10;) {
for (var k = 0; k < 10;) { // ok
k++;
}
for (; i < 10;) {
for (; i < 10;) { // ok
i++;
}
for (; i > 1; i--) {
for (; i > 1; i--) { // ok
}
for (var l = 0;; l++) {
for (var l = 0;; l++) { // ok
if (l > 10) {
break;
}
}
for (;;) {
for (;;) { // ok
}
for (;;) {
for (;; // error
) { // error
}

View File

@@ -23,16 +23,16 @@ for (var l in arr) {
//// [forIn.js]
var arr = null;
for (var i in arr) {
for (var i in arr) { // error
var x1 = arr[i];
var y1 = arr[i];
}
for (var j in arr) {
for (var j in arr) { // ok
var x2 = arr[j];
var y2 = arr[j];
}
var arr2 = [];
for (j in arr2) {
for (j in arr2) { // ok
var x3 = arr2[j];
var y3 = arr2[j];
}

View File

@@ -0,0 +1,15 @@
//// [forStatementInnerComments.ts]
declare var a;
/*0*/ for /*1*/ ( /*2*/ var /*3*/ x /*4*/ in /*5*/ a /*6*/) /*7*/ {}
/*0*/ for /*1*/ ( /*2*/ var /*3*/ y /*4*/ of /*5*/ a /*6*/) /*7*/ {}
/*0*/ for /*1*/ ( /*2*/ x /*3*/ in /*4*/ a /*5*/) /*6*/ {}
/*0*/ for /*1*/ ( /*2*/ y /*3*/ of /*4*/ a /*5*/) /*6*/ {}
/*0*/ for /*1*/ ( /*2*/ a /*3*/ ; /*4*/ a /*5*/ ; /*6*/ a /*7*/) /*8*/ {}
//// [forStatementInnerComments.js]
/*0*/ for /*1*/ ( /*2*/var /*3*/ x /*4*/ in /*5*/ a /*6*/) /*7*/ { }
/*0*/ for /*1*/ ( /*2*/var /*3*/ y /*4*/ of /*5*/ a /*6*/) /*7*/ { }
/*0*/ for /*1*/ ( /*2*/x /*3*/ in /*4*/ a /*5*/) /*6*/ { }
/*0*/ for /*1*/ ( /*2*/y /*3*/ of /*4*/ a /*5*/) /*6*/ { }
/*0*/ for /*1*/ ( /*2*/a /*3*/; /*4*/ a /*5*/; /*6*/ a /*7*/) /*8*/ { }

View File

@@ -0,0 +1,25 @@
=== tests/cases/compiler/forStatementInnerComments.ts ===
declare var a;
>a : Symbol(a, Decl(forStatementInnerComments.ts, 0, 11))
/*0*/ for /*1*/ ( /*2*/ var /*3*/ x /*4*/ in /*5*/ a /*6*/) /*7*/ {}
>x : Symbol(x, Decl(forStatementInnerComments.ts, 1, 27))
>a : Symbol(a, Decl(forStatementInnerComments.ts, 0, 11))
/*0*/ for /*1*/ ( /*2*/ var /*3*/ y /*4*/ of /*5*/ a /*6*/) /*7*/ {}
>y : Symbol(y, Decl(forStatementInnerComments.ts, 2, 27))
>a : Symbol(a, Decl(forStatementInnerComments.ts, 0, 11))
/*0*/ for /*1*/ ( /*2*/ x /*3*/ in /*4*/ a /*5*/) /*6*/ {}
>x : Symbol(x, Decl(forStatementInnerComments.ts, 1, 27))
>a : Symbol(a, Decl(forStatementInnerComments.ts, 0, 11))
/*0*/ for /*1*/ ( /*2*/ y /*3*/ of /*4*/ a /*5*/) /*6*/ {}
>y : Symbol(y, Decl(forStatementInnerComments.ts, 2, 27))
>a : Symbol(a, Decl(forStatementInnerComments.ts, 0, 11))
/*0*/ for /*1*/ ( /*2*/ a /*3*/ ; /*4*/ a /*5*/ ; /*6*/ a /*7*/) /*8*/ {}
>a : Symbol(a, Decl(forStatementInnerComments.ts, 0, 11))
>a : Symbol(a, Decl(forStatementInnerComments.ts, 0, 11))
>a : Symbol(a, Decl(forStatementInnerComments.ts, 0, 11))

View File

@@ -0,0 +1,25 @@
=== tests/cases/compiler/forStatementInnerComments.ts ===
declare var a;
>a : any
/*0*/ for /*1*/ ( /*2*/ var /*3*/ x /*4*/ in /*5*/ a /*6*/) /*7*/ {}
>x : string
>a : any
/*0*/ for /*1*/ ( /*2*/ var /*3*/ y /*4*/ of /*5*/ a /*6*/) /*7*/ {}
>y : any
>a : any
/*0*/ for /*1*/ ( /*2*/ x /*3*/ in /*4*/ a /*5*/) /*6*/ {}
>x : string
>a : any
/*0*/ for /*1*/ ( /*2*/ y /*3*/ of /*4*/ a /*5*/) /*6*/ {}
>y : any
>a : any
/*0*/ for /*1*/ ( /*2*/ a /*3*/ ; /*4*/ a /*5*/ ; /*6*/ a /*7*/) /*8*/ {}
>a : any
>a : any
>a : any

View File

@@ -11,7 +11,7 @@ var M = /** @class */ (function () {
//# sourceMappingURL=inputFile1.js.map
EmitSkipped: false
FileName : sample/outDir/inputFile2.js.map
{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile2.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,aAAa,CAAC;AAC1B,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,GAAG,EAAE,CAAC;AACd,CAAC"}FileName : sample/outDir/inputFile2.js
{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile2.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,aAAa,CAAC;AAC1B,IAAI,KAAK,KAAK,SAAS,EAAE;IACtB,IAAI,CAAC,GAAG,EAAE,CAAC;CACb"}FileName : sample/outDir/inputFile2.js
var intro = "hello world";
if (intro !== undefined) {
var k = 10;

View File

@@ -0,0 +1,10 @@
//// [ifStatementInternalComments.ts]
/*1*/ if /*2*/ ( /*3*/ true /*4*/ ) /*5*/ {}
/*1*/ if /*2*/ ( /*3*/ true /*4*/ ) /*5*/ {} /*6*/ else /*7*/ {}
//// [ifStatementInternalComments.js]
/*1*/ if /*2*/ ( /*3*/true /*4*/) /*5*/ { }
/*1*/ if /*2*/ ( /*3*/true /*4*/) /*5*/ { } /*6*/
else /*7*/ { }

View File

@@ -0,0 +1,6 @@
=== tests/cases/compiler/ifStatementInternalComments.ts ===
/*1*/ if /*2*/ ( /*3*/ true /*4*/ ) /*5*/ {}
No type information for this code.
No type information for this code./*1*/ if /*2*/ ( /*3*/ true /*4*/ ) /*5*/ {} /*6*/ else /*7*/ {}
No type information for this code.
No type information for this code.

View File

@@ -0,0 +1,7 @@
=== tests/cases/compiler/ifStatementInternalComments.ts ===
/*1*/ if /*2*/ ( /*3*/ true /*4*/ ) /*5*/ {}
>true : true
/*1*/ if /*2*/ ( /*3*/ true /*4*/ ) /*5*/ {} /*6*/ else /*7*/ {}
>true : true

View File

@@ -0,0 +1,25 @@
//// [tests/cases/compiler/importExportInternalComments.ts] ////
//// [include.d.ts]
declare module "foo";
//// [default.ts]
/*1*/ export /*2*/ default /*3*/ Array /*4*/;
//// [index.ts]
/*1*/ import /*2*/ D /*3*/, /*4*/ { /*5*/ A /*6*/, /*7*/ B /*8*/ as /*9*/ C /*10*/ } /*11*/ from /*12*/ "foo";
/*1*/ import /*2*/ * /*3*/ as /*4*/ foo /*5*/ from /*6*/ "foo";
void D, A, C, foo; // Use the variables to prevent ellision
/*1*/ export /*2*/ { /*3*/ A /*4*/, /*5*/ B /*6*/ as /*7*/ C /*8*/ } /*9*/ from /*10*/ "foo";
/*1*/ export /*2*/ * /*3*/ from /*4*/ "foo"
//// [default.js]
/*1*/ export /*2*/ default /*3*/ Array /*4*/;
//// [index.js]
/*1*/ import /*2*/ D /*3*/, /*4*/ { /*5*/ A /*6*/, /*7*/ B /*8*/ as /*9*/ C /*10*/ } /*11*/ from /*12*/ "foo";
/*1*/ import /*2*/ * /*3*/ as /*4*/ foo /*5*/ from /*6*/ "foo";
void D, A, C, foo; // Use the variables to prevent ellision
/*1*/ export /*2*/ { /*3*/ A /*4*/, /*5*/ B /*6*/ as /*7*/ C /*8*/ } /*9*/ from /*10*/ "foo";
/*1*/ export /*2*/ * /*3*/ from /*4*/ "foo";

View File

@@ -0,0 +1,30 @@
=== tests/cases/compiler/include.d.ts ===
declare module "foo";
>"foo" : Symbol("foo", Decl(include.d.ts, 0, 0))
=== tests/cases/compiler/default.ts ===
/*1*/ export /*2*/ default /*3*/ Array /*4*/;
>Array : Symbol(Array, Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 1 more)
=== tests/cases/compiler/index.ts ===
/*1*/ import /*2*/ D /*3*/, /*4*/ { /*5*/ A /*6*/, /*7*/ B /*8*/ as /*9*/ C /*10*/ } /*11*/ from /*12*/ "foo";
>D : Symbol(D, Decl(index.ts, 0, 12))
>A : Symbol(A, Decl(index.ts, 0, 35))
>B : Symbol(C, Decl(index.ts, 0, 50))
>C : Symbol(C, Decl(index.ts, 0, 50))
/*1*/ import /*2*/ * /*3*/ as /*4*/ foo /*5*/ from /*6*/ "foo";
>foo : Symbol(foo, Decl(index.ts, 1, 12))
void D, A, C, foo; // Use the variables to prevent ellision
>D : Symbol(D, Decl(index.ts, 0, 12))
>A : Symbol(A, Decl(index.ts, 0, 35))
>C : Symbol(C, Decl(index.ts, 0, 50))
>foo : Symbol(foo, Decl(index.ts, 1, 12))
/*1*/ export /*2*/ { /*3*/ A /*4*/, /*5*/ B /*6*/ as /*7*/ C /*8*/ } /*9*/ from /*10*/ "foo";
>A : Symbol(A, Decl(index.ts, 5, 20))
>B : Symbol(C, Decl(index.ts, 5, 35))
>C : Symbol(C, Decl(index.ts, 5, 35))
/*1*/ export /*2*/ * /*3*/ from /*4*/ "foo"

View File

@@ -0,0 +1,34 @@
=== tests/cases/compiler/include.d.ts ===
declare module "foo";
>"foo" : any
=== tests/cases/compiler/default.ts ===
/*1*/ export /*2*/ default /*3*/ Array /*4*/;
>Array : T[]
=== tests/cases/compiler/index.ts ===
/*1*/ import /*2*/ D /*3*/, /*4*/ { /*5*/ A /*6*/, /*7*/ B /*8*/ as /*9*/ C /*10*/ } /*11*/ from /*12*/ "foo";
>D : any
>A : any
>B : any
>C : any
/*1*/ import /*2*/ * /*3*/ as /*4*/ foo /*5*/ from /*6*/ "foo";
>foo : any
void D, A, C, foo; // Use the variables to prevent ellision
>void D, A, C, foo : any
>void D, A, C : any
>void D, A : any
>void D : undefined
>D : any
>A : any
>C : any
>foo : any
/*1*/ export /*2*/ { /*3*/ A /*4*/, /*5*/ B /*6*/ as /*7*/ C /*8*/ } /*9*/ from /*10*/ "foo";
>A : any
>B : any
>C : any
/*1*/ export /*2*/ * /*3*/ from /*4*/ "foo"

View File

@@ -27,7 +27,8 @@ function fn() {
catch (x) { } // error missing try
finally { } // potential error; can be absorbed by the 'catch'
try { }
finally { }
finally { // error missing finally
} // error missing finally
; // error missing finally
}
function fn2() {

View File

@@ -90,13 +90,13 @@ var __extends = (this && this.__extends) || (function () {
};
})();
// @ts-check
var W = ((4));
var W = (4); // Error
var W = /** @type {string} */ ( /** @type {*} */(4));
var W = /** @type {string} */ (4); // Error
/** @type {*} */
var a;
/** @type {string} */
var s;
var a = ("" + 4);
var a = /** @type {*} */ ("" + 4);
var s = "" + /** @type {*} */ (4);
var SomeBase = /** @class */ (function () {
function SomeBase() {
@@ -146,6 +146,6 @@ someBase = /** @type {SomeBase} */ (someFakeClass);
var numOrStr;
/** @type {string} */
var str;
if ((numOrStr === undefined)) {
if ( /** @type {numOrStr is string} */(numOrStr === undefined)) { // Error
str = numOrStr; // Error, no narrowing occurred
}

View File

@@ -5,4 +5,4 @@ const a = /* @type string */(Foo);
//// [index.js]
function Foo() { }
var a = (Foo);
var a = /* @type string */ (Foo);

View File

@@ -1,3 +1,3 @@
//// [Element.js.map]
{"version":3,"file":"Element.js","sourceRoot":"","sources":["Element.ts"],"names":[],"mappings":";;AAYA,IAAiB,OAAO,CAUvB;AAVD,WAAiB,OAAO;IACpB,mBAA0B,EAAO;QAC7B,MAAM,CAAC,EAAE,CAAC,wBAAwB,KAAK,SAAS,CAAC;IACrD,CAAC;IAFe,iBAAS,YAExB,CAAA;IAED,uBAA8B,IAAW;QAErC,MAAM,CAAC,EACN,CAAA;IACL,CAAC;IAJe,qBAAa,gBAI5B,CAAA;AACL,CAAC,EAVgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAUvB;AAEU,QAAA,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;AAEjD,qBAAqB,IAAY;IAC7B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"}//// [test.js.map]
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAAA,uCAAmC;AACnC,IAAI,aAAa,GAAG,iBAAO,CAAC,aAAa,CAAC;AAC1C,IAAI,CAIH,CAAC;AAEF;IACC,IAAI;QACH,MAAM,CAAC;YACN,wBAAM,OAAO,EAAC,YAAY,GAAQ;YAClC,wBAAM,OAAO,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,GAAS;SAC9B,CAAC;IACH,CAAC;CACD"}
{"version":3,"file":"Element.js","sourceRoot":"","sources":["Element.ts"],"names":[],"mappings":";;AAYA,IAAiB,OAAO,CAUvB;AAVD,WAAiB,OAAO;IACpB,mBAA0B,EAAO;QAC7B,OAAO,EAAE,CAAC,wBAAwB,KAAK,SAAS,CAAC;IACrD,CAAC;IAFe,iBAAS,YAExB,CAAA;IAED,uBAA8B,IAAW;QAErC,OAAO,EACN,CAAA;IACL,CAAC;IAJe,qBAAa,gBAI5B,CAAA;AACL,CAAC,EAVgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAUvB;AAEU,QAAA,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;AAEjD,qBAAqB,IAAY;IAC7B,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"}//// [test.js.map]
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAAA,uCAAmC;AACnC,IAAI,aAAa,GAAG,iBAAO,CAAC,aAAa,CAAC;AAC1C,IAAI,CAIH,CAAC;AAEF;IACC,IAAI;QACH,OAAO;YACN,wBAAM,OAAO,EAAC,YAAY,GAAQ;YAClC,wBAAM,OAAO,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,GAAS;SAC9B,CAAC;IACH,CAAC;CACD"}

View File

@@ -74,33 +74,30 @@ sourceFile:Element.ts
---
>>> return el.markAsChildOfRootElement !== undefined;
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
6 > ^^^^^^^^^^^^^^^^^^^^^^^^
7 > ^^^^^
8 > ^^^^^^^^^
9 > ^
2 > ^^^^^^^
3 > ^^
4 > ^
5 > ^^^^^^^^^^^^^^^^^^^^^^^^
6 > ^^^^^
7 > ^^^^^^^^^
8 > ^
1->): el is JSX.Element {
>
2 > return
3 >
4 > el
5 > .
6 > markAsChildOfRootElement
7 > !==
8 > undefined
9 > ;
2 > return
3 > el
4 > .
5 > markAsChildOfRootElement
6 > !==
7 > undefined
8 > ;
1->Emitted(6, 9) Source(15, 9) + SourceIndex(0)
2 >Emitted(6, 15) Source(15, 15) + SourceIndex(0)
3 >Emitted(6, 16) Source(15, 16) + SourceIndex(0)
4 >Emitted(6, 18) Source(15, 18) + SourceIndex(0)
5 >Emitted(6, 19) Source(15, 19) + SourceIndex(0)
6 >Emitted(6, 43) Source(15, 43) + SourceIndex(0)
7 >Emitted(6, 48) Source(15, 48) + SourceIndex(0)
8 >Emitted(6, 57) Source(15, 57) + SourceIndex(0)
9 >Emitted(6, 58) Source(15, 58) + SourceIndex(0)
2 >Emitted(6, 16) Source(15, 16) + SourceIndex(0)
3 >Emitted(6, 18) Source(15, 18) + SourceIndex(0)
4 >Emitted(6, 19) Source(15, 19) + SourceIndex(0)
5 >Emitted(6, 43) Source(15, 43) + SourceIndex(0)
6 >Emitted(6, 48) Source(15, 48) + SourceIndex(0)
7 >Emitted(6, 57) Source(15, 57) + SourceIndex(0)
8 >Emitted(6, 58) Source(15, 58) + SourceIndex(0)
---
>>> }
1 >^^^^
@@ -144,23 +141,20 @@ sourceFile:Element.ts
---
>>> return {};
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
2 > ^^^^^^^
3 > ^^
4 > ^
1 >) {
>
>
2 > return
3 >
4 > {
2 > return
3 > {
> }
5 >
4 >
1 >Emitted(10, 9) Source(20, 9) + SourceIndex(0)
2 >Emitted(10, 15) Source(20, 15) + SourceIndex(0)
3 >Emitted(10, 16) Source(20, 16) + SourceIndex(0)
4 >Emitted(10, 18) Source(21, 10) + SourceIndex(0)
5 >Emitted(10, 19) Source(21, 10) + SourceIndex(0)
2 >Emitted(10, 16) Source(20, 16) + SourceIndex(0)
3 >Emitted(10, 18) Source(21, 10) + SourceIndex(0)
4 >Emitted(10, 19) Source(21, 10) + SourceIndex(0)
---
>>> }
1 >^^^^
@@ -275,60 +269,57 @@ sourceFile:Element.ts
---
>>> return text[0].toLowerCase() + text.substring(1);
1->^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^
5 > ^
6 > ^
7 > ^
8 > ^
9 > ^^^^^^^^^^^
10> ^^
11> ^^^
12> ^^^^
13> ^
14> ^^^^^^^^^
15> ^
16> ^
17> ^
18> ^
2 > ^^^^^^^
3 > ^^^^
4 > ^
5 > ^
6 > ^
7 > ^
8 > ^^^^^^^^^^^
9 > ^^
10> ^^^
11> ^^^^
12> ^
13> ^^^^^^^^^
14> ^
15> ^
16> ^
17> ^
1->): string {
>
2 > return
3 >
4 > text
5 > [
6 > 0
7 > ]
8 > .
9 > toLowerCase
10> ()
11> +
12> text
13> .
14> substring
15> (
16> 1
17> )
18> ;
2 > return
3 > text
4 > [
5 > 0
6 > ]
7 > .
8 > toLowerCase
9 > ()
10> +
11> text
12> .
13> substring
14> (
15> 1
16> )
17> ;
1->Emitted(16, 5) Source(28, 5) + SourceIndex(0)
2 >Emitted(16, 11) Source(28, 11) + SourceIndex(0)
3 >Emitted(16, 12) Source(28, 12) + SourceIndex(0)
4 >Emitted(16, 16) Source(28, 16) + SourceIndex(0)
5 >Emitted(16, 17) Source(28, 17) + SourceIndex(0)
6 >Emitted(16, 18) Source(28, 18) + SourceIndex(0)
7 >Emitted(16, 19) Source(28, 19) + SourceIndex(0)
8 >Emitted(16, 20) Source(28, 20) + SourceIndex(0)
9 >Emitted(16, 31) Source(28, 31) + SourceIndex(0)
10>Emitted(16, 33) Source(28, 33) + SourceIndex(0)
11>Emitted(16, 36) Source(28, 36) + SourceIndex(0)
12>Emitted(16, 40) Source(28, 40) + SourceIndex(0)
13>Emitted(16, 41) Source(28, 41) + SourceIndex(0)
14>Emitted(16, 50) Source(28, 50) + SourceIndex(0)
15>Emitted(16, 51) Source(28, 51) + SourceIndex(0)
16>Emitted(16, 52) Source(28, 52) + SourceIndex(0)
17>Emitted(16, 53) Source(28, 53) + SourceIndex(0)
18>Emitted(16, 54) Source(28, 54) + SourceIndex(0)
2 >Emitted(16, 12) Source(28, 12) + SourceIndex(0)
3 >Emitted(16, 16) Source(28, 16) + SourceIndex(0)
4 >Emitted(16, 17) Source(28, 17) + SourceIndex(0)
5 >Emitted(16, 18) Source(28, 18) + SourceIndex(0)
6 >Emitted(16, 19) Source(28, 19) + SourceIndex(0)
7 >Emitted(16, 20) Source(28, 20) + SourceIndex(0)
8 >Emitted(16, 31) Source(28, 31) + SourceIndex(0)
9 >Emitted(16, 33) Source(28, 33) + SourceIndex(0)
10>Emitted(16, 36) Source(28, 36) + SourceIndex(0)
11>Emitted(16, 40) Source(28, 40) + SourceIndex(0)
12>Emitted(16, 41) Source(28, 41) + SourceIndex(0)
13>Emitted(16, 50) Source(28, 50) + SourceIndex(0)
14>Emitted(16, 51) Source(28, 51) + SourceIndex(0)
15>Emitted(16, 52) Source(28, 52) + SourceIndex(0)
16>Emitted(16, 53) Source(28, 53) + SourceIndex(0)
17>Emitted(16, 54) Source(28, 54) + SourceIndex(0)
---
>>>}
1 >
@@ -428,16 +419,13 @@ sourceFile:test.tsx
---
>>> return [
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
2 > ^^^^^^^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->() {
>
2 > return
3 >
2 > return
1->Emitted(8, 9) Source(11, 3) + SourceIndex(0)
2 >Emitted(8, 15) Source(11, 9) + SourceIndex(0)
3 >Emitted(8, 16) Source(11, 10) + SourceIndex(0)
2 >Emitted(8, 16) Source(11, 10) + SourceIndex(0)
---
>>> createElement("meta", { content: "helloworld" }),
1->^^^^^^^^^^^^

View File

@@ -1,2 +1,2 @@
//// [test.js.map]
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAMA;IACI,MAAM,CAAC,aAAa;QAChB,MAAM,CAAC,0BAAO,CAAC;IACnB,CAAC;CACJ;AAJD,oCAIC"}
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAMA;IACI,MAAM,CAAC,aAAa;QAChB,OAAO,0BAAO,CAAC;IACnB,CAAC;CACJ;AAJD,oCAIC"}

View File

@@ -40,21 +40,18 @@ sourceFile:test.tsx
---
>>> return createElement("div", null);
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^
5 > ^
2 > ^^^^^^^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^
4 > ^
1->) {
>
2 > return
3 >
4 > <div />
5 > ;
2 > return
3 > <div />
4 > ;
1->Emitted(5, 9) Source(9, 9) + SourceIndex(0)
2 >Emitted(5, 15) Source(9, 15) + SourceIndex(0)
3 >Emitted(5, 16) Source(9, 16) + SourceIndex(0)
4 >Emitted(5, 42) Source(9, 23) + SourceIndex(0)
5 >Emitted(5, 43) Source(9, 24) + SourceIndex(0)
2 >Emitted(5, 16) Source(9, 16) + SourceIndex(0)
3 >Emitted(5, 42) Source(9, 23) + SourceIndex(0)
4 >Emitted(5, 43) Source(9, 24) + SourceIndex(0)
---
>>> }
1 >^^^^

View File

@@ -1,2 +1,2 @@
//// [test.js.map]
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAMA;IACI,MAAM;QACF,MAAM,CAAC,0BAAO,CAAC;IACnB,CAAC;CACJ;AAJD,oCAIC"}
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAMA;IACI,MAAM;QACF,OAAO,0BAAO,CAAC;IACnB,CAAC;CACJ;AAJD,oCAIC"}

View File

@@ -34,21 +34,18 @@ sourceFile:test.tsx
---
>>> return createElement("div", null);
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^
5 > ^
2 > ^^^^^^^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^
4 > ^
1->() {
>
2 > return
3 >
4 > <div />
5 > ;
2 > return
3 > <div />
4 > ;
1->Emitted(5, 9) Source(9, 9) + SourceIndex(0)
2 >Emitted(5, 15) Source(9, 15) + SourceIndex(0)
3 >Emitted(5, 16) Source(9, 16) + SourceIndex(0)
4 >Emitted(5, 42) Source(9, 23) + SourceIndex(0)
5 >Emitted(5, 43) Source(9, 24) + SourceIndex(0)
2 >Emitted(5, 16) Source(9, 16) + SourceIndex(0)
3 >Emitted(5, 42) Source(9, 23) + SourceIndex(0)
4 >Emitted(5, 43) Source(9, 24) + SourceIndex(0)
---
>>> }
1 >^^^^

View File

@@ -1,3 +1,3 @@
//// [Element.js.map]
{"version":3,"file":"Element.js","sourceRoot":"","sources":["Element.ts"],"names":[],"mappings":";;AAYA,IAAiB,OAAO,CAUvB;AAVD,WAAiB,OAAO;IACpB,mBAA0B,EAAO;QAC7B,MAAM,CAAC,EAAE,CAAC,wBAAwB,KAAK,SAAS,CAAC;IACrD,CAAC;IAFe,iBAAS,YAExB,CAAA;IAED,uBAA8B,IAAW;QAErC,MAAM,CAAC,EACN,CAAA;IACL,CAAC;IAJe,qBAAa,gBAI5B,CAAA;AACL,CAAC,EAVgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAUvB;AAEU,QAAA,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;AAEjD,qBAAqB,IAAY;IAC7B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"}//// [test.js.map]
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAAA,uCAAmC;AAEnC,IAAI,CAIH,CAAC;AAEF;IACC,IAAI;QACH,MAAM,CAAC;YACN,0CAAM,OAAO,EAAC,YAAY,GAAQ;YAClC,0CAAM,OAAO,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,GAAS;SAC9B,CAAC;IACH,CAAC;CACD"}
{"version":3,"file":"Element.js","sourceRoot":"","sources":["Element.ts"],"names":[],"mappings":";;AAYA,IAAiB,OAAO,CAUvB;AAVD,WAAiB,OAAO;IACpB,mBAA0B,EAAO;QAC7B,OAAO,EAAE,CAAC,wBAAwB,KAAK,SAAS,CAAC;IACrD,CAAC;IAFe,iBAAS,YAExB,CAAA;IAED,uBAA8B,IAAW;QAErC,OAAO,EACN,CAAA;IACL,CAAC;IAJe,qBAAa,gBAI5B,CAAA;AACL,CAAC,EAVgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAUvB;AAEU,QAAA,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;AAEjD,qBAAqB,IAAY;IAC7B,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"}//// [test.js.map]
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAAA,uCAAmC;AAEnC,IAAI,CAIH,CAAC;AAEF;IACC,IAAI;QACH,OAAO;YACN,0CAAM,OAAO,EAAC,YAAY,GAAQ;YAClC,0CAAM,OAAO,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,GAAS;SAC9B,CAAC;IACH,CAAC;CACD"}

View File

@@ -74,33 +74,30 @@ sourceFile:Element.ts
---
>>> return el.markAsChildOfRootElement !== undefined;
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
6 > ^^^^^^^^^^^^^^^^^^^^^^^^
7 > ^^^^^
8 > ^^^^^^^^^
9 > ^
2 > ^^^^^^^
3 > ^^
4 > ^
5 > ^^^^^^^^^^^^^^^^^^^^^^^^
6 > ^^^^^
7 > ^^^^^^^^^
8 > ^
1->): el is JSX.Element {
>
2 > return
3 >
4 > el
5 > .
6 > markAsChildOfRootElement
7 > !==
8 > undefined
9 > ;
2 > return
3 > el
4 > .
5 > markAsChildOfRootElement
6 > !==
7 > undefined
8 > ;
1->Emitted(6, 9) Source(15, 9) + SourceIndex(0)
2 >Emitted(6, 15) Source(15, 15) + SourceIndex(0)
3 >Emitted(6, 16) Source(15, 16) + SourceIndex(0)
4 >Emitted(6, 18) Source(15, 18) + SourceIndex(0)
5 >Emitted(6, 19) Source(15, 19) + SourceIndex(0)
6 >Emitted(6, 43) Source(15, 43) + SourceIndex(0)
7 >Emitted(6, 48) Source(15, 48) + SourceIndex(0)
8 >Emitted(6, 57) Source(15, 57) + SourceIndex(0)
9 >Emitted(6, 58) Source(15, 58) + SourceIndex(0)
2 >Emitted(6, 16) Source(15, 16) + SourceIndex(0)
3 >Emitted(6, 18) Source(15, 18) + SourceIndex(0)
4 >Emitted(6, 19) Source(15, 19) + SourceIndex(0)
5 >Emitted(6, 43) Source(15, 43) + SourceIndex(0)
6 >Emitted(6, 48) Source(15, 48) + SourceIndex(0)
7 >Emitted(6, 57) Source(15, 57) + SourceIndex(0)
8 >Emitted(6, 58) Source(15, 58) + SourceIndex(0)
---
>>> }
1 >^^^^
@@ -144,23 +141,20 @@ sourceFile:Element.ts
---
>>> return {};
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
2 > ^^^^^^^
3 > ^^
4 > ^
1 >) {
>
>
2 > return
3 >
4 > {
2 > return
3 > {
> }
5 >
4 >
1 >Emitted(10, 9) Source(20, 9) + SourceIndex(0)
2 >Emitted(10, 15) Source(20, 15) + SourceIndex(0)
3 >Emitted(10, 16) Source(20, 16) + SourceIndex(0)
4 >Emitted(10, 18) Source(21, 10) + SourceIndex(0)
5 >Emitted(10, 19) Source(21, 10) + SourceIndex(0)
2 >Emitted(10, 16) Source(20, 16) + SourceIndex(0)
3 >Emitted(10, 18) Source(21, 10) + SourceIndex(0)
4 >Emitted(10, 19) Source(21, 10) + SourceIndex(0)
---
>>> }
1 >^^^^
@@ -275,60 +269,57 @@ sourceFile:Element.ts
---
>>> return text[0].toLowerCase() + text.substring(1);
1->^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^
5 > ^
6 > ^
7 > ^
8 > ^
9 > ^^^^^^^^^^^
10> ^^
11> ^^^
12> ^^^^
13> ^
14> ^^^^^^^^^
15> ^
16> ^
17> ^
18> ^
2 > ^^^^^^^
3 > ^^^^
4 > ^
5 > ^
6 > ^
7 > ^
8 > ^^^^^^^^^^^
9 > ^^
10> ^^^
11> ^^^^
12> ^
13> ^^^^^^^^^
14> ^
15> ^
16> ^
17> ^
1->): string {
>
2 > return
3 >
4 > text
5 > [
6 > 0
7 > ]
8 > .
9 > toLowerCase
10> ()
11> +
12> text
13> .
14> substring
15> (
16> 1
17> )
18> ;
2 > return
3 > text
4 > [
5 > 0
6 > ]
7 > .
8 > toLowerCase
9 > ()
10> +
11> text
12> .
13> substring
14> (
15> 1
16> )
17> ;
1->Emitted(16, 5) Source(28, 5) + SourceIndex(0)
2 >Emitted(16, 11) Source(28, 11) + SourceIndex(0)
3 >Emitted(16, 12) Source(28, 12) + SourceIndex(0)
4 >Emitted(16, 16) Source(28, 16) + SourceIndex(0)
5 >Emitted(16, 17) Source(28, 17) + SourceIndex(0)
6 >Emitted(16, 18) Source(28, 18) + SourceIndex(0)
7 >Emitted(16, 19) Source(28, 19) + SourceIndex(0)
8 >Emitted(16, 20) Source(28, 20) + SourceIndex(0)
9 >Emitted(16, 31) Source(28, 31) + SourceIndex(0)
10>Emitted(16, 33) Source(28, 33) + SourceIndex(0)
11>Emitted(16, 36) Source(28, 36) + SourceIndex(0)
12>Emitted(16, 40) Source(28, 40) + SourceIndex(0)
13>Emitted(16, 41) Source(28, 41) + SourceIndex(0)
14>Emitted(16, 50) Source(28, 50) + SourceIndex(0)
15>Emitted(16, 51) Source(28, 51) + SourceIndex(0)
16>Emitted(16, 52) Source(28, 52) + SourceIndex(0)
17>Emitted(16, 53) Source(28, 53) + SourceIndex(0)
18>Emitted(16, 54) Source(28, 54) + SourceIndex(0)
2 >Emitted(16, 12) Source(28, 12) + SourceIndex(0)
3 >Emitted(16, 16) Source(28, 16) + SourceIndex(0)
4 >Emitted(16, 17) Source(28, 17) + SourceIndex(0)
5 >Emitted(16, 18) Source(28, 18) + SourceIndex(0)
6 >Emitted(16, 19) Source(28, 19) + SourceIndex(0)
7 >Emitted(16, 20) Source(28, 20) + SourceIndex(0)
8 >Emitted(16, 31) Source(28, 31) + SourceIndex(0)
9 >Emitted(16, 33) Source(28, 33) + SourceIndex(0)
10>Emitted(16, 36) Source(28, 36) + SourceIndex(0)
11>Emitted(16, 40) Source(28, 40) + SourceIndex(0)
12>Emitted(16, 41) Source(28, 41) + SourceIndex(0)
13>Emitted(16, 50) Source(28, 50) + SourceIndex(0)
14>Emitted(16, 51) Source(28, 51) + SourceIndex(0)
15>Emitted(16, 52) Source(28, 52) + SourceIndex(0)
16>Emitted(16, 53) Source(28, 53) + SourceIndex(0)
17>Emitted(16, 54) Source(28, 54) + SourceIndex(0)
---
>>>}
1 >
@@ -401,16 +392,13 @@ sourceFile:test.tsx
---
>>> return [
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
2 > ^^^^^^^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->() {
>
2 > return
3 >
2 > return
1->Emitted(7, 9) Source(11, 3) + SourceIndex(0)
2 >Emitted(7, 15) Source(11, 9) + SourceIndex(0)
3 >Emitted(7, 16) Source(11, 10) + SourceIndex(0)
2 >Emitted(7, 16) Source(11, 10) + SourceIndex(0)
---
>>> Element_1.Element.createElement("meta", { content: "helloworld" }),
1->^^^^^^^^^^^^

View File

@@ -1,2 +1,2 @@
//// [test.js.map]
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAMA;IACI,MAAM,CAAC,aAAa;QAChB,MAAM,CAAC,oCAAO,CAAC;IACnB,CAAC;CACJ;AAJD,oCAIC"}
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAMA;IACI,MAAM,CAAC,aAAa;QAChB,OAAO,oCAAO,CAAC;IACnB,CAAC;CACJ;AAJD,oCAIC"}

View File

@@ -40,21 +40,18 @@ sourceFile:test.tsx
---
>>> return MyElement.createElement("div", null);
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5 > ^
2 > ^^^^^^^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 > ^
1->) {
>
2 > return
3 >
4 > <div />
5 > ;
2 > return
3 > <div />
4 > ;
1->Emitted(5, 9) Source(9, 9) + SourceIndex(0)
2 >Emitted(5, 15) Source(9, 15) + SourceIndex(0)
3 >Emitted(5, 16) Source(9, 16) + SourceIndex(0)
4 >Emitted(5, 52) Source(9, 23) + SourceIndex(0)
5 >Emitted(5, 53) Source(9, 24) + SourceIndex(0)
2 >Emitted(5, 16) Source(9, 16) + SourceIndex(0)
3 >Emitted(5, 52) Source(9, 23) + SourceIndex(0)
4 >Emitted(5, 53) Source(9, 24) + SourceIndex(0)
---
>>> }
1 >^^^^

View File

@@ -0,0 +1,12 @@
//// [keywordExpressionInternalComments.ts]
/*1*/ new /*2*/ Array /*3*/;
/*1*/ typeof /*2*/ Array /*3*/;
/*1*/ void /*2*/ Array /*3*/;
/*1*/ delete /*2*/ Array.toString /*3*/;
//// [keywordExpressionInternalComments.js]
/*1*/ new /*2*/ Array /*3*/;
/*1*/ typeof /*2*/ Array /*3*/;
/*1*/ void /*2*/ Array /*3*/;
/*1*/ delete /*2*/ Array.toString /*3*/;

View File

@@ -0,0 +1,15 @@
=== tests/cases/compiler/keywordExpressionInternalComments.ts ===
/*1*/ new /*2*/ Array /*3*/;
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
/*1*/ typeof /*2*/ Array /*3*/;
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
/*1*/ void /*2*/ Array /*3*/;
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
/*1*/ delete /*2*/ Array.toString /*3*/;
>Array.toString : Symbol(Function.toString, Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>toString : Symbol(Function.toString, Decl(lib.d.ts, --, --))

View File

@@ -0,0 +1,19 @@
=== tests/cases/compiler/keywordExpressionInternalComments.ts ===
/*1*/ new /*2*/ Array /*3*/;
>new /*2*/ Array : any[]
>Array : ArrayConstructor
/*1*/ typeof /*2*/ Array /*3*/;
>typeof /*2*/ Array : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
>Array : ArrayConstructor
/*1*/ void /*2*/ Array /*3*/;
>void /*2*/ Array : undefined
>Array : ArrayConstructor
/*1*/ delete /*2*/ Array.toString /*3*/;
>delete /*2*/ Array.toString : boolean
>Array.toString : () => string
>Array : ArrayConstructor
>toString : () => string

View File

@@ -29,7 +29,7 @@ function tryCatch() {
try {
// do stuff...
}
catch (err) {
catch (err) { // err is implicitly 'any' and cannot be annotated
if (isFooError(err)) {
err.dontPanic(); // OK
err.doPanic(); // ERROR: Property 'doPanic' does not exist on type '{...}'

View File

@@ -25,17 +25,17 @@ if (x instanceof Date) {
//// [narrowFromAnyWithInstanceof.js]
if (x instanceof Function) {
if (x instanceof Function) { // 'any' is not narrowed when target type is 'Function'
x();
x(1, 2, 3);
x("hello!");
x.prop;
}
if (x instanceof Object) {
if (x instanceof Object) { // 'any' is not narrowed when target type is 'Object'
x.method();
x();
}
if (x instanceof Error) {
if (x instanceof Error) { // 'any' is narrowed to types other than 'Function'/'Object'
x.message;
x.mesage;
}

View File

@@ -36,17 +36,17 @@ if (isDate(x)) {
//// [narrowFromAnyWithTypePredicate.js]
if (isFunction(x)) {
if (isFunction(x)) { // 'any' is not narrowed when target type is 'Function'
x();
x(1, 2, 3);
x("hello!");
x.prop;
}
if (isObject(x)) {
if (isObject(x)) { // 'any' is not narrowed when target type is 'Object'
x.method();
x();
}
if (isAnything(x)) {
if (isAnything(x)) { // 'any' is narrowed to types other than 'Function'/'Object' (including {})
x.method();
x();
}

View File

@@ -1,2 +1,2 @@
//// [noCatchBlock.js.map]
{"version":3,"file":"noCatchBlock.js","sourceRoot":"","sources":["noCatchBlock.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC;IACJ,MAAM;AACP,CAAC;QAAS,CAAC;IACV,wBAAwB;AACzB,CAAC"}
{"version":3,"file":"noCatchBlock.js","sourceRoot":"","sources":["noCatchBlock.ts"],"names":[],"mappings":"AAAA,IAAI;IACH,MAAM;CACN;QAAS;IACT,wBAAwB;CACxB"}

View File

@@ -11,60 +11,48 @@ sourceFile:noCatchBlock.ts
>>>try {
1 >
2 >^^^^
3 > ^
4 > ^^^^^^->
3 > ^^^^^^^->
1 >
2 >try
3 > {
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0)
---
>>> // ...
1->^^^^
2 > ^^^^^^
1->
1->{
>
2 > // ...
1->Emitted(2, 5) Source(2, 2) + SourceIndex(0)
2 >Emitted(2, 11) Source(2, 8) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^->
1 >^
2 > ^^^^^^^^^->
1 >
>
2 >}
1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0)
2 >Emitted(3, 2) Source(3, 2) + SourceIndex(0)
>}
1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0)
---
>>>finally {
1->^^^^^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^->
2 > ^^^^^^^^^^^^^^^^^^^^^->
1-> finally
2 > {
1->Emitted(4, 9) Source(3, 11) + SourceIndex(0)
2 >Emitted(4, 10) Source(3, 12) + SourceIndex(0)
---
>>> // N.B. No 'catch' block
1->^^^^
2 > ^^^^^^^^^^^^^^^^^^^^^^^^
1->
1->{
>
2 > // N.B. No 'catch' block
1->Emitted(5, 5) Source(4, 2) + SourceIndex(0)
2 >Emitted(5, 29) Source(4, 26) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >^
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >}
1 >Emitted(6, 1) Source(5, 1) + SourceIndex(0)
2 >Emitted(6, 2) Source(5, 2) + SourceIndex(0)
>}
1 >Emitted(6, 2) Source(5, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=noCatchBlock.js.map

View File

@@ -8,7 +8,7 @@ F2();
// ==ORGANIZED==
/*A*/ import { /*L*/ F1 /*M*/, /*C*/ F2 /*D*/ } /*E*/ from "lib" /*G*/; /*H*/ //I
/*A*/ import /*B*/ { /*L*/ F1 /*M*/, /*C*/ F2 /*D*/ } /*E*/ from /*F*/ "lib" /*G*/; /*H*/ //I
F1();
F2();

View File

@@ -5,5 +5,5 @@
// ==ORGANIZED==
/*F*/ import "lib1" /*H*/; /*I*/ //J
/*A*/ import "lib2" /*C*/; /*D*/ //E
/*F*/ import /*G*/ "lib1" /*H*/; /*I*/ //J
/*A*/ import /*B*/ "lib2" /*C*/; /*D*/ //E

View File

@@ -6,6 +6,6 @@ F1();
// ==ORGANIZED==
/*A*/ import { /*C*/ F1 /*D*/ } /*G*/ from "lib" /*I*/; /*J*/ //K
/*A*/ import /*B*/ { /*C*/ F1 /*D*/ } /*G*/ from /*H*/ "lib" /*I*/; /*J*/ //K
F1();

Some files were not shown because too many files have changed in this diff Show More