Merge branch 'release-1.8' into checksuperbeforethislexically

This commit is contained in:
Kanchalai Tanglertsampan
2016-02-08 10:43:41 -08:00
154 changed files with 3632 additions and 160 deletions
+14 -5
View File
@@ -1384,7 +1384,7 @@ namespace ts {
// Export assignment in some sort of block construct
bindAnonymousDeclaration(node, SymbolFlags.Alias, getDeclarationName(node));
}
else if (boundExpression.kind === SyntaxKind.Identifier) {
else if (boundExpression.kind === SyntaxKind.Identifier && node.kind === SyntaxKind.ExportAssignment) {
// An export default clause with an identifier exports all meanings of that identifier
declareSymbol(container.symbol.exports, container.symbol, node, SymbolFlags.Alias, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes);
}
@@ -1435,7 +1435,8 @@ namespace ts {
// Declare a 'member' in case it turns out the container was an ES5 class
if (container.kind === SyntaxKind.FunctionExpression || container.kind === SyntaxKind.FunctionDeclaration) {
container.symbol.members = container.symbol.members || {};
declareSymbol(container.symbol.members, container.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
// It's acceptable for multiple 'this' assignments of the same identifier to occur
declareSymbol(container.symbol.members, container.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property);
}
}
@@ -1444,8 +1445,16 @@ namespace ts {
// Look up the function in the local scope, since prototype assignments should
// follow the function declaration
const classId = <Identifier>(<PropertyAccessExpression>(<PropertyAccessExpression>node.left).expression).expression;
const funcSymbol = container.locals[classId.text];
const leftSideOfAssignment = node.left as PropertyAccessExpression;
const classPrototype = leftSideOfAssignment.expression as PropertyAccessExpression;
const constructorFunction = classPrototype.expression as Identifier;
// Fix up parent pointers since we're going to use these nodes before we bind into them
leftSideOfAssignment.parent = node;
constructorFunction.parent = classPrototype;
classPrototype.parent = leftSideOfAssignment;
const funcSymbol = container.locals[constructorFunction.text];
if (!funcSymbol || !(funcSymbol.flags & SymbolFlags.Function)) {
return;
}
@@ -1456,7 +1465,7 @@ namespace ts {
}
// Declare the method/property
declareSymbol(funcSymbol.members, funcSymbol, <PropertyAccessExpression>node.left, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
}
function bindCallExpression(node: CallExpression) {
+64 -3
View File
@@ -2845,7 +2845,7 @@ namespace ts {
}
// Handle module.exports = expr
if (declaration.kind === SyntaxKind.BinaryExpression) {
return links.type = checkExpression((<BinaryExpression>declaration).right);
return links.type = getUnionType(map(symbol.declarations, (decl: BinaryExpression) => checkExpressionCached(decl.right)));
}
if (declaration.kind === SyntaxKind.PropertyAccessExpression) {
// Declarations only exist for property access expressions for certain
@@ -7242,6 +7242,15 @@ namespace ts {
// mark iteration statement as containing block-scoped binding captured in some function
getNodeLinks(current).flags |= NodeCheckFlags.LoopWithCapturedBlockScopedBinding;
}
// mark variables that are declared in loop initializer and reassigned inside the body of ForStatement.
// if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back.
if (container.kind === SyntaxKind.ForStatement &&
getAncestor(symbol.valueDeclaration, SyntaxKind.VariableDeclarationList).parent === container &&
isAssignedInBodyOfForStatement(node, <ForStatement>container)) {
getNodeLinks(symbol.valueDeclaration).flags |= NodeCheckFlags.NeedsLoopOutParameter;
}
// set 'declared inside loop' bit on the block-scoped binding
getNodeLinks(symbol.valueDeclaration).flags |= NodeCheckFlags.BlockScopedBindingInLoop;
}
@@ -7251,6 +7260,41 @@ namespace ts {
}
}
function isAssignedInBodyOfForStatement(node: Identifier, container: ForStatement): boolean {
let current: Node = node;
// skip parenthesized nodes
while (current.parent.kind === SyntaxKind.ParenthesizedExpression) {
current = current.parent;
}
// check if node is used as LHS in some assignment expression
let isAssigned = false;
if (current.parent.kind === SyntaxKind.BinaryExpression) {
isAssigned = (<BinaryExpression>current.parent).left === current && isAssignmentOperator((<BinaryExpression>current.parent).operatorToken.kind);
}
if ((current.parent.kind === SyntaxKind.PrefixUnaryExpression || current.parent.kind === SyntaxKind.PostfixUnaryExpression)) {
const expr = <PrefixUnaryExpression | PostfixUnaryExpression>current.parent;
isAssigned = expr.operator === SyntaxKind.PlusPlusToken || expr.operator === SyntaxKind.MinusMinusToken;
}
if (!isAssigned) {
return false;
}
// at this point we know that node is the target of assignment
// now check that modification happens inside the statement part of the ForStatement
while (current !== container) {
if (current === container.statement) {
return true;
}
else {
current = current.parent;
}
}
return false;
}
function captureLexicalThis(node: Node, container: Node): void {
getNodeLinks(node).flags |= NodeCheckFlags.LexicalThis;
if (container.kind === SyntaxKind.PropertyDeclaration || container.kind === SyntaxKind.Constructor) {
@@ -10412,9 +10456,11 @@ namespace ts {
function getReturnTypeFromJSDocComment(func: SignatureDeclaration | FunctionDeclaration): Type {
const returnTag = getJSDocReturnTag(func);
if (returnTag) {
if (returnTag && returnTag.typeExpression) {
return getTypeFromTypeNode(returnTag.typeExpression.type);
}
return undefined;
}
function createPromiseType(promisedType: Type): Type {
@@ -10489,7 +10535,8 @@ namespace ts {
}
else {
error(func, Diagnostics.No_best_common_type_exists_among_return_expressions);
return unknownType;
// Defer to unioning the return types so we get a) downstream errors earlier and b) better Salsa experience
return getUnionType(types);
}
}
@@ -15400,6 +15447,20 @@ namespace ts {
return getSymbolOfNode(entityName.parent);
}
if (isInJavaScriptFile(entityName) && entityName.parent.kind === SyntaxKind.PropertyAccessExpression) {
const specialPropertyAssignmentKind = getSpecialPropertyAssignmentKind(entityName.parent.parent);
switch (specialPropertyAssignmentKind) {
case SpecialPropertyAssignmentKind.ExportsProperty:
case SpecialPropertyAssignmentKind.PrototypeProperty:
return getSymbolOfNode(entityName.parent);
case SpecialPropertyAssignmentKind.ThisProperty:
case SpecialPropertyAssignmentKind.ModuleExports:
return getSymbolOfNode(entityName.parent.parent);
default:
// Fall through if it is not a special property assignment
}
}
if (entityName.parent.kind === SyntaxKind.ExportAssignment) {
return resolveEntityName(<Identifier>entityName,
/*all meanings*/ SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias);
+5
View File
@@ -294,6 +294,11 @@ namespace ts {
name: "allowJs",
type: "boolean",
description: Diagnostics.Allow_javascript_files_to_be_compiled
},
{
name: "noImplicitUseStrict",
type: "boolean",
description: Diagnostics.Do_not_emit_use_strict_directives_in_module_output
}
];
-4
View File
@@ -695,10 +695,6 @@ namespace ts {
}
function writeImportDeclaration(node: ImportDeclaration) {
if (!node.importClause && !(node.flags & NodeFlags.Export)) {
// do not write non-exported import declarations that don't have import clauses
return;
}
emitJsDocComments(node);
if (node.flags & NodeFlags.Export) {
write("export ");
+21 -16
View File
@@ -1,4 +1,4 @@
{
{
"Unterminated string literal.": {
"category": "Error",
"code": 1002
@@ -2171,6 +2171,7 @@
"category": "Error",
"code": 5059
},
"Concatenate and emit output to single file.": {
"category": "Message",
@@ -2216,10 +2217,10 @@
"category": "Message",
"code": 6011
},
"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)": {
"category": "Message",
"code": 6015
},
"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)": {
"category": "Message",
"code": 6015
},
"Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'": {
"category": "Message",
"code": 6016
@@ -2445,6 +2446,10 @@
"category": "Message",
"code": 6084
},
"Do not emit 'use strict' directives in module output.": {
"category": "Message",
"code": 6112
},
"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",
@@ -2632,23 +2637,23 @@
"code": 17004
},
"A constructor cannot contain a 'super' call when its class extends 'null'": {
"category": "Error",
"code": 17005
"category": "Error",
"code": 17005
},
"An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": {
"category": "Error",
"code": 17006
"category": "Error",
"code": 17006
},
"A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": {
"category": "Error",
"code": 17007
"category": "Error",
"code": 17007
},
"JSX element '{0}' has no corresponding closing tag.": {
"category": "Error",
"code": 17008
"category": "Error",
"code": 17008
},
"'super' must be called before accessing 'this' in the constructor of a derived class.": {
"category": "Error",
"code": 17009
"category": "Error",
"code": 17009
}
}
}
+151 -38
View File
@@ -287,6 +287,54 @@ namespace ts {
_i = 0x10000000, // Use/preference flag for '_i'
}
const enum CopyDirection {
ToOriginal,
ToOutParameter
}
/**
* If loop contains block scoped binding captured in some function then loop body is converted to a function.
* Lexical bindings declared in loop initializer will be passed into the loop body function as parameters,
* however if this binding is modified inside the body - this new value should be propagated back to the original binding.
* This is done by declaring new variable (out parameter holder) outside of the loop for every binding that is reassigned inside the body.
* On every iteration this variable is initialized with value of corresponding binding.
* At every point where control flow leaves the loop either explicitly (break/continue) or implicitly (at the end of loop body)
* we copy the value inside the loop to the out parameter holder.
*
* for (let x;;) {
* let a = 1;
* let b = () => a;
* x++
* if (...) break;
* ...
* }
*
* will be converted to
*
* var out_x;
* var loop = function(x) {
* var a = 1;
* var b = function() { return a; }
* x++;
* if (...) return out_x = x, "break";
* ...
* out_x = x;
* }
* for (var x;;) {
* out_x = x;
* var state = loop(x);
* x = out_x;
* if (state === "break") break;
* }
*
* NOTE: values to out parameters are not copies if loop is abrupted with 'return' - in this case this will end the entire enclosing function
* so nobody can observe this new value.
*/
interface LoopOutParameter {
originalName: Identifier;
outParamName: string;
}
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult {
// emit output for the __extends helper function
@@ -419,6 +467,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
* for (var x;;) loop(x);
*/
hoistedLocalVariables?: Identifier[];
/**
* List of loop out parameters - detailed descripion can be found in the comment to LoopOutParameter
*/
loopOutParameters?: LoopOutParameter[];
}
function setLabeledJump(state: ConvertedLoopState, isBreak: boolean, labelText: string, labelMarker: string): void {
@@ -2944,11 +2997,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}
let loopParameters: string[];
let loopOutParameters: LoopOutParameter[];
if (loopInitializer && (getCombinedNodeFlags(loopInitializer) & NodeFlags.BlockScoped)) {
// if loop initializer contains block scoped variables - they should be passed to converted loop body as parameters
loopParameters = [];
for (const varDeclaration of loopInitializer.declarations) {
collectNames(varDeclaration.name);
processVariableDeclaration(varDeclaration.name);
}
}
@@ -2958,14 +3012,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
writeLine();
write(`var ${functionName} = function(${paramList})`);
if (!bodyIsBlock) {
write(" {");
writeLine();
increaseIndent();
}
const convertedOuterLoopState = convertedLoopState;
convertedLoopState = {};
convertedLoopState = { loopOutParameters };
if (convertedOuterLoopState) {
// convertedOuterLoopState !== undefined means that this converted loop is nested in another converted loop.
@@ -2989,16 +3037,38 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}
}
emitEmbeddedStatement(node.statement);
write(" {");
writeLine();
increaseIndent();
if (!bodyIsBlock) {
decreaseIndent();
writeLine();
write("}");
if (bodyIsBlock) {
emitLines((<Block>node.statement).statements);
}
write(";");
else {
emit(node.statement);
}
writeLine();
// end of loop body -> copy out parameter
copyLoopOutParameters(convertedLoopState, CopyDirection.ToOutParameter, /*emitAsStatements*/true);
decreaseIndent();
writeLine();
write("};");
writeLine();
if (loopOutParameters) {
// declare variables to hold out params for loop body
write(`var `);
for (let i = 0; i < loopOutParameters.length; i++) {
if (i !== 0) {
write(", ");
}
write(loopOutParameters[i].outParamName);
}
write(";");
writeLine();
}
if (convertedLoopState.argumentsName) {
// if alias for arguments is set
if (convertedOuterLoopState) {
@@ -3062,14 +3132,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
return { functionName, paramList, state: currentLoopState };
function collectNames(name: Identifier | BindingPattern): void {
function processVariableDeclaration(name: Identifier | BindingPattern): void {
if (name.kind === SyntaxKind.Identifier) {
const nameText = isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(<Identifier>name) ? getGeneratedNameForNode(name) : (<Identifier>name).text;
const nameText = isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(<Identifier>name)
? getGeneratedNameForNode(name)
: (<Identifier>name).text;
loopParameters.push(nameText);
if (resolver.getNodeCheckFlags(name.parent) & NodeCheckFlags.NeedsLoopOutParameter) {
const reassignedVariable = { originalName: <Identifier>name, outParamName: makeUniqueName(`out_${nameText}`) };
(loopOutParameters || (loopOutParameters = [])).push(reassignedVariable);
}
}
else {
for (const element of (<BindingPattern>name).elements) {
collectNames(element.name);
processVariableDeclaration(element.name);
}
}
}
@@ -3100,6 +3177,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}
}
function copyLoopOutParameters(state: ConvertedLoopState, copyDirection: CopyDirection, emitAsStatements: boolean) {
if (state.loopOutParameters) {
for (const outParam of state.loopOutParameters) {
if (copyDirection === CopyDirection.ToOriginal) {
emitIdentifier(outParam.originalName);
write(` = ${outParam.outParamName}`);
}
else {
write(`${outParam.outParamName} = `);
emitIdentifier(outParam.originalName);
}
if (emitAsStatements) {
write(";");
writeLine();
}
else {
write(", ");
}
}
}
}
function emitConvertedLoopCall(loop: ConvertedLoop, emitAsBlock: boolean): void {
if (emitAsBlock) {
write(" {");
@@ -3120,6 +3219,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}
write(`${loop.functionName}(${loop.paramList});`);
writeLine();
copyLoopOutParameters(loop.state, CopyDirection.ToOriginal, /*emitAsStatements*/ true);
if (!isSimpleLoop) {
// for non simple loops we need to store result returned from converted loop function and use it to do dispatching
@@ -3138,7 +3240,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}
else {
// top level converted loop - return unwrapped value
write(`return ${loopResult}.value`);
write(`return ${loopResult}.value;`);
}
writeLine();
}
@@ -3439,14 +3541,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
(!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));
if (!canUseBreakOrContinue) {
write ("return ");
// explicit exit from loop -> copy out parameters
copyLoopOutParameters(convertedLoopState, CopyDirection.ToOutParameter, /*emitAsStatements*/ false);
if (!node.label) {
if (node.kind === SyntaxKind.BreakStatement) {
convertedLoopState.nonLocalJumps |= Jump.Break;
write(`return "break";`);
write(`"break";`);
}
else {
convertedLoopState.nonLocalJumps |= Jump.Continue;
write(`return "continue";`);
write(`"continue";`);
}
}
else {
@@ -3459,7 +3564,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
labelMarker = `continue-${node.label.text}`;
setLabeledJump(convertedLoopState, /*isBreak*/ false, node.label.text, labelMarker);
}
write(`return "${labelMarker}";`);
write(`"${labelMarker}";`);
}
return;
@@ -4766,18 +4871,24 @@ const _super = (function (geti, seti) {
emitToken(SyntaxKind.CloseBraceToken, body.statements.end);
}
function findInitialSuperCall(ctor: ConstructorDeclaration): ExpressionStatement {
if (ctor.body) {
const statement = (<Block>ctor.body).statements[0];
if (statement && statement.kind === SyntaxKind.ExpressionStatement) {
const expr = (<ExpressionStatement>statement).expression;
if (expr && expr.kind === SyntaxKind.CallExpression) {
const func = (<CallExpression>expr).expression;
if (func && func.kind === SyntaxKind.SuperKeyword) {
return <ExpressionStatement>statement;
}
}
}
/**
* Return the statement at a given index if it is a super-call statement
* @param ctor a constructor declaration
* @param index an index to constructor's body to check
*/
function getSuperCallAtGivenIndex(ctor: ConstructorDeclaration, index: number): ExpressionStatement {
if (!ctor.body) {
return undefined;
}
const statements = ctor.body.statements;
if (!statements || index >= statements.length) {
return undefined;
}
const statement = statements[index];
if (statement.kind === SyntaxKind.ExpressionStatement) {
return isSuperCallExpression((<ExpressionStatement>statement).expression) ? <ExpressionStatement>statement : undefined;
}
}
@@ -5061,13 +5172,15 @@ const _super = (function (geti, seti) {
if (ctor) {
emitDefaultValueAssignments(ctor);
emitRestParameter(ctor);
if (baseTypeElement) {
superCall = findInitialSuperCall(ctor);
superCall = getSuperCallAtGivenIndex(ctor, startIndex);
if (superCall) {
writeLine();
emit(superCall);
}
}
emitParameterPropertyAssignments(ctor);
}
else {
@@ -7155,7 +7268,7 @@ const _super = (function (geti, seti) {
write(`], function(${exportFunctionForFile}, ${contextObjectForFile}) {`);
writeLine();
increaseIndent();
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict);
writeLine();
write(`var __moduleName = ${contextObjectForFile} && ${contextObjectForFile}.id;`);
writeLine();
@@ -7261,7 +7374,7 @@ const _super = (function (geti, seti) {
writeModuleName(node, emitRelativePathAsModuleName);
emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, emitRelativePathAsModuleName);
increaseIndent();
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/!compilerOptions.noImplicitUseStrict);
emitExportStarHelper();
emitCaptureThisForNodeIfNecessary(node);
emitLinesStartingAt(node.statements, startIndex);
@@ -7273,7 +7386,7 @@ const _super = (function (geti, seti) {
}
function emitCommonJSModule(node: SourceFile) {
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false, /*ensureUseStrict*/ true);
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict);
emitEmitHelpers(node);
collectExternalModuleInfo(node);
emitExportStarHelper();
@@ -7302,7 +7415,7 @@ const _super = (function (geti, seti) {
})(`);
emitAMDFactoryHeader(dependencyNames);
increaseIndent();
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict);
emitExportStarHelper();
emitCaptureThisForNodeIfNecessary(node);
emitLinesStartingAt(node.statements, startIndex);
+23 -14
View File
@@ -3995,7 +3995,7 @@ namespace ts {
shorthandDeclaration.equalsToken = equalsToken;
shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
return finishNode(shorthandDeclaration);
return addJSDocComment(finishNode(shorthandDeclaration));
}
else {
const propertyAssignment = <PropertyAssignment>createNode(SyntaxKind.PropertyAssignment, fullStart);
@@ -4004,7 +4004,7 @@ namespace ts {
propertyAssignment.questionToken = questionToken;
parseExpected(SyntaxKind.ColonToken);
propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
return finishNode(propertyAssignment);
return addJSDocComment(finishNode(propertyAssignment));
}
}
@@ -4051,7 +4051,7 @@ namespace ts {
setDecoratorContext(/*val*/ true);
}
return finishNode(node);
return addJSDocComment(finishNode(node));
}
function parseOptionalIdentifier() {
@@ -4335,13 +4335,13 @@ namespace ts {
const labeledStatement = <LabeledStatement>createNode(SyntaxKind.LabeledStatement, fullStart);
labeledStatement.label = <Identifier>expression;
labeledStatement.statement = parseStatement();
return finishNode(labeledStatement);
return addJSDocComment(finishNode(labeledStatement));
}
else {
const expressionStatement = <ExpressionStatement>createNode(SyntaxKind.ExpressionStatement, fullStart);
expressionStatement.expression = expression;
parseSemicolon();
return finishNode(expressionStatement);
return addJSDocComment(finishNode(expressionStatement));
}
}
@@ -4778,7 +4778,7 @@ namespace ts {
parseExpected(SyntaxKind.ConstructorKeyword);
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node);
node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false, Diagnostics.or_expected);
return finishNode(node);
return addJSDocComment(finishNode(node));
}
function parseMethodDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, asteriskToken: Node, name: PropertyName, questionToken: Node, diagnosticMessage?: DiagnosticMessage): MethodDeclaration {
@@ -4792,7 +4792,7 @@ namespace ts {
const isAsync = !!(method.flags & NodeFlags.Async);
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method);
method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage);
return finishNode(method);
return addJSDocComment(finishNode(method));
}
function parsePropertyDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, name: PropertyName, questionToken: Node): ClassElement {
@@ -5758,6 +5758,9 @@ namespace ts {
function parseJSDocParameter(): ParameterDeclaration {
const parameter = <ParameterDeclaration>createNode(SyntaxKind.Parameter);
parameter.type = parseJSDocType();
if (parseOptional(SyntaxKind.EqualsToken)) {
parameter.questionToken = createNode(SyntaxKind.EqualsToken);
}
return finishNode(parameter);
}
@@ -5765,16 +5768,22 @@ namespace ts {
const result = <JSDocTypeReference>createNode(SyntaxKind.JSDocTypeReference);
result.name = parseSimplePropertyName();
while (parseOptional(SyntaxKind.DotToken)) {
if (token === SyntaxKind.LessThanToken) {
result.typeArguments = parseTypeArguments();
break;
}
else {
result.name = parseQualifiedName(result.name);
if (token === SyntaxKind.LessThanToken) {
result.typeArguments = parseTypeArguments();
}
else {
while (parseOptional(SyntaxKind.DotToken)) {
if (token === SyntaxKind.LessThanToken) {
result.typeArguments = parseTypeArguments();
break;
}
else {
result.name = parseQualifiedName(result.name);
}
}
}
return finishNode(result);
}
+3 -1
View File
@@ -2068,7 +2068,8 @@ namespace ts {
CapturedBlockScopedBinding = 0x00020000, // Block-scoped binding that is captured in some function
BlockScopedBindingInLoop = 0x00040000, // Block-scoped binding with declaration nested inside iteration statement
ClassWithBodyScopedClassBinding = 0x0080000, // Decorated class that contains a binding to itself inside of the class body.
BodyScopedClassBinding = 0x00100000, // Binding to a decorated class inside of the class's body.
BodyScopedClassBinding = 0x00100000, // Binding to a decorated class inside of the class's body.
NeedsLoopOutParameter = 0x00200000, // Block scoped binding whose value should be explicitly copied outside of the converted loop
}
/* @internal */
@@ -2434,6 +2435,7 @@ namespace ts {
forceConsistentCasingInFileNames?: boolean;
allowSyntheticDefaultImports?: boolean;
allowJs?: boolean;
noImplicitUseStrict?: boolean;
/* @internal */ stripInternal?: boolean;
// Skip checking lib.d.ts to help speed up tests.
+39 -3
View File
@@ -464,6 +464,10 @@ namespace ts {
return !!(getCombinedNodeFlags(node) & NodeFlags.Let);
}
export function isSuperCallExpression(n: Node): boolean {
return n.kind === SyntaxKind.CallExpression && (<CallExpression>n).expression.kind === SyntaxKind.SuperKeyword;
}
export function isPrologueDirective(node: Node): boolean {
return node.kind === SyntaxKind.ExpressionStatement && (<ExpressionStatement>node).expression.kind === SyntaxKind.StringLiteral;
}
@@ -1207,7 +1211,25 @@ namespace ts {
node.parent.parent.parent.kind === SyntaxKind.VariableStatement;
const variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : undefined;
return variableStatementNode && variableStatementNode.jsDocComment;
if (variableStatementNode) {
return variableStatementNode.jsDocComment;
}
// Also recognize when the node is the RHS of an assignment expression
const parent = node.parent;
const isSourceOfAssignmentExpressionStatement =
parent && parent.parent &&
parent.kind === SyntaxKind.BinaryExpression &&
(parent as BinaryExpression).operatorToken.kind === SyntaxKind.EqualsToken &&
parent.parent.kind === SyntaxKind.ExpressionStatement;
if (isSourceOfAssignmentExpressionStatement) {
return parent.parent.jsDocComment;
}
const isPropertyAssignmentExpression = parent && parent.kind === SyntaxKind.PropertyAssignment;
if (isPropertyAssignmentExpression) {
return parent.jsDocComment;
}
}
return undefined;
@@ -2018,8 +2040,22 @@ namespace ts {
}
function onSingleFileEmit(host: EmitHost, sourceFile: SourceFile) {
const jsFilePath = getOwnEmitOutputFilePath(sourceFile, host,
sourceFile.languageVariant === LanguageVariant.JSX && options.jsx === JsxEmit.Preserve ? ".jsx" : ".js");
// JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also.
// So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve.
// For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve
let extension = ".js";
if (options.jsx === JsxEmit.Preserve) {
if (isSourceFileJavaScript(sourceFile)) {
if (fileExtensionIs(sourceFile.fileName, ".jsx")) {
extension = ".jsx";
}
}
else if (sourceFile.languageVariant === LanguageVariant.JSX) {
// TypeScript source file preserving JSX syntax
extension = ".jsx";
}
}
const jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension);
const emitFileNames: EmitFileNames = {
jsFilePath,
sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),
+16 -13
View File
@@ -62,7 +62,7 @@ namespace ts {
export interface SourceFile {
/* @internal */ version: string;
/* @internal */ scriptSnapshot: IScriptSnapshot;
/* @internal */ nameTable: Map<string>;
/* @internal */ nameTable: Map<number>;
/* @internal */ getNamedDeclarations(): Map<Declaration[]>;
@@ -808,7 +808,7 @@ namespace ts {
public languageVersion: ScriptTarget;
public languageVariant: LanguageVariant;
public identifiers: Map<string>;
public nameTable: Map<string>;
public nameTable: Map<number>;
public resolvedModules: Map<ResolvedModule>;
public imports: LiteralExpression[];
public moduleAugmentations: LiteralExpression[];
@@ -1957,8 +1957,6 @@ namespace ts {
const text = scriptSnapshot.getText(0, scriptSnapshot.getLength());
const sourceFile = createSourceFile(fileName, text, scriptTarget, setNodeParents);
setSourceFileFields(sourceFile, scriptSnapshot, version);
// after full parsing we can use table with interned strings as name table
sourceFile.nameTable = sourceFile.identifiers;
return sourceFile;
}
@@ -3821,7 +3819,7 @@ namespace ts {
return undefined;
}
const { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot, isJsDocTagName } = completionData;
const { symbols, isMemberCompletion, isNewIdentifierLocation, location, isJsDocTagName } = completionData;
if (isJsDocTagName) {
// If the current position is a jsDoc tag name, only tag names should be provided for completion
@@ -3832,9 +3830,9 @@ namespace ts {
const entries: CompletionEntry[] = [];
if (isRightOfDot && isSourceFileJavaScript(sourceFile)) {
if (isSourceFileJavaScript(sourceFile)) {
const uniqueNames = getCompletionEntriesFromSymbols(symbols, entries);
addRange(entries, getJavaScriptCompletionEntries(sourceFile, uniqueNames));
addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames));
}
else {
if (!symbols || symbols.length === 0) {
@@ -3867,12 +3865,17 @@ namespace ts {
return { isMemberCompletion, isNewIdentifierLocation, entries };
function getJavaScriptCompletionEntries(sourceFile: SourceFile, uniqueNames: Map<string>): CompletionEntry[] {
function getJavaScriptCompletionEntries(sourceFile: SourceFile, position: number, uniqueNames: Map<string>): CompletionEntry[] {
const entries: CompletionEntry[] = [];
const target = program.getCompilerOptions().target;
const nameTable = getNameTable(sourceFile);
for (const name in nameTable) {
// Skip identifiers produced only from the current location
if (nameTable[name] === position) {
continue;
}
if (!uniqueNames[name]) {
uniqueNames[name] = name;
const displayName = getCompletionEntryDisplayName(name, target, /*performCharacterChecks*/ true);
@@ -5487,7 +5490,7 @@ namespace ts {
const nameTable = getNameTable(sourceFile);
if (lookUp(nameTable, internedName)) {
if (lookUp(nameTable, internedName) !== undefined) {
result = result || [];
getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex);
}
@@ -7525,7 +7528,7 @@ namespace ts {
}
/* @internal */
export function getNameTable(sourceFile: SourceFile): Map<string> {
export function getNameTable(sourceFile: SourceFile): Map<number> {
if (!sourceFile.nameTable) {
initializeNameTable(sourceFile);
}
@@ -7534,7 +7537,7 @@ namespace ts {
}
function initializeNameTable(sourceFile: SourceFile): void {
const nameTable: Map<string> = {};
const nameTable: Map<number> = {};
walk(sourceFile);
sourceFile.nameTable = nameTable;
@@ -7542,7 +7545,7 @@ namespace ts {
function walk(node: Node) {
switch (node.kind) {
case SyntaxKind.Identifier:
nameTable[(<Identifier>node).text] = (<Identifier>node).text;
nameTable[(<Identifier>node).text] = nameTable[(<Identifier>node).text] === undefined ? node.pos : -1;
break;
case SyntaxKind.StringLiteral:
case SyntaxKind.NumericLiteral:
@@ -7554,7 +7557,7 @@ namespace ts {
node.parent.kind === SyntaxKind.ExternalModuleReference ||
isArgumentOfElementAccessExpression(node)) {
nameTable[(<LiteralExpression>node).text] = (<LiteralExpression>node).text;
nameTable[(<LiteralExpression>node).text] = nameTable[(<LiteralExpression>node).text] === undefined ? node.pos : -1;
}
break;
default:
@@ -0,0 +1,22 @@
//// [blockScopedBindingsReassignedInLoop1.ts]
declare function use(n: number): void;
(function () {
'use strict'
for (let i = 0; i < 9; ++i) {
(() => use(++i))();
}
})();
//// [blockScopedBindingsReassignedInLoop1.js]
(function () {
'use strict';
var _loop_1 = function(i) {
(function () { return use(++i); })();
out_i_1 = i;
};
var out_i_1;
for (var i = 0; i < 9; ++i) {
_loop_1(i);
i = out_i_1;
}
})();
@@ -0,0 +1,17 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop1.ts ===
declare function use(n: number): void;
>use : Symbol(use, Decl(blockScopedBindingsReassignedInLoop1.ts, 0, 0))
>n : Symbol(n, Decl(blockScopedBindingsReassignedInLoop1.ts, 0, 21))
(function () {
'use strict'
for (let i = 0; i < 9; ++i) {
>i : Symbol(i, Decl(blockScopedBindingsReassignedInLoop1.ts, 3, 10))
>i : Symbol(i, Decl(blockScopedBindingsReassignedInLoop1.ts, 3, 10))
>i : Symbol(i, Decl(blockScopedBindingsReassignedInLoop1.ts, 3, 10))
(() => use(++i))();
>use : Symbol(use, Decl(blockScopedBindingsReassignedInLoop1.ts, 0, 0))
>i : Symbol(i, Decl(blockScopedBindingsReassignedInLoop1.ts, 3, 10))
}
})();
@@ -0,0 +1,32 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop1.ts ===
declare function use(n: number): void;
>use : (n: number) => void
>n : number
(function () {
>(function () { 'use strict' for (let i = 0; i < 9; ++i) { (() => use(++i))(); }})() : void
>(function () { 'use strict' for (let i = 0; i < 9; ++i) { (() => use(++i))(); }}) : () => void
>function () { 'use strict' for (let i = 0; i < 9; ++i) { (() => use(++i))(); }} : () => void
'use strict'
>'use strict' : string
for (let i = 0; i < 9; ++i) {
>i : number
>0 : number
>i < 9 : boolean
>i : number
>9 : number
>++i : number
>i : number
(() => use(++i))();
>(() => use(++i))() : void
>(() => use(++i)) : () => void
>() => use(++i) : () => void
>use(++i) : void
>use : (n: number) => void
>++i : number
>i : number
}
})();
@@ -0,0 +1,120 @@
//// [blockScopedBindingsReassignedInLoop2.ts]
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
break;
}
else {
y = 5;
}
}
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
continue;
}
else {
y = 5;
}
}
loop:
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
break loop;
}
else {
y = 5;
}
}
loop:
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
continue loop;
}
else {
y = 5;
}
}
//// [blockScopedBindingsReassignedInLoop2.js]
var _loop_1 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_1 = x, out_y_1 = y, "break";
}
else {
y = 5;
}
out_x_1 = x;
out_y_1 = y;
};
var out_x_1, out_y_1;
for (var x = 1, y = 2; x < y; ++x, --y) {
var state_1 = _loop_1(x, y);
x = out_x_1;
y = out_y_1;
if (state_1 === "break") break;
}
var _loop_2 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_2 = x, out_y_2 = y, "continue";
}
else {
y = 5;
}
out_x_2 = x;
out_y_2 = y;
};
var out_x_2, out_y_2;
for (var x = 1, y = 2; x < y; ++x, --y) {
var state_2 = _loop_2(x, y);
x = out_x_2;
y = out_y_2;
if (state_2 === "continue") continue;
}
var _loop_3 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_3 = x, out_y_3 = y, "break-loop";
}
else {
y = 5;
}
out_x_3 = x;
out_y_3 = y;
};
var out_x_3, out_y_3;
loop: for (var x = 1, y = 2; x < y; ++x, --y) {
var state_3 = _loop_3(x, y);
x = out_x_3;
y = out_y_3;
switch(state_3) {
case "break-loop": break loop;
}
}
var _loop_4 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_4 = x, out_y_4 = y, "continue-loop";
}
else {
y = 5;
}
out_x_4 = x;
out_y_4 = y;
};
var out_x_4, out_y_4;
loop: for (var x = 1, y = 2; x < y; ++x, --y) {
var state_4 = _loop_4(x, y);
x = out_x_4;
y = out_y_4;
switch(state_4) {
case "continue-loop": continue loop;
}
}
@@ -0,0 +1,98 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop2.ts ===
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop2.ts, 1, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8))
break;
}
else {
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15))
}
}
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop2.ts, 11, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8))
continue;
}
else {
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15))
}
}
loop:
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop2.ts, 22, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8))
break loop;
}
else {
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15))
}
}
loop:
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop2.ts, 33, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8))
continue loop;
}
else {
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15))
}
}
@@ -0,0 +1,160 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop2.ts ===
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
break;
}
else {
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
continue;
}
else {
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
loop:
>loop : any
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
break loop;
>loop : any
}
else {
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
loop:
>loop : any
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
continue loop;
>loop : any
}
else {
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
@@ -0,0 +1,247 @@
//// [blockScopedBindingsReassignedInLoop3.ts]
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
break;
}
else {
for (let a = 1; a < 5; --a) {
let f = () => a;
if (a) {
a = x;
break;
}
else {
y++;
}
}
y = 5;
}
}
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
continue;
}
else {
for (let a = 1; a < 5; --a) {
let f = () => a;
if (a) {
a = x;
continue;
}
else {
y++;
}
}
y = 5;
}
}
loop2:
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
break loop2;
}
else {
loop1:
for (let a = 1; a < 5; --a) {
let f = () => a;
if (a) {
a = x;
break loop1;
}
else {
y++;
break loop2
}
}
y = 5;
}
}
loop2:
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
continue loop2;
}
else {
loop1:
for (let a = 1; a < 5; --a) {
let f = () => a;
if (a) {
a = x;
continue loop1;
}
else {
y++;
continue loop2
}
}
y = 5;
}
}
//// [blockScopedBindingsReassignedInLoop3.js]
var _loop_1 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_1 = x, out_y_1 = y, "break";
}
else {
var _loop_2 = function(a_1) {
var f = function () { return a_1; };
if (a_1) {
a_1 = x;
return out_a_1_1 = a_1, "break";
}
else {
y++;
}
out_a_1_1 = a_1;
};
var out_a_1_1;
for (var a_1 = 1; a_1 < 5; --a_1) {
var state_1 = _loop_2(a_1);
a_1 = out_a_1_1;
if (state_1 === "break") break;
}
y = 5;
}
out_x_1 = x;
out_y_1 = y;
};
var out_x_1, out_y_1;
for (var x = 1, y = 2; x < y; ++x, --y) {
var state_2 = _loop_1(x, y);
x = out_x_1;
y = out_y_1;
if (state_2 === "break") break;
}
var _loop_3 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_2 = x, out_y_2 = y, "continue";
}
else {
var _loop_4 = function(a_2) {
var f = function () { return a_2; };
if (a_2) {
a_2 = x;
return out_a_2_1 = a_2, "continue";
}
else {
y++;
}
out_a_2_1 = a_2;
};
var out_a_2_1;
for (var a_2 = 1; a_2 < 5; --a_2) {
var state_3 = _loop_4(a_2);
a_2 = out_a_2_1;
if (state_3 === "continue") continue;
}
y = 5;
}
out_x_2 = x;
out_y_2 = y;
};
var out_x_2, out_y_2;
for (var x = 1, y = 2; x < y; ++x, --y) {
var state_4 = _loop_3(x, y);
x = out_x_2;
y = out_y_2;
if (state_4 === "continue") continue;
}
var _loop_5 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_3 = x, out_y_3 = y, "break-loop2";
}
else {
var _loop_6 = function(a_3) {
var f = function () { return a_3; };
if (a_3) {
a_3 = x;
return out_a_3_1 = a_3, "break-loop1";
}
else {
y++;
return out_a_3_1 = a_3, "break-loop2";
}
out_a_3_1 = a_3;
};
var out_a_3_1;
loop1: for (var a_3 = 1; a_3 < 5; --a_3) {
var state_5 = _loop_6(a_3);
a_3 = out_a_3_1;
switch(state_5) {
case "break-loop1": break loop1;
case "break-loop2": return state_5;
}
}
y = 5;
}
out_x_3 = x;
out_y_3 = y;
};
var out_x_3, out_y_3;
loop2: for (var x = 1, y = 2; x < y; ++x, --y) {
var state_6 = _loop_5(x, y);
x = out_x_3;
y = out_y_3;
switch(state_6) {
case "break-loop2": break loop2;
}
}
var _loop_7 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_4 = x, out_y_4 = y, "continue-loop2";
}
else {
var _loop_8 = function(a_4) {
var f = function () { return a_4; };
if (a_4) {
a_4 = x;
return out_a_4_1 = a_4, "continue-loop1";
}
else {
y++;
return out_a_4_1 = a_4, "continue-loop2";
}
out_a_4_1 = a_4;
};
var out_a_4_1;
loop1: for (var a_4 = 1; a_4 < 5; --a_4) {
var state_7 = _loop_8(a_4);
a_4 = out_a_4_1;
switch(state_7) {
case "continue-loop1": continue loop1;
case "continue-loop2": return state_7;
}
}
y = 5;
}
out_x_4 = x;
out_y_4 = y;
};
var out_x_4, out_y_4;
loop2: for (var x = 1, y = 2; x < y; ++x, --y) {
var state_8 = _loop_7(x, y);
x = out_x_4;
y = out_y_4;
switch(state_8) {
case "continue-loop2": continue loop2;
}
}
@@ -0,0 +1,203 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop3.ts ===
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 2, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8))
break;
}
else {
for (let a = 1; a < 5; --a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16))
let f = () => a;
>f : Symbol(f, Decl(blockScopedBindingsReassignedInLoop3.ts, 8, 15))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16))
if (a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16))
a = x;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8))
break;
}
else {
y++;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15))
}
}
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15))
}
}
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 24, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8))
continue;
}
else {
for (let a = 1; a < 5; --a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16))
let f = () => a;
>f : Symbol(f, Decl(blockScopedBindingsReassignedInLoop3.ts, 30, 15))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16))
if (a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16))
a = x;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8))
continue;
}
else {
y++;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15))
}
}
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15))
}
}
loop2:
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 46, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8))
break loop2;
}
else {
loop1:
for (let a = 1; a < 5; --a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16))
let f = () => a;
>f : Symbol(f, Decl(blockScopedBindingsReassignedInLoop3.ts, 53, 15))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16))
if (a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16))
a = x;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8))
break loop1;
}
else {
y++;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15))
break loop2
}
}
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15))
}
}
loop2:
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 70, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8))
continue loop2;
}
else {
loop1:
for (let a = 1; a < 5; --a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16))
let f = () => a;
>f : Symbol(f, Decl(blockScopedBindingsReassignedInLoop3.ts, 77, 15))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16))
if (a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16))
a = x;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8))
continue loop1;
}
else {
y++;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15))
continue loop2
}
}
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15))
}
}
@@ -0,0 +1,301 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop3.ts ===
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
break;
}
else {
for (let a = 1; a < 5; --a) {
>a : number
>1 : number
>a < 5 : boolean
>a : number
>5 : number
>--a : number
>a : number
let f = () => a;
>f : () => number
>() => a : () => number
>a : number
if (a) {
>a : number
a = x;
>a = x : number
>a : number
>x : number
break;
}
else {
y++;
>y++ : number
>y : number
}
}
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
continue;
}
else {
for (let a = 1; a < 5; --a) {
>a : number
>1 : number
>a < 5 : boolean
>a : number
>5 : number
>--a : number
>a : number
let f = () => a;
>f : () => number
>() => a : () => number
>a : number
if (a) {
>a : number
a = x;
>a = x : number
>a : number
>x : number
continue;
}
else {
y++;
>y++ : number
>y : number
}
}
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
loop2:
>loop2 : any
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
break loop2;
>loop2 : any
}
else {
loop1:
>loop1 : any
for (let a = 1; a < 5; --a) {
>a : number
>1 : number
>a < 5 : boolean
>a : number
>5 : number
>--a : number
>a : number
let f = () => a;
>f : () => number
>() => a : () => number
>a : number
if (a) {
>a : number
a = x;
>a = x : number
>a : number
>x : number
break loop1;
>loop1 : any
}
else {
y++;
>y++ : number
>y : number
break loop2
>loop2 : any
}
}
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
loop2:
>loop2 : any
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
continue loop2;
>loop2 : any
}
else {
loop1:
>loop1 : any
for (let a = 1; a < 5; --a) {
>a : number
>1 : number
>a < 5 : boolean
>a : number
>5 : number
>--a : number
>a : number
let f = () => a;
>f : () => number
>() => a : () => number
>a : number
if (a) {
>a : number
a = x;
>a = x : number
>a : number
>x : number
continue loop1;
>loop1 : any
}
else {
y++;
>y++ : number
>y : number
continue loop2
>loop2 : any
}
}
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
@@ -0,0 +1,34 @@
//// [blockScopedBindingsReassignedInLoop4.ts]
function f1() {
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
return 1;
}
else {
y = 5;
}
}
}
//// [blockScopedBindingsReassignedInLoop4.js]
function f1() {
var _loop_1 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return { value: 1 };
}
else {
y = 5;
}
out_x_1 = x;
out_y_1 = y;
};
var out_x_1, out_y_1;
for (var x = 1, y = 2; x < y; ++x, --y) {
var state_1 = _loop_1(x, y);
x = out_x_1;
y = out_y_1;
if (typeof state_1 === "object") return state_1.value;
}
}
@@ -0,0 +1,28 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop4.ts ===
function f1() {
>f1 : Symbol(f1, Decl(blockScopedBindingsReassignedInLoop4.ts, 0, 0))
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop4.ts, 2, 11))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12))
return 1;
}
else {
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19))
}
}
}
@@ -0,0 +1,43 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop4.ts ===
function f1() {
>f1 : () => number
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
return 1;
>1 : number
}
else {
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
}
@@ -0,0 +1,27 @@
//// [blockScopedBindingsReassignedInLoop5.ts]
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1)
break;
else
y = 5;
}
//// [blockScopedBindingsReassignedInLoop5.js]
var _loop_1 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1)
return out_x_1 = x, out_y_1 = y, "break";
else
y = 5;
out_x_1 = x;
out_y_1 = y;
};
var out_x_1, out_y_1;
for (var x = 1, y = 2; x < y; ++x, --y) {
var state_1 = _loop_1(x, y);
x = out_x_1;
y = out_y_1;
if (state_1 === "break") break;
}
@@ -0,0 +1,23 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop5.ts ===
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop5.ts, 1, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15))
if (x == 1)
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8))
break;
else
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15))
}
@@ -0,0 +1,37 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop5.ts ===
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1)
>x == 1 : boolean
>x : number
>1 : number
break;
else
y = 5;
>y = 5 : number
>y : number
>5 : number
}
@@ -0,0 +1,74 @@
//// [blockScopedBindingsReassignedInLoop6.ts]
function f1() {
for (let [x, y] = [1, 2]; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1)
break;
else if (y == 2)
y = 5;
else
return;
}
}
function f2() {
for (let [{a: x, b: {c: y}}] = [{a: 1, b: {c: 2}}]; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1)
break;
else if (y == 2)
y = 5;
else
return;
}
}
//// [blockScopedBindingsReassignedInLoop6.js]
function f1() {
var _loop_1 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1)
return out_x_1 = x, out_y_1 = y, "break";
else if (y == 2)
y = 5;
else
return { value: void 0 };
out_x_1 = x;
out_y_1 = y;
};
var out_x_1, out_y_1;
for (var _a = [1, 2], x = _a[0], y = _a[1]; x < y; ++x, --y) {
var state_1 = _loop_1(x, y);
x = out_x_1;
y = out_y_1;
if (typeof state_1 === "object") return state_1.value;
if (state_1 === "break") break;
}
}
function f2() {
var _loop_2 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1)
return out_x_2 = x, out_y_2 = y, "break";
else if (y == 2)
y = 5;
else
return { value: void 0 };
out_x_2 = x;
out_y_2 = y;
};
var out_x_2, out_y_2;
for (var _a = [{ a: 1, b: { c: 2 } }][0], x = _a.a, y = _a.b.c; x < y; ++x, --y) {
var state_2 = _loop_2(x, y);
x = out_x_2;
y = out_y_2;
if (typeof state_2 === "object") return state_2.value;
if (state_2 === "break") break;
}
}
@@ -0,0 +1,74 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop6.ts ===
function f1() {
>f1 : Symbol(f1, Decl(blockScopedBindingsReassignedInLoop6.ts, 0, 0))
for (let [x, y] = [1, 2]; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop6.ts, 2, 11))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16))
if (x == 1)
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14))
break;
else if (y == 2)
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16))
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16))
else
return;
}
}
function f2() {
>f2 : Symbol(f2, Decl(blockScopedBindingsReassignedInLoop6.ts, 10, 1))
for (let [{a: x, b: {c: y}}] = [{a: 1, b: {c: 2}}]; x < y; ++x, --y) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 37))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15))
>b : Symbol(b, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 42))
>c : Symbol(c, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 47))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 37))
>b : Symbol(b, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 42))
>c : Symbol(c, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 47))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop6.ts, 14, 11))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25))
if (x == 1)
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15))
break;
else if (y == 2)
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25))
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25))
else
return;
}
}
@@ -0,0 +1,110 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop6.ts ===
function f1() {
>f1 : () => void
for (let [x, y] = [1, 2]; x < y; ++x, --y) {
>x : number
>y : number
>[1, 2] : [number, number]
>1 : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1)
>x == 1 : boolean
>x : number
>1 : number
break;
else if (y == 2)
>y == 2 : boolean
>y : number
>2 : number
y = 5;
>y = 5 : number
>y : number
>5 : number
else
return;
}
}
function f2() {
>f2 : () => void
for (let [{a: x, b: {c: y}}] = [{a: 1, b: {c: 2}}]; x < y; ++x, --y) {
>a : any
>x : number
>b : any
>c : any
>y : number
>[{a: 1, b: {c: 2}}] : [{ a: number; b: { c: number; }; }]
>{a: 1, b: {c: 2}} : { a: number; b: { c: number; }; }
>a : number
>1 : number
>b : { c: number; }
>{c: 2} : { c: number; }
>c : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1)
>x == 1 : boolean
>x : number
>1 : number
break;
else if (y == 2)
>y == 2 : boolean
>y : number
>2 : number
y = 5;
>y = 5 : number
>y : number
>5 : number
else
return;
}
}
@@ -30,6 +30,6 @@ function foo() {
};
for (;;) {
var state_2 = _loop_2();
if (typeof state_2 === "object") return state_2.value
if (typeof state_2 === "object") return state_2.value;
}
}
@@ -294,7 +294,7 @@ function foo0(x) {
for (var _i = 0, _a = []; _i < _a.length; _i++) {
var x_1 = _a[_i];
var state_1 = _loop_1(x_1);
if (typeof state_1 === "object") return state_1.value
if (typeof state_1 === "object") return state_1.value;
}
use(v);
}
@@ -310,7 +310,7 @@ function foo00(x) {
var v;
for (var x_2 in []) {
var state_2 = _loop_2(x_2);
if (typeof state_2 === "object") return state_2.value
if (typeof state_2 === "object") return state_2.value;
}
use(v);
}
@@ -326,7 +326,7 @@ function foo1(x) {
var v;
for (var x_3 = 0; x_3 < 1; ++x_3) {
var state_3 = _loop_3(x_3);
if (typeof state_3 === "object") return state_3.value
if (typeof state_3 === "object") return state_3.value;
}
use(v);
}
@@ -343,7 +343,7 @@ function foo2(x) {
var v;
while (1 === 1) {
var state_4 = _loop_4();
if (typeof state_4 === "object") return state_4.value
if (typeof state_4 === "object") return state_4.value;
}
use(v);
}
@@ -359,7 +359,7 @@ function foo3(x) {
var v;
do {
var state_5 = _loop_5();
if (typeof state_5 === "object") return state_5.value
if (typeof state_5 === "object") return state_5.value;
} while (1 === 1);
use(v);
}
@@ -376,7 +376,7 @@ function foo4(x) {
var v;
for (var y = 0; y < 1; ++y) {
var state_6 = _loop_6(y);
if (typeof state_6 === "object") return state_6.value
if (typeof state_6 === "object") return state_6.value;
}
use(v);
}
@@ -392,7 +392,7 @@ function foo5(x) {
var v;
for (var x_7 = 0, y = 1; x_7 < 1; ++x_7) {
var state_7 = _loop_7(x_7, y);
if (typeof state_7 === "object") return state_7.value
if (typeof state_7 === "object") return state_7.value;
}
use(v);
}
@@ -409,7 +409,7 @@ function foo6(x) {
var v;
while (1 === 1) {
var state_8 = _loop_8();
if (typeof state_8 === "object") return state_8.value
if (typeof state_8 === "object") return state_8.value;
}
;
use(v);
@@ -427,7 +427,7 @@ function foo7(x) {
var v;
do {
var state_9 = _loop_9();
if (typeof state_9 === "object") return state_9.value
if (typeof state_9 === "object") return state_9.value;
} while (1 === 1);
use(v);
}
@@ -444,7 +444,7 @@ function foo8(x) {
var v;
for (var y = 0; y < 1; ++y) {
var state_10 = _loop_10(y);
if (typeof state_10 === "object") return state_10.value
if (typeof state_10 === "object") return state_10.value;
}
use(v);
}
@@ -462,7 +462,7 @@ function foo0_c(x) {
for (var _i = 0, _a = []; _i < _a.length; _i++) {
var x_11 = _a[_i];
var state_11 = _loop_11(x_11);
if (typeof state_11 === "object") return state_11.value
if (typeof state_11 === "object") return state_11.value;
}
use(v);
}
@@ -478,7 +478,7 @@ function foo00_c(x) {
var v;
for (var x_12 in []) {
var state_12 = _loop_12(x_12);
if (typeof state_12 === "object") return state_12.value
if (typeof state_12 === "object") return state_12.value;
}
use(v);
}
@@ -494,7 +494,7 @@ function foo1_c(x) {
var v;
for (var x_13 = 0; x_13 < 1;) {
var state_13 = _loop_13(x_13);
if (typeof state_13 === "object") return state_13.value
if (typeof state_13 === "object") return state_13.value;
}
use(v);
}
@@ -511,7 +511,7 @@ function foo2_c(x) {
var v;
while (1 === 1) {
var state_14 = _loop_14();
if (typeof state_14 === "object") return state_14.value
if (typeof state_14 === "object") return state_14.value;
}
use(v);
}
@@ -527,7 +527,7 @@ function foo3_c(x) {
var v;
do {
var state_15 = _loop_15();
if (typeof state_15 === "object") return state_15.value
if (typeof state_15 === "object") return state_15.value;
} while (1 === 1);
use(v);
}
@@ -544,7 +544,7 @@ function foo4_c(x) {
var v;
for (var y = 0; y < 1;) {
var state_16 = _loop_16(y);
if (typeof state_16 === "object") return state_16.value
if (typeof state_16 === "object") return state_16.value;
}
use(v);
}
@@ -560,7 +560,7 @@ function foo5_c(x) {
var v;
for (var x_17 = 0, y = 1; x_17 < 1;) {
var state_17 = _loop_17(x_17, y);
if (typeof state_17 === "object") return state_17.value
if (typeof state_17 === "object") return state_17.value;
}
use(v);
}
@@ -577,7 +577,7 @@ function foo6_c(x) {
var v;
while (1 === 1) {
var state_18 = _loop_18();
if (typeof state_18 === "object") return state_18.value
if (typeof state_18 === "object") return state_18.value;
}
use(v);
}
@@ -594,7 +594,7 @@ function foo7_c(x) {
var v;
do {
var state_19 = _loop_19();
if (typeof state_19 === "object") return state_19.value
if (typeof state_19 === "object") return state_19.value;
} while (1 === 1);
use(v);
}
@@ -611,7 +611,7 @@ function foo8_c(x) {
var v;
for (var y = 0; y < 1;) {
var state_20 = _loop_20(y);
if (typeof state_20 === "object") return state_20.value
if (typeof state_20 === "object") return state_20.value;
}
use(v);
}
@@ -198,7 +198,7 @@ function foo() {
};
l1: for (var x = 0; x < 1; ++x) {
var state_2 = _loop_1(x);
if (typeof state_2 === "object") return state_2.value
if (typeof state_2 === "object") return state_2.value;
if (state_2 === "break") break;
if (state_2 === "continue") continue;
switch(state_2) {
@@ -280,7 +280,7 @@ function foo_c() {
};
l1: for (var x = 0; x < 1;) {
var state_4 = _loop_3(x);
if (typeof state_4 === "object") return state_4.value
if (typeof state_4 === "object") return state_4.value;
if (state_4 === "break") break;
if (state_4 === "continue") continue;
switch(state_4) {
@@ -225,7 +225,7 @@ function foo() {
l0: for (var _f = 0, _g = []; _f < _g.length; _f++) {
var a = _g[_f];
var state_4 = _loop_3(a);
if (typeof state_4 === "object") return state_4.value
if (typeof state_4 === "object") return state_4.value;
if (state_4 === "break") break;
switch(state_4) {
case "break-l0": break l0;
@@ -0,0 +1,37 @@
//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts]
class A {
blub = 6;
}
class B extends A {
constructor(public x: number) {
"use strict";
'someStringForEgngInject';
super()
}
}
//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var A = (function () {
function A() {
this.blub = 6;
}
return A;
}());
var B = (function (_super) {
__extends(B, _super);
function B(x) {
"use strict";
'someStringForEgngInject';
_super.call(this);
this.x = x;
}
return B;
}(A));
@@ -0,0 +1,23 @@
=== tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts ===
class A {
>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 0))
blub = 6;
>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 9))
}
class B extends A {
>B : Symbol(B, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 2, 1))
>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 0))
constructor(public x: number) {
>x : Symbol(x, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 6, 16))
"use strict";
'someStringForEgngInject';
super()
>super : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 0))
}
}
@@ -0,0 +1,29 @@
=== tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts ===
class A {
>A : A
blub = 6;
>blub : number
>6 : number
}
class B extends A {
>B : B
>A : A
constructor(public x: number) {
>x : number
"use strict";
>"use strict" : string
'someStringForEgngInject';
>'someStringForEgngInject' : string
super()
>super() : void
>super : typeof A
}
}
@@ -0,0 +1,29 @@
//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts]
class A {
blub = 6;
}
class B extends A {
constructor(public x: number) {
"use strict";
'someStringForEgngInject';
super()
}
}
//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.js]
class A {
constructor() {
this.blub = 6;
}
}
class B extends A {
constructor(x) {
"use strict";
'someStringForEgngInject';
super();
this.x = x;
}
}
@@ -0,0 +1,23 @@
=== tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts ===
class A {
>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 0, 0))
blub = 6;
>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 0, 9))
}
class B extends A {
>B : Symbol(B, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 2, 1))
>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 0, 0))
constructor(public x: number) {
>x : Symbol(x, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 6, 16))
"use strict";
'someStringForEgngInject';
super()
>super : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 0, 0))
}
}
@@ -0,0 +1,29 @@
=== tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts ===
class A {
>A : A
blub = 6;
>blub : number
>6 : number
}
class B extends A {
>B : B
>A : A
constructor(public x: number) {
>x : number
"use strict";
>"use strict" : string
'someStringForEgngInject';
>'someStringForEgngInject' : string
super()
>super() : void
>super : typeof A
}
}
@@ -0,0 +1,39 @@
//// [emitSuperCallBeforeEmitPropertyDeclaration1.ts]
class A {
blub = 6;
}
class B extends A {
blub = 12;
constructor() {
"use strict";
'someStringForEgngInject';
super()
}
}
//// [emitSuperCallBeforeEmitPropertyDeclaration1.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var A = (function () {
function A() {
this.blub = 6;
}
return A;
}());
var B = (function (_super) {
__extends(B, _super);
function B() {
"use strict";
'someStringForEgngInject';
_super.call(this);
this.blub = 12;
}
return B;
}(A));
@@ -0,0 +1,23 @@
=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1.ts ===
class A {
>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 0, 0))
blub = 6;
>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 0, 9))
}
class B extends A {
>B : Symbol(B, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 2, 1))
>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 0, 0))
blub = 12;
>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 5, 19))
constructor() {
"use strict";
'someStringForEgngInject';
super()
>super : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 0, 0))
}
}
@@ -0,0 +1,30 @@
=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1.ts ===
class A {
>A : A
blub = 6;
>blub : number
>6 : number
}
class B extends A {
>B : B
>A : A
blub = 12;
>blub : number
>12 : number
constructor() {
"use strict";
>"use strict" : string
'someStringForEgngInject';
>'someStringForEgngInject' : string
super()
>super() : void
>super : typeof A
}
}
@@ -0,0 +1,29 @@
//// [emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts]
class A {
blub = 6;
}
class B extends A {
blub = 12;
constructor() {
'someStringForEgngInject';
super()
}
}
//// [emitSuperCallBeforeEmitPropertyDeclaration1ES6.js]
class A {
constructor() {
this.blub = 6;
}
}
class B extends A {
constructor() {
'someStringForEgngInject';
super();
this.blub = 12;
}
}
@@ -0,0 +1,22 @@
=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts ===
class A {
>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 0, 0))
blub = 6;
>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 0, 9))
}
class B extends A {
>B : Symbol(B, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 2, 1))
>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 0, 0))
blub = 12;
>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 5, 19))
constructor() {
'someStringForEgngInject';
super()
>super : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 0, 0))
}
}
@@ -0,0 +1,27 @@
=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts ===
class A {
>A : A
blub = 6;
>blub : number
>6 : number
}
class B extends A {
>B : B
>A : A
blub = 12;
>blub : number
>12 : number
constructor() {
'someStringForEgngInject';
>'someStringForEgngInject' : string
super()
>super() : void
>super : typeof A
}
}
@@ -0,0 +1,38 @@
//// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts]
class A {
blub = 6;
}
class B extends A {
blah = 2;
constructor(public x: number) {
"use strict";
'someStringForEgngInject';
super()
}
}
//// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var A = (function () {
function A() {
this.blub = 6;
}
return A;
}());
var B = (function (_super) {
__extends(B, _super);
function B(x) {
"use strict";
'someStringForEgngInject';
_super.call(this);
this.x = x;
this.blah = 2;
}
return B;
}(A));
@@ -0,0 +1,25 @@
=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts ===
class A {
>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 0, 0))
blub = 6;
>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 0, 9))
}
class B extends A {
>B : Symbol(B, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 2, 1))
>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 0, 0))
blah = 2;
>blah : Symbol(blah, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 5, 19))
constructor(public x: number) {
>x : Symbol(x, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 7, 16))
"use strict";
'someStringForEgngInject';
super()
>super : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 0, 0))
}
}
@@ -0,0 +1,32 @@
=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts ===
class A {
>A : A
blub = 6;
>blub : number
>6 : number
}
class B extends A {
>B : B
>A : A
blah = 2;
>blah : number
>2 : number
constructor(public x: number) {
>x : number
"use strict";
>"use strict" : string
'someStringForEgngInject';
>'someStringForEgngInject' : string
super()
>super() : void
>super : typeof A
}
}
@@ -0,0 +1,30 @@
//// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts]
class A {
blub = 6;
}
class B extends A {
blah = 2;
constructor(public x: number) {
"use strict";
'someStringForEgngInject';
super()
}
}
//// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.js]
class A {
constructor() {
this.blub = 6;
}
}
class B extends A {
constructor(x) {
"use strict";
'someStringForEgngInject';
super();
this.x = x;
this.blah = 2;
}
}
@@ -0,0 +1,25 @@
=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts ===
class A {
>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 0, 0))
blub = 6;
>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 0, 9))
}
class B extends A {
>B : Symbol(B, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 2, 1))
>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 0, 0))
blah = 2;
>blah : Symbol(blah, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 5, 19))
constructor(public x: number) {
>x : Symbol(x, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 7, 16))
"use strict";
'someStringForEgngInject';
super()
>super : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 0, 0))
}
}
@@ -0,0 +1,32 @@
=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts ===
class A {
>A : A
blub = 6;
>blub : number
>6 : number
}
class B extends A {
>B : B
>A : A
blah = 2;
>blah : number
>2 : number
constructor(public x: number) {
>x : number
"use strict";
>"use strict" : string
'someStringForEgngInject';
>'someStringForEgngInject' : string
super()
>super() : void
>super : typeof A
}
}
@@ -17,3 +17,4 @@ import "es6ImportWithoutFromClause_0";
//// [es6ImportWithoutFromClause_0.d.ts]
export declare var a: number;
//// [es6ImportWithoutFromClause_1.d.ts]
import "es6ImportWithoutFromClause_0";
@@ -36,3 +36,5 @@ export declare var a: number;
//// [es6ImportWithoutFromClauseAmd_1.d.ts]
export declare var b: number;
//// [es6ImportWithoutFromClauseAmd_2.d.ts]
import "es6ImportWithoutFromClauseAmd_0";
import "es6ImportWithoutFromClauseAmd_2";
@@ -18,3 +18,4 @@ require("es6ImportWithoutFromClauseInEs5_0");
//// [es6ImportWithoutFromClauseInEs5_0.d.ts]
export declare var a: number;
//// [es6ImportWithoutFromClauseInEs5_1.d.ts]
import "es6ImportWithoutFromClauseInEs5_0";
@@ -17,3 +17,4 @@ import "es6ImportWithoutFromClauseNonInstantiatedModule_0";
export interface i {
}
//// [es6ImportWithoutFromClauseNonInstantiatedModule_1.d.ts]
import "es6ImportWithoutFromClauseNonInstantiatedModule_0";
@@ -0,0 +1,29 @@
//// [tests/cases/compiler/jsxPreserveWithJsInput.ts] ////
//// [a.js]
var elemA = 42;
//// [b.jsx]
var elemB = <b>{"test"}</b>;
//// [c.js]
var elemC = <c>{42}</c>;
//// [d.ts]
var elemD = 42;
//// [e.tsx]
var elemE = <e>{true}</e>;
//// [a.js]
var elemA = 42;
//// [b.jsx]
var elemB = <b>{"test"}</b>;
//// [c.js]
var elemC = <c>{42}</c>;
//// [d.js]
var elemD = 42;
//// [e.jsx]
var elemE = <e>{true}</e>;
@@ -0,0 +1,27 @@
=== tests/cases/compiler/a.js ===
var elemA = 42;
>elemA : Symbol(elemA, Decl(a.js, 1, 3))
=== tests/cases/compiler/b.jsx ===
var elemB = <b>{"test"}</b>;
>elemB : Symbol(elemB, Decl(b.jsx, 0, 3))
>b : Symbol(unknown)
>b : Symbol(unknown)
=== tests/cases/compiler/c.js ===
var elemC = <c>{42}</c>;
>elemC : Symbol(elemC, Decl(c.js, 0, 3))
>c : Symbol(unknown)
>c : Symbol(unknown)
=== tests/cases/compiler/d.ts ===
var elemD = 42;
>elemD : Symbol(elemD, Decl(d.ts, 0, 3))
=== tests/cases/compiler/e.tsx ===
var elemE = <e>{true}</e>;
>elemE : Symbol(elemE, Decl(e.tsx, 0, 3))
>e : Symbol(unknown)
>e : Symbol(unknown)
@@ -0,0 +1,35 @@
=== tests/cases/compiler/a.js ===
var elemA = 42;
>elemA : number
>42 : number
=== tests/cases/compiler/b.jsx ===
var elemB = <b>{"test"}</b>;
>elemB : any
><b>{"test"}</b> : any
>b : any
>"test" : string
>b : any
=== tests/cases/compiler/c.js ===
var elemC = <c>{42}</c>;
>elemC : any
><c>{42}</c> : any
>c : any
>42 : number
>c : any
=== tests/cases/compiler/d.ts ===
var elemD = 42;
>elemD : number
>42 : number
=== tests/cases/compiler/e.tsx ===
var elemE = <e>{true}</e>;
>elemE : any
><e>{true}</e> : any
>e : any
>true : boolean
>e : any
@@ -0,0 +1,16 @@
//// [tests/cases/compiler/keepImportsInDts1.ts] ////
//// [test.d.ts]
export {};
//// [main.ts]
import "test"
//// [main.js]
define(["require", "exports", "test"], function (require, exports) {
"use strict";
});
//// [main.d.ts]
import "test";
@@ -0,0 +1,6 @@
=== c:/test.d.ts ===
No type information for this code.export {};
No type information for this code.=== c:/app/main.ts ===
import "test"
No type information for this code.
@@ -0,0 +1,6 @@
=== c:/test.d.ts ===
No type information for this code.export {};
No type information for this code.=== c:/app/main.ts ===
import "test"
No type information for this code.
@@ -0,0 +1,22 @@
//// [tests/cases/compiler/keepImportsInDts2.ts] ////
//// [test.ts]
export {};
//// [main.ts]
import "./folder/test"
//// [test.js]
define(["require", "exports"], function (require, exports) {
"use strict";
});
//// [main.js]
define(["require", "exports", "./folder/test"], function (require, exports) {
"use strict";
});
//// [test.d.ts]
export { };
//// [main.d.ts]
import "./folder/test";
@@ -0,0 +1,6 @@
=== tests/cases/compiler/folder/test.ts ===
No type information for this code.export {};
No type information for this code.=== tests/cases/compiler/main.ts ===
import "./folder/test"
No type information for this code.
@@ -0,0 +1,6 @@
=== tests/cases/compiler/folder/test.ts ===
No type information for this code.export {};
No type information for this code.=== tests/cases/compiler/main.ts ===
import "./folder/test"
No type information for this code.
@@ -0,0 +1,24 @@
//// [tests/cases/compiler/keepImportsInDts3.ts] ////
//// [test.ts]
export {};
//// [main.ts]
import "test"
//// [outputfile.js]
define("test", ["require", "exports"], function (require, exports) {
"use strict";
});
define("app/main", ["require", "exports", "test"], function (require, exports) {
"use strict";
});
//// [outputfile.d.ts]
declare module "test" {
export { };
}
declare module "app/main" {
import "test";
}
@@ -0,0 +1,6 @@
=== c:/test.ts ===
No type information for this code.export {};
No type information for this code.=== c:/app/main.ts ===
import "test"
No type information for this code.
@@ -0,0 +1,6 @@
=== c:/test.ts ===
No type information for this code.export {};
No type information for this code.=== c:/app/main.ts ===
import "test"
No type information for this code.
@@ -0,0 +1,24 @@
//// [tests/cases/compiler/keepImportsInDts4.ts] ////
//// [test.ts]
export {};
//// [main.ts]
import "./folder/test"
//// [outputfile.js]
define("folder/test", ["require", "exports"], function (require, exports) {
"use strict";
});
define("main", ["require", "exports", "folder/test"], function (require, exports) {
"use strict";
});
//// [outputfile.d.ts]
declare module "folder/test" {
export { };
}
declare module "main" {
import "folder/test";
}
@@ -0,0 +1,6 @@
=== tests/cases/compiler/folder/test.ts ===
No type information for this code.export {};
No type information for this code.=== tests/cases/compiler/main.ts ===
import "./folder/test"
No type information for this code.
@@ -0,0 +1,6 @@
=== tests/cases/compiler/folder/test.ts ===
No type information for this code.export {};
No type information for this code.=== tests/cases/compiler/main.ts ===
import "./folder/test"
No type information for this code.
@@ -73,3 +73,5 @@ declare module "./observable" {
}
export {};
//// [main.d.ts]
import "./map1";
import "./map2";
@@ -66,3 +66,4 @@ declare module "./observable" {
}
export {};
//// [main.d.ts]
import "./map";
@@ -71,3 +71,4 @@ declare module "./observable" {
}
export {};
//// [main.d.ts]
import "./map";
@@ -63,3 +63,4 @@ declare module "observable" {
export {};
//// [main.d.ts]
/// <reference path="observable.d.ts" />
import "./map";
@@ -50,3 +50,4 @@ declare global {
}
export {};
//// [f3.d.ts]
import "./f2";
@@ -45,3 +45,5 @@ declare global {
export { };
export {};
//// [f3.d.ts]
import "./f1";
import "./f2";
@@ -32,3 +32,5 @@ require("B");
//// [f3.d.ts]
/// <reference path="f1.d.ts" />
/// <reference path="f2.d.ts" />
import "A";
import "B";
@@ -69,3 +69,4 @@ declare module "./f1" {
}
}
//// [f4.d.ts]
import "./f3";
@@ -74,3 +74,4 @@ export declare class B {
n: number;
}
//// [f4.d.ts]
import "./f3";
@@ -72,3 +72,4 @@ export declare class B {
n: number;
}
//// [f4.d.ts]
import "./f3";
@@ -76,3 +76,4 @@ export declare class B {
n: number;
}
//// [f4.d.ts]
import "./f3";
@@ -95,3 +95,4 @@ declare module "./f1" {
}
}
//// [f4.d.ts]
import "./f3";
@@ -33,3 +33,4 @@ var y = x.getA().x;
//// [f.d.ts]
/// <reference path="array.d.ts" />
import "array";
@@ -139,4 +139,6 @@ declare module "m4" {
}
}
declare module "test" {
import "m2";
import "m4";
}
@@ -101,4 +101,5 @@ declare module "d" {
}
}
declare module "main" {
import "d";
}
@@ -111,4 +111,6 @@ declare module "e" {
}
}
declare module "main" {
import "d";
import "e";
}
@@ -98,4 +98,6 @@ declare module "e" {
}
}
declare module "main" {
import "D";
import "e";
}
@@ -87,4 +87,6 @@ declare module "b" {
}
}
declare module "main" {
import "D";
import "E";
}
@@ -123,9 +123,12 @@ function a4() {
var _loop_5 = function(x) {
x = x + 1;
(function () { return x; });
out_x_1 = x;
};
var out_x_1;
for (var x = void 0; x < 1;) {
_loop_5(x);
x = out_x_1;
}
switch (1) {
case 1:
@@ -137,9 +140,12 @@ function a5() {
var _loop_6 = function(x) {
x = x + 1;
(function () { return x; });
out_x_2 = x;
};
var out_x_2;
for (var x = void 0; x < 1;) {
_loop_6(x);
x = out_x_2;
}
switch (1) {
case 1:
@@ -53,9 +53,12 @@ function a1() {
var _loop_1 = function(x) {
x = x + 1;
(function () { return x; });
out_x_1 = x;
};
var out_x_1;
for (var x = void 0; x < 1;) {
_loop_1(x);
x = out_x_1;
}
for (var x = void 0;;) {
x = x + 2;
@@ -68,24 +71,33 @@ function a2() {
var _loop_2 = function(x) {
x = x + 2;
(function () { return x; });
out_x_2 = x;
};
var out_x_2;
for (var x = void 0;;) {
_loop_2(x);
x = out_x_2;
}
}
function a3() {
var _loop_3 = function(x) {
x = x + 1;
(function () { return x; });
out_x_3 = x;
};
var out_x_3;
for (var x = void 0; x < 1;) {
_loop_3(x);
x = out_x_3;
}
var _loop_4 = function(x) {
x = x + 2;
(function () { return x; });
out_x_4 = x;
};
var out_x_4;
for (var x = void 0;;) {
_loop_4(x);
x = out_x_4;
}
}
@@ -108,9 +108,12 @@ function a2() {
var _loop_2 = function(x) {
x = x + 2;
(function () { return x; });
out_x_1 = x;
};
var out_x_1;
for (var x = void 0;;) {
_loop_2(x);
x = out_x_1;
}
}
function a3() {
@@ -124,9 +127,12 @@ function a3() {
var _loop_4 = function(x) {
x = x + 2;
(function () { return x; });
out_x_2 = x;
};
var out_x_2;
for (var x = void 0; false;) {
_loop_4(x);
x = out_x_2;
}
switch (1) {
case 1:
@@ -157,9 +163,12 @@ function a5() {
var _loop_5 = function(x) {
x = x + 2;
(function () { return x; });
out_x_3 = x;
};
var out_x_3;
for (var x = void 0; false;) {
_loop_5(x);
x = out_x_3;
}
switch (1) {
case 1:
@@ -119,9 +119,12 @@ function a2() {
var _loop_2 = function(x) {
x = x + 2;
(function () { return x; });
out_x_1 = x;
};
var out_x_1;
for (var x = void 0;;) {
_loop_2(x);
x = out_x_1;
}
}
function a3() {
@@ -136,9 +139,12 @@ function a3() {
var _loop_4 = function(x) {
x = x + 2;
(function () { return x; });
out_x_2 = x;
};
var out_x_2;
for (var x = void 0;;) {
_loop_4(x);
x = out_x_2;
}
}
function a4() {
@@ -1,13 +0,0 @@
//// [tests/cases/compiler/noErrorOnEmptyDts.ts] ////
//// [test.d.ts]
// comment
//// [main.ts]
import "test"
//// [main.js]
"use strict";
require("test");
@@ -1,8 +0,0 @@
=== c:/node_modules/test.d.ts ===
No type information for this code.
No type information for this code.// comment
No type information for this code.
No type information for this code.=== c:/app/main.ts ===
import "test"
No type information for this code.
@@ -1,8 +0,0 @@
=== c:/node_modules/test.d.ts ===
No type information for this code.
No type information for this code.// comment
No type information for this code.
No type information for this code.=== c:/app/main.ts ===
import "test"
No type information for this code.
@@ -0,0 +1,8 @@
//// [noImplicitUseStrict_amd.ts]
export var x = 0;
//// [noImplicitUseStrict_amd.js]
define(["require", "exports"], function (require, exports) {
exports.x = 0;
});
@@ -0,0 +1,5 @@
=== tests/cases/compiler/noImplicitUseStrict_amd.ts ===
export var x = 0;
>x : Symbol(x, Decl(noImplicitUseStrict_amd.ts, 1, 10))
@@ -0,0 +1,6 @@
=== tests/cases/compiler/noImplicitUseStrict_amd.ts ===
export var x = 0;
>x : number
>0 : number
@@ -0,0 +1,6 @@
//// [noImplicitUseStrict_commonjs.ts]
export var x = 0;
//// [noImplicitUseStrict_commonjs.js]
exports.x = 0;
@@ -0,0 +1,5 @@
=== tests/cases/compiler/noImplicitUseStrict_commonjs.ts ===
export var x = 0;
>x : Symbol(x, Decl(noImplicitUseStrict_commonjs.ts, 1, 10))
@@ -0,0 +1,6 @@
=== tests/cases/compiler/noImplicitUseStrict_commonjs.ts ===
export var x = 0;
>x : number
>0 : number

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