Merge branch 'master' into autohoist-default

This commit is contained in:
Wesley Wigham
2015-11-25 17:52:51 -08:00
1568 changed files with 21024 additions and 16354 deletions
+12 -2
View File
@@ -106,6 +106,16 @@ var serverCoreSources = [
return path.join(serverDirectory, f);
});
var scriptSources = [
"tslint/booleanTriviaRule.ts",
"tslint/nextLineRule.ts",
"tslint/noNullRule.ts",
"tslint/preferConstRule.ts",
"tslint/typeOperatorSpacingRule.ts"
].map(function (f) {
return path.join(scriptsDirectory, f);
});
var serverSources = serverCoreSources.concat(servicesSources);
var languageServiceLibrarySources = [
@@ -365,7 +375,6 @@ file(builtGeneratedDiagnosticMessagesJSON,[generatedDiagnosticMessagesJSON], fun
desc("Generates a diagnostic file in TypeScript based on an input JSON file");
task("generate-diagnostics", [diagnosticInfoMapTs]);
// Publish nightly
var configureNightlyJs = path.join(scriptsDirectory, "configureNightly.js");
var configureNightlyTs = path.join(scriptsDirectory, "configureNightly.ts");
@@ -909,7 +918,8 @@ function lintFileAsync(options, path, cb) {
var lintTargets = compilerSources
.concat(harnessCoreSources)
.concat(serverCoreSources);
.concat(serverCoreSources)
.concat(scriptSources);
desc("Runs tslint on the compiler sources");
task("lint", ["build-rules"], function() {
+2 -2
View File
@@ -13,10 +13,10 @@ export class Rule extends Lint.Rules.AbstractRule {
class TypeOperatorSpacingWalker extends Lint.RuleWalker {
public visitNode(node: ts.Node) {
if (node.kind === ts.SyntaxKind.UnionType || node.kind === ts.SyntaxKind.IntersectionType) {
let types = (<ts.UnionOrIntersectionTypeNode>node).types;
const types = (<ts.UnionOrIntersectionTypeNode>node).types;
let expectedStart = types[0].end + 2; // space, | or &
for (let i = 1; i < types.length; i++) {
let currentType = types[i];
const currentType = types[i];
if (expectedStart !== currentType.pos || currentType.getLeadingTriviaWidth() !== 1) {
const failure = this.createFailure(currentType.pos, currentType.getWidth(), Rule.FAILURE_STRING);
this.addFailure(failure);
+92 -49
View File
@@ -533,7 +533,7 @@ namespace ts {
}
// Because of module/namespace merging, a module's exports are in scope,
// yet we never want to treat an export specifier as putting a member in scope.
// yet we never want to treat an export specifier as putting a member in scope.
// Therefore, if the name we find is purely an export specifier, it is not actually considered in scope.
// Two things to note about this:
// 1. We have to check this without calling getSymbol. The problem with calling getSymbol
@@ -1032,16 +1032,12 @@ namespace ts {
// Module names are escaped in our symbol table. However, string literal values aren't.
// Escape the name in the "require(...)" clause to ensure we find the right symbol.
let moduleName = escapeIdentifier(moduleReferenceLiteral.text);
const moduleName = escapeIdentifier(moduleReferenceLiteral.text);
if (moduleName === undefined) {
return;
}
if (moduleName.indexOf("!") >= 0) {
moduleName = moduleName.substr(0, moduleName.indexOf("!"));
}
const isRelative = isExternalModuleNameRelative(moduleName);
if (!isRelative) {
const symbol = getSymbol(globals, "\"" + moduleName + "\"", SymbolFlags.ValueModule);
@@ -3205,7 +3201,7 @@ namespace ts {
case SyntaxKind.BooleanKeyword:
case SyntaxKind.SymbolKeyword:
case SyntaxKind.VoidKeyword:
case SyntaxKind.StringLiteral:
case SyntaxKind.StringLiteralType:
return true;
case SyntaxKind.ArrayType:
return isIndependentType((<ArrayTypeNode>node).elementType);
@@ -3866,7 +3862,7 @@ namespace ts {
paramSymbol = resolvedSymbol;
}
parameters.push(paramSymbol);
if (param.type && param.type.kind === SyntaxKind.StringLiteral) {
if (param.type && param.type.kind === SyntaxKind.StringLiteralType) {
hasStringLiterals = true;
}
@@ -4535,8 +4531,7 @@ namespace ts {
return links.resolvedType;
}
function getStringLiteralType(node: StringLiteral): StringLiteralType {
const text = node.text;
function getStringLiteralTypeForText(text: string): StringLiteralType {
if (hasProperty(stringLiteralTypes, text)) {
return stringLiteralTypes[text];
}
@@ -4546,10 +4541,10 @@ namespace ts {
return type;
}
function getTypeFromStringLiteral(node: StringLiteral): Type {
function getTypeFromStringLiteralTypeNode(node: StringLiteralTypeNode): Type {
const links = getNodeLinks(node);
if (!links.resolvedType) {
links.resolvedType = getStringLiteralType(node);
links.resolvedType = getStringLiteralTypeForText(node.text);
}
return links.resolvedType;
}
@@ -4591,8 +4586,8 @@ namespace ts {
return voidType;
case SyntaxKind.ThisType:
return getTypeFromThisTypeNode(node);
case SyntaxKind.StringLiteral:
return getTypeFromStringLiteral(<StringLiteral>node);
case SyntaxKind.StringLiteralType:
return getTypeFromStringLiteralTypeNode(<StringLiteralTypeNode>node);
case SyntaxKind.TypeReference:
return getTypeFromTypeReference(<TypeReferenceNode>node);
case SyntaxKind.TypePredicate:
@@ -5232,9 +5227,12 @@ namespace ts {
const id = relation !== identityRelation || apparentSource.id < target.id ? apparentSource.id + "," + target.id : target.id + "," + apparentSource.id;
const related = relation[id];
if (related !== undefined) {
// If we computed this relation already and it was failed and reported, or if we're not being asked to elaborate
// errors, we can use the cached value. Otherwise, recompute the relation
if (!elaborateErrors || (related === RelationComparisonResult.FailedAndReported)) {
if (elaborateErrors && related === RelationComparisonResult.Failed) {
// We are elaborating errors and the cached result is an unreported failure. Record the result as a reported
// failure and continue computing the relation such that errors get reported.
relation[id] = RelationComparisonResult.FailedAndReported;
}
else {
return related === RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False;
}
}
@@ -6090,6 +6088,17 @@ namespace ts {
}
function inferFromTypes(source: Type, target: Type) {
if (source.flags & TypeFlags.Union && target.flags & TypeFlags.Union ||
source.flags & TypeFlags.Intersection && target.flags & TypeFlags.Intersection) {
// Source and target are both unions or both intersections. To improve the quality of
// inferences we first reduce the types by removing constituents that are identically
// matched by a constituent in the other type. For example, when inferring from
// 'string | string[]' to 'string | T', we reduce the types to 'string[]' and 'T'.
const reducedSource = reduceUnionOrIntersectionType(<UnionOrIntersectionType>source, <UnionOrIntersectionType>target);
const reducedTarget = reduceUnionOrIntersectionType(<UnionOrIntersectionType>target, <UnionOrIntersectionType>source);
source = reducedSource;
target = reducedTarget;
}
if (target.flags & TypeFlags.TypeParameter) {
// If target is a type parameter, make an inference, unless the source type contains
// the anyFunctionType (the wildcard type that's used to avoid contextually typing functions).
@@ -6100,7 +6109,6 @@ namespace ts {
if (source.flags & TypeFlags.ContainsAnyFunctionType) {
return;
}
const typeParameters = context.typeParameters;
for (let i = 0; i < typeParameters.length; i++) {
if (target === typeParameters[i]) {
@@ -6248,6 +6256,41 @@ namespace ts {
}
}
function typeIdenticalToSomeType(source: Type, target: UnionOrIntersectionType): boolean {
for (const t of target.types) {
if (isTypeIdenticalTo(source, t)) {
return true;
}
}
return false;
}
/**
* Return the reduced form of the source type. This type is computed by by removing all source
* constituents that have an identical match in the target type.
*/
function reduceUnionOrIntersectionType(source: UnionOrIntersectionType, target: UnionOrIntersectionType) {
let sourceTypes = source.types;
let sourceIndex = 0;
let modified = false;
while (sourceIndex < sourceTypes.length) {
if (typeIdenticalToSomeType(sourceTypes[sourceIndex], target)) {
if (!modified) {
sourceTypes = sourceTypes.slice(0);
modified = true;
}
sourceTypes.splice(sourceIndex, 1);
}
else {
sourceIndex++;
}
}
if (modified) {
return source.flags & TypeFlags.Union ? getUnionType(sourceTypes, /*noSubtypeReduction*/ true) : getIntersectionType(sourceTypes);
}
return source;
}
function getInferenceCandidates(context: InferenceContext, index: number): Type[] {
const inferences = context.inferences[index];
return inferences.primary || inferences.secondary || emptyArray;
@@ -8751,7 +8794,7 @@ namespace ts {
// for the argument. In that case, we should check the argument.
if (argType === undefined) {
argType = arg.kind === SyntaxKind.StringLiteral && !reportErrors
? getStringLiteralType(<StringLiteral>arg)
? getStringLiteralTypeForText((<StringLiteral>arg).text)
: checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined);
}
@@ -8946,7 +8989,7 @@ namespace ts {
case SyntaxKind.Identifier:
case SyntaxKind.NumericLiteral:
case SyntaxKind.StringLiteral:
return getStringLiteralType(<StringLiteral>element.name);
return getStringLiteralTypeForText((<Identifier | LiteralExpression>element.name).text);
case SyntaxKind.ComputedPropertyName:
const nameType = checkComputedPropertyName(<ComputedPropertyName>element.name);
@@ -9815,17 +9858,25 @@ namespace ts {
return aggregatedTypes;
}
// TypeScript Specification 1.0 (6.3) - July 2014
// An explicitly typed function whose return type isn't the Void or the Any type
// must have at least one return statement somewhere in its body.
// An exception to this rule is if the function implementation consists of a single 'throw' statement.
/*
*TypeScript Specification 1.0 (6.3) - July 2014
* An explicitly typed function whose return type isn't the Void or the Any type
* must have at least one return statement somewhere in its body.
* An exception to this rule is if the function implementation consists of a single 'throw' statement.
* @param returnType - return type of the function, can be undefined if return type is not explicitly specified
*/
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func: FunctionLikeDeclaration, returnType: Type): void {
if (!produceDiagnostics) {
return;
}
// Functions that return 'void' or 'any' don't need any return expressions.
if (returnType === voidType || isTypeAny(returnType)) {
// Functions with with an explicitly specified 'void' or 'any' return type don't need any return expressions.
if (returnType && (returnType === voidType || isTypeAny(returnType))) {
return;
}
// if return type is not specified then we'll do the check only if 'noImplicitReturns' option is set
if (!returnType && !compilerOptions.noImplicitReturns) {
return;
}
@@ -9835,13 +9886,14 @@ namespace ts {
return;
}
if (func.flags & NodeFlags.HasExplicitReturn) {
if (!returnType || func.flags & NodeFlags.HasExplicitReturn) {
if (compilerOptions.noImplicitReturns) {
error(func.type, Diagnostics.Not_all_code_paths_return_a_value);
error(func.type || func, Diagnostics.Not_all_code_paths_return_a_value);
}
}
else {
// This function does not conform to the specification.
// NOTE: having returnType !== undefined is a precondition for entering this branch so func.type will always be present
error(func.type, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
}
}
@@ -9916,14 +9968,10 @@ namespace ts {
emitAwaiter = true;
}
const returnType = node.type && getTypeFromTypeNode(node.type);
let promisedType: Type;
if (returnType && isAsync) {
promisedType = checkAsyncFunctionReturnType(node);
}
if (returnType && !node.asteriskToken) {
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType);
const returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));
if (!node.asteriskToken) {
// return is not necessary in the body of generators
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType);
}
if (node.body) {
@@ -9946,13 +9994,13 @@ namespace ts {
// check assignability of the awaited type of the expression body against the promised type of
// its return type annotation.
const exprType = checkExpression(<Expression>node.body);
if (returnType) {
if (returnOrPromisedType) {
if (isAsync) {
const awaitedType = checkAwaitedType(exprType, node.body, Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member);
checkTypeAssignableTo(awaitedType, promisedType, node.body);
checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body);
}
else {
checkTypeAssignableTo(exprType, returnType, node.body);
checkTypeAssignableTo(exprType, returnOrPromisedType, node.body);
}
}
@@ -10568,7 +10616,7 @@ namespace ts {
function checkStringLiteralExpression(node: StringLiteral): Type {
const contextualType = getContextualType(node);
if (contextualType && contextualTypeIsStringLiteralType(contextualType)) {
return getStringLiteralType(node);
return getStringLiteralTypeForText(node.text);
}
return stringType;
@@ -11402,7 +11450,7 @@ namespace ts {
// we can get here in two cases
// 1. mixed static and instance class members
// 2. something with the same name was defined before the set of overloads that prevents them from merging
// here we'll report error only for the first case since for second we should already report error in binder
// here we'll report error only for the first case since for second we should already report error in binder
if (reportError) {
const diagnostic = node.flags & NodeFlags.Static ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static;
error(errorNode, diagnostic);
@@ -12092,14 +12140,9 @@ namespace ts {
}
checkSourceElement(node.body);
if (node.type && !isAccessor(node.kind) && !node.asteriskToken) {
const returnType = getTypeFromTypeNode(node.type);
let promisedType: Type;
if (isAsync) {
promisedType = checkAsyncFunctionReturnType(node);
}
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType);
if (!isAccessor(node.kind) && !node.asteriskToken) {
const returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType);
}
if (produceDiagnostics && !node.type) {
+16 -7
View File
@@ -357,7 +357,7 @@ namespace ts {
case SyntaxKind.SymbolKeyword:
case SyntaxKind.VoidKeyword:
case SyntaxKind.ThisType:
case SyntaxKind.StringLiteral:
case SyntaxKind.StringLiteralType:
return writeTextOfNode(currentText, type);
case SyntaxKind.ExpressionWithTypeArguments:
return emitExpressionWithTypeArguments(<ExpressionWithTypeArguments>type);
@@ -658,7 +658,7 @@ namespace ts {
}
else {
write("require(");
writeTextOfNode(currentText, getExternalModuleImportEqualsDeclarationExpression(node));
emitExternalModuleSpecifier(node);
write(");");
}
writer.writeLine();
@@ -715,14 +715,23 @@ namespace ts {
}
write(" from ");
}
emitExternalModuleSpecifier(node.moduleSpecifier);
emitExternalModuleSpecifier(node);
write(";");
writer.writeLine();
}
function emitExternalModuleSpecifier(moduleSpecifier: Expression) {
if (moduleSpecifier.kind === SyntaxKind.StringLiteral && isBundledEmit) {
const moduleName = getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent as (ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration));
function emitExternalModuleSpecifier(parent: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration) {
let moduleSpecifier: Node;
if (parent.kind === SyntaxKind.ImportEqualsDeclaration) {
const node = parent as ImportEqualsDeclaration;
moduleSpecifier = getExternalModuleImportEqualsDeclarationExpression(node);
}
else {
const node = parent as (ImportDeclaration | ExportDeclaration);
moduleSpecifier = node.moduleSpecifier;
}
if (moduleSpecifier.kind === SyntaxKind.StringLiteral && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) {
const moduleName = getExternalModuleNameFromDeclaration(host, resolver, parent);
if (moduleName) {
write("\"");
write(moduleName);
@@ -765,7 +774,7 @@ namespace ts {
}
if (node.moduleSpecifier) {
write(" from ");
emitExternalModuleSpecifier(node.moduleSpecifier);
emitExternalModuleSpecifier(node);
}
write(";");
writer.writeLine();
+9 -1
View File
@@ -1622,7 +1622,7 @@
},
"Cannot assign an abstract constructor type to a non-abstract constructor type.": {
"category": "Error",
"code":2517
"code": 2517
},
"Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.": {
"category": "Error",
@@ -2068,6 +2068,14 @@
"category": "Error",
"code": 5056
},
"Cannot find a tsconfig.json file at the specified directory: '{0}'": {
"category": "Error",
"code": 5057
},
"The specified path does not exist: '{0}'": {
"category": "Error",
"code": 5058
},
"Concatenate and emit output to single file.": {
"category": "Message",
+90 -35
View File
@@ -402,6 +402,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
*/
argumentsName?: string;
/*
* alias for 'this' from the calling code stack frame in case if this was used inside the converted loop
*/
thisName?: string;
/*
* list of non-block scoped variable declarations that appear inside converted loop
* such variable declarations should be moved outside the loop body
@@ -1271,7 +1276,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
}
function isBinaryOrOctalIntegerLiteral(node: LiteralExpression, text: string): boolean {
function isBinaryOrOctalIntegerLiteral(node: LiteralLikeNode, text: string): boolean {
if (node.kind === SyntaxKind.NumericLiteral && text.length > 1) {
switch (text.charCodeAt(1)) {
case CharacterCodes.b:
@@ -1285,7 +1290,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
return false;
}
function emitLiteral(node: LiteralExpression) {
function emitLiteral(node: LiteralExpression | TemplateLiteralFragment) {
const text = getLiteralText(node);
if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) {
@@ -1300,7 +1305,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
}
function getLiteralText(node: LiteralExpression) {
function getLiteralText(node: LiteralExpression | TemplateLiteralFragment) {
// Any template literal or string literal with an extended escape
// (e.g. "\u{0067}") will need to be downleveled as a escaped string literal.
if (languageVersion < ScriptTarget.ES6 && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) {
@@ -1359,7 +1364,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(`"${text}"`);
}
function emitDownlevelTaggedTemplateArray(node: TaggedTemplateExpression, literalEmitter: (literal: LiteralExpression) => void) {
function emitDownlevelTaggedTemplateArray(node: TaggedTemplateExpression, literalEmitter: (literal: LiteralExpression | TemplateLiteralFragment) => void) {
write("[");
if (node.template.kind === SyntaxKind.NoSubstitutionTemplateLiteral) {
literalEmitter(<LiteralExpression>node.template);
@@ -1992,6 +1997,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.LexicalThis) {
write("_this");
}
else if (convertedLoopState) {
write(convertedLoopState.thisName || (convertedLoopState.thisName = makeUniqueName("this")));
}
else {
write("this");
}
@@ -3322,6 +3330,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
convertedLoopState.argumentsName = convertedOuterLoopState.argumentsName;
}
if (convertedOuterLoopState.thisName) {
// outer loop has already used 'this' so we've already have some name to alias it
// use the same name in all nested loops
convertedLoopState.thisName = convertedOuterLoopState.thisName;
}
if (convertedOuterLoopState.hoistedLocalVariables) {
// we've already collected some non-block scoped variable declarations in enclosing loop
// use the same storage in nested loop
@@ -3351,6 +3365,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
writeLine();
}
}
if (convertedLoopState.thisName) {
// if alias for this is set
if (convertedOuterLoopState) {
// pass it to outer converted loop
convertedOuterLoopState.thisName = convertedLoopState.thisName;
}
else {
// this is top level converted loop so we need to create an alias for 'this' here
// NOTE:
// if converted loops were all nested in arrow function then we'll always emit '_this' so convertedLoopState.thisName will not be set.
// If it is set this means that all nested loops are not nested in arrow function and it is safe to capture 'this'.
write(`var ${convertedLoopState.thisName} = this;`);
writeLine();
}
}
if (convertedLoopState.hoistedLocalVariables) {
// if hoistedLocalVariables !== undefined this means that we've possibly collected some variable declarations to be hoisted later
@@ -5542,9 +5571,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
emitDecoratorsOfClass(node);
}
if (!(node.flags & NodeFlags.Export)) {
return;
}
// If this is an exported class, but not on the top level (i.e. on an internal
// module), export it
if (!isES6ExportedDeclaration(node) && (node.flags & NodeFlags.Export)) {
if (node.flags & NodeFlags.Default) {
// if this is a top level default export of decorated class, write the export after the declaration.
writeLine();
if (thisNodeIsDecorated && modulekind === ModuleKind.ES6) {
write("export default ");
emitDeclarationName(node);
write(";");
}
else if (modulekind === ModuleKind.System) {
write(`${exportFunctionForFile}("default", `);
emitDeclarationName(node);
write(");");
}
else if (modulekind !== ModuleKind.ES6) {
write(`exports.default = `);
emitDeclarationName(node);
write(";");
}
}
else if (node.parent.kind !== SyntaxKind.SourceFile || (modulekind !== ModuleKind.ES6 && !(node.flags & NodeFlags.Default))) {
writeLine();
emitStart(node);
emitModuleMemberName(node);
@@ -5553,13 +5604,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
emitEnd(node);
write(";");
}
else if (isES6ExportedDeclaration(node) && (node.flags & NodeFlags.Default) && thisNodeIsDecorated) {
// if this is a top level default export of decorated class, write the export after the declaration.
writeLine();
write("export default ");
emitDeclarationName(node);
write(";");
}
}
function emitClassLikeDeclarationBelowES6(node: ClassLikeDeclaration) {
@@ -5925,7 +5969,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function emitSerializedTypeNode(node: TypeNode) {
if (node) {
switch (node.kind) {
case SyntaxKind.VoidKeyword:
write("void 0");
@@ -5951,7 +5994,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
return;
case SyntaxKind.StringKeyword:
case SyntaxKind.StringLiteral:
case SyntaxKind.StringLiteralType:
write("String");
return;
@@ -6767,7 +6810,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
}
function getExternalModuleNameText(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration): string {
function getExternalModuleNameText(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, emitRelativePathAsModuleName: boolean): string {
if (emitRelativePathAsModuleName) {
const name = getExternalModuleNameFromDeclaration(host, resolver, importNode);
if (name) {
return `"${name}"`;
}
}
const moduleName = getExternalModuleName(importNode);
if (moduleName.kind === SyntaxKind.StringLiteral) {
return tryRenameExternalModule(<LiteralExpression>moduleName) || getLiteralText(<LiteralExpression>moduleName);
@@ -7327,7 +7376,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
const dependencyGroups: DependencyGroup[] = [];
for (let i = 0; i < externalImports.length; ++i) {
let text = getExternalModuleNameText(externalImports[i]);
const text = getExternalModuleNameText(externalImports[i], emitRelativePathAsModuleName);
if (hasProperty(groupIndices, text)) {
// deduplicate/group entries in dependency list by the dependency name
const groupIndex = groupIndices[text];
@@ -7343,18 +7392,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(", ");
}
if (emitRelativePathAsModuleName) {
const name = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]);
if (name) {
text = `"${name}"`;
}
}
write(text);
}
write(`], function(${exportFunctionForFile}) {`);
writeLine();
increaseIndent();
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true);
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
emitEmitHelpers(node);
emitCaptureThisForNodeIfNecessary(node);
emitSystemModuleBody(node, dependencyGroups, startIndex);
@@ -7391,14 +7434,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
for (const importNode of externalImports) {
// Find the name of the external module
let externalModuleName = getExternalModuleNameText(importNode);
if (emitRelativePathAsModuleName) {
const name = getExternalModuleNameFromDeclaration(host, resolver, importNode);
if (name) {
externalModuleName = `"${name}"`;
}
}
const externalModuleName = getExternalModuleNameText(importNode, emitRelativePathAsModuleName);
// Find the name of the module alias, if there is one
const importAliasName = getLocalNameForExternalImport(importNode);
@@ -7464,7 +7500,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
writeModuleName(node, emitRelativePathAsModuleName);
emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, emitRelativePathAsModuleName);
increaseIndent();
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true);
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
emitExportStarHelper();
emitCaptureThisForNodeIfNecessary(node);
emitLinesStartingAt(node.statements, startIndex);
@@ -7476,7 +7512,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
function emitCommonJSModule(node: SourceFile) {
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false);
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false, /*ensureUseStrict*/ true);
emitEmitHelpers(node);
collectExternalModuleInfo(node);
emitExportStarHelper();
@@ -7505,7 +7541,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
})(`);
emitAMDFactoryHeader(dependencyNames);
increaseIndent();
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true);
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
emitExportStarHelper();
emitCaptureThisForNodeIfNecessary(node);
emitLinesStartingAt(node.statements, startIndex);
@@ -7647,19 +7683,38 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
}
function emitDirectivePrologues(statements: Node[], startWithNewLine: boolean): number {
function isUseStrictPrologue(node: ExpressionStatement): boolean {
return !!(node.expression as StringLiteral).text.match(/use strict/);
}
function ensureUseStrictPrologue(startWithNewLine: boolean, writeUseStrict: boolean) {
if (writeUseStrict) {
if (startWithNewLine) {
writeLine();
}
write("\"use strict\";");
}
}
function emitDirectivePrologues(statements: Node[], startWithNewLine: boolean, ensureUseStrict?: boolean): number {
let foundUseStrict = false;
for (let i = 0; i < statements.length; ++i) {
if (isPrologueDirective(statements[i])) {
if (isUseStrictPrologue(statements[i] as ExpressionStatement)) {
foundUseStrict = true;
}
if (startWithNewLine || i > 0) {
writeLine();
}
emit(statements[i]);
}
else {
ensureUseStrictPrologue(startWithNewLine || i > 0, !foundUseStrict && ensureUseStrict);
// return index of the first non prologue directive
return i;
}
}
ensureUseStrictPrologue(startWithNewLine, !foundUseStrict && ensureUseStrict);
return statements.length;
}
+18 -6
View File
@@ -1874,7 +1874,7 @@ namespace ts {
function parseTemplateExpression(): TemplateExpression {
const template = <TemplateExpression>createNode(SyntaxKind.TemplateExpression);
template.head = parseLiteralNode();
template.head = parseTemplateLiteralFragment();
Debug.assert(template.head.kind === SyntaxKind.TemplateHead, "Template head has wrong token kind");
const templateSpans = <NodeArray<TemplateSpan>>[];
@@ -1895,22 +1895,34 @@ namespace ts {
const span = <TemplateSpan>createNode(SyntaxKind.TemplateSpan);
span.expression = allowInAnd(parseExpression);
let literal: LiteralExpression;
let literal: TemplateLiteralFragment;
if (token === SyntaxKind.CloseBraceToken) {
reScanTemplateToken();
literal = parseLiteralNode();
literal = parseTemplateLiteralFragment();
}
else {
literal = <LiteralExpression>parseExpectedToken(SyntaxKind.TemplateTail, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, tokenToString(SyntaxKind.CloseBraceToken));
literal = <TemplateLiteralFragment>parseExpectedToken(SyntaxKind.TemplateTail, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, tokenToString(SyntaxKind.CloseBraceToken));
}
span.literal = literal;
return finishNode(span);
}
function parseStringLiteralTypeNode(): StringLiteralTypeNode {
return <StringLiteralTypeNode>parseLiteralLikeNode(SyntaxKind.StringLiteralType, /*internName*/ true);
}
function parseLiteralNode(internName?: boolean): LiteralExpression {
const node = <LiteralExpression>createNode(token);
return <LiteralExpression>parseLiteralLikeNode(token, internName);
}
function parseTemplateLiteralFragment(): TemplateLiteralFragment {
return <TemplateLiteralFragment>parseLiteralLikeNode(token, /*internName*/ false);
}
function parseLiteralLikeNode(kind: SyntaxKind, internName: boolean): LiteralLikeNode {
const node = <LiteralExpression>createNode(kind);
const text = scanner.getTokenValue();
node.text = internName ? internIdentifier(text) : text;
@@ -2397,7 +2409,7 @@ namespace ts {
const node = tryParse(parseKeywordAndNoDot);
return node || parseTypeReferenceOrTypePredicate();
case SyntaxKind.StringLiteral:
return <StringLiteral>parseLiteralNode(/*internName*/ true);
return parseStringLiteralTypeNode();
case SyntaxKind.VoidKeyword:
return parseTokenNode<TypeNode>();
case SyntaxKind.ThisKeyword:
+25 -18
View File
@@ -395,7 +395,7 @@ namespace ts {
getTypeChecker,
getClassifiableNames,
getDiagnosticsProducingTypeChecker,
getCommonSourceDirectory: () => commonSourceDirectory,
getCommonSourceDirectory,
emit,
getCurrentDirectory: () => currentDirectory,
getNodeCount: () => getDiagnosticsProducingTypeChecker().getNodeCount(),
@@ -411,6 +411,25 @@ namespace ts {
return program;
function getCommonSourceDirectory() {
if (typeof commonSourceDirectory === "undefined") {
if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) {
// If a rootDir is specified and is valid use it as the commonSourceDirectory
commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, currentDirectory);
}
else {
commonSourceDirectory = computeCommonSourceDirectory(files);
}
if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) {
// Make sure directory path ends with directory separator so this string can directly
// used to replace with "" to get the relative path of the source file and the relative path doesn't
// start with / making it rooted path
commonSourceDirectory += directorySeparator;
}
}
return commonSourceDirectory;
}
function getClassifiableNames() {
if (!classifiableNames) {
// Initialize a checker so that all our files are bound.
@@ -1234,24 +1253,12 @@ namespace ts {
options.sourceRoot || // there is --sourceRoot specified
options.mapRoot) { // there is --mapRoot specified
if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) {
// If a rootDir is specified and is valid use it as the commonSourceDirectory
commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, currentDirectory);
}
else {
// Compute the commonSourceDirectory from the input files
commonSourceDirectory = computeCommonSourceDirectory(files);
// If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure
if (options.outDir && commonSourceDirectory === "" && forEach(files, file => getRootLength(file.fileName) > 1)) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
}
}
// Precalculate and cache the common source directory
const dir = getCommonSourceDirectory();
if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) {
// Make sure directory path ends with directory separator so this string can directly
// used to replace with "" to get the relative path of the source file and the relative path doesn't
// start with / making it rooted path
commonSourceDirectory += directorySeparator;
// If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure
if (options.outDir && dir === "" && forEach(files, file => getRootLength(file.fileName) > 1)) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
}
}
+16 -1
View File
@@ -295,11 +295,26 @@ namespace ts {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--project"), /* compilerHost */ undefined);
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
configFileName = normalizePath(combinePaths(commandLine.options.project, "tsconfig.json"));
if (commandLine.fileNames.length !== 0) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line), /* compilerHost */ undefined);
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
const fileOrDirectory = normalizePath(commandLine.options.project);
if (!fileOrDirectory /* current directory "." */ || sys.directoryExists(fileOrDirectory)) {
configFileName = combinePaths(fileOrDirectory, "tsconfig.json");
if (!sys.fileExists(configFileName)) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project), /* compilerHost */ undefined);
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
}
else {
configFileName = fileOrDirectory;
if (!sys.fileExists(configFileName)) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project), /* compilerHost */ undefined);
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
}
}
else if (commandLine.fileNames.length === 0 && isJSONSupported()) {
const searchPath = normalizePath(sys.getCurrentDirectory());
+22 -10
View File
@@ -205,6 +205,7 @@ namespace ts {
IntersectionType,
ParenthesizedType,
ThisType,
StringLiteralType,
// Binding patterns
ObjectBindingPattern,
ArrayBindingPattern,
@@ -350,7 +351,7 @@ namespace ts {
FirstFutureReservedWord = ImplementsKeyword,
LastFutureReservedWord = YieldKeyword,
FirstTypeNode = TypePredicate,
LastTypeNode = ThisType,
LastTypeNode = StringLiteralType,
FirstPunctuation = OpenBraceToken,
LastPunctuation = CaretEqualsToken,
FirstToken = Unknown,
@@ -790,10 +791,13 @@ namespace ts {
type: TypeNode;
}
// Note that a StringLiteral AST node is both an Expression and a TypeNode. The latter is
// because string literals can appear in type annotations as well.
// @kind(SyntaxKind.StringLiteralType)
export interface StringLiteralTypeNode extends LiteralLikeNode, TypeNode {
_stringLiteralTypeBrand: any;
}
// @kind(SyntaxKind.StringLiteral)
export interface StringLiteral extends LiteralExpression, TypeNode {
export interface StringLiteral extends LiteralExpression {
_stringLiteralBrand: any;
}
@@ -911,24 +915,32 @@ namespace ts {
body: ConciseBody;
}
export interface LiteralLikeNode extends Node {
text: string;
isUnterminated?: boolean;
hasExtendedUnicodeEscape?: boolean;
}
// The text property of a LiteralExpression stores the interpreted value of the literal in text form. For a StringLiteral,
// or any literal of a template, this means quotes have been removed and escapes have been converted to actual characters.
// For a NumericLiteral, the stored value is the toString() representation of the number. For example 1, 1.00, and 1e0 are all stored as just "1".
// @kind(SyntaxKind.NumericLiteral)
// @kind(SyntaxKind.RegularExpressionLiteral)
// @kind(SyntaxKind.NoSubstitutionTemplateLiteral)
export interface LiteralExpression extends LiteralLikeNode, PrimaryExpression {
_literalExpressionBrand: any;
}
// @kind(SyntaxKind.TemplateHead)
// @kind(SyntaxKind.TemplateMiddle)
// @kind(SyntaxKind.TemplateTail)
export interface LiteralExpression extends PrimaryExpression {
text: string;
isUnterminated?: boolean;
hasExtendedUnicodeEscape?: boolean;
export interface TemplateLiteralFragment extends LiteralLikeNode {
_templateLiteralFragmentBrand: any;
}
// @kind(SyntaxKind.TemplateExpression)
export interface TemplateExpression extends PrimaryExpression {
head: LiteralExpression;
head: TemplateLiteralFragment;
templateSpans: NodeArray<TemplateSpan>;
}
@@ -937,7 +949,7 @@ namespace ts {
// @kind(SyntaxKind.TemplateSpan)
export interface TemplateSpan extends Node {
expression: Expression;
literal: LiteralExpression;
literal: TemplateLiteralFragment;
}
// @kind(SyntaxKind.ParenthesizedExpression)
+1 -4
View File
@@ -466,9 +466,6 @@ namespace ts {
return true;
case SyntaxKind.VoidKeyword:
return node.parent.kind !== SyntaxKind.VoidExpression;
case SyntaxKind.StringLiteral:
// Specialized signatures can have string literals as their parameters' type names
return node.parent.kind === SyntaxKind.Parameter;
case SyntaxKind.ExpressionWithTypeArguments:
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
@@ -1909,7 +1906,7 @@ namespace ts {
* Resolves a local path to a path which is absolute to the base of the emit
*/
export function getExternalModuleNameFromPath(host: EmitHost, fileName: string): string {
const dir = host.getCurrentDirectory();
const dir = toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), f => host.getCanonicalFileName(f));
const relativePath = getRelativePathToDirectoryOrUrl(dir, fileName, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/ false);
return removeFileExtension(relativePath);
}
+5 -2
View File
@@ -3372,6 +3372,7 @@ namespace ts {
function isInStringOrRegularExpressionOrTemplateLiteral(contextToken: Node): boolean {
if (contextToken.kind === SyntaxKind.StringLiteral
|| contextToken.kind === SyntaxKind.StringLiteralType
|| contextToken.kind === SyntaxKind.RegularExpressionLiteral
|| isTemplateLiteralKind(contextToken.kind)) {
let start = contextToken.getStart();
@@ -6369,6 +6370,7 @@ namespace ts {
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.QualifiedName:
case SyntaxKind.StringLiteral:
case SyntaxKind.StringLiteralType:
case SyntaxKind.FalseKeyword:
case SyntaxKind.TrueKeyword:
case SyntaxKind.NullKeyword:
@@ -6830,7 +6832,7 @@ namespace ts {
else if (tokenKind === SyntaxKind.NumericLiteral) {
return ClassificationType.numericLiteral;
}
else if (tokenKind === SyntaxKind.StringLiteral) {
else if (tokenKind === SyntaxKind.StringLiteral || tokenKind === SyntaxKind.StringLiteralType) {
return ClassificationType.stringLiteral;
}
else if (tokenKind === SyntaxKind.RegularExpressionLiteral) {
@@ -7749,7 +7751,7 @@ namespace ts {
addResult(start, end, classFromKind(token));
if (end >= text.length) {
if (token === SyntaxKind.StringLiteral) {
if (token === SyntaxKind.StringLiteral || token === SyntaxKind.StringLiteralType) {
// Check to see if we finished up on a multiline string literal.
let tokenText = scanner.getTokenText();
if (scanner.isUnterminated()) {
@@ -7899,6 +7901,7 @@ namespace ts {
case SyntaxKind.NumericLiteral:
return ClassificationType.numericLiteral;
case SyntaxKind.StringLiteral:
case SyntaxKind.StringLiteralType:
return ClassificationType.stringLiteral;
case SyntaxKind.RegularExpressionLiteral:
return ClassificationType.regularExpressionLiteral;
+8 -7
View File
@@ -257,14 +257,14 @@ namespace ts {
return syntaxList;
}
/* Gets the token whose text has range [start, end) and
/* Gets the token whose text has range [start, end) and
* position >= start and (position < end or (position === end && token is keyword or identifier))
*/
export function getTouchingWord(sourceFile: SourceFile, position: number): Node {
return getTouchingToken(sourceFile, position, n => isWord(n.kind));
}
/* Gets the token whose text has range [start, end) and position >= start
/* Gets the token whose text has range [start, end) and position >= start
* and (position < end or (position === end && token is keyword or identifier or numeric\string litera))
*/
export function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node {
@@ -391,8 +391,8 @@ namespace ts {
const start = child.getStart(sourceFile);
const lookInPreviousChild =
(start >= position) || // cursor in the leading trivia
(child.kind === SyntaxKind.JsxText && start === child.end); // whitespace only JsxText
(child.kind === SyntaxKind.JsxText && start === child.end); // whitespace only JsxText
if (lookInPreviousChild) {
// actual start of the node is past the position - previous token should be at the end of previous child
let candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i);
@@ -407,7 +407,7 @@ namespace ts {
Debug.assert(startNode !== undefined || n.kind === SyntaxKind.SourceFile);
// Here we know that none of child token nodes embrace the position,
// Here we know that none of child token nodes embrace the position,
// the only known case is when position is at the end of the file.
// Try to find the rightmost token in the file without filtering.
// Namely we are skipping the check: 'position < node.end'
@@ -429,7 +429,7 @@ namespace ts {
export function isInString(sourceFile: SourceFile, position: number) {
let token = getTokenAtPosition(sourceFile, position);
return token && token.kind === SyntaxKind.StringLiteral && position > token.getStart();
return token && (token.kind === SyntaxKind.StringLiteral || token.kind === SyntaxKind.StringLiteralType) && position > token.getStart();
}
export function isInComment(sourceFile: SourceFile, position: number) {
@@ -445,7 +445,7 @@ namespace ts {
if (token && position <= token.getStart()) {
let commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
// The end marker of a single-line comment does not include the newline character.
// In the following case, we are inside a comment (^ denotes the cursor position):
//
@@ -565,6 +565,7 @@ namespace ts {
export function isStringOrRegularExpressionOrTemplateLiteral(kind: SyntaxKind): boolean {
if (kind === SyntaxKind.StringLiteral
|| kind === SyntaxKind.StringLiteralType
|| kind === SyntaxKind.RegularExpressionLiteral
|| isTemplateLiteralKind(kind)) {
return true;
@@ -40,6 +40,7 @@ compile(process.argv.slice(2), {
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
"use strict";
var ts = require("typescript");
function compile(fileNames, options) {
var program = ts.createProgram(fileNames, options);
@@ -70,6 +70,7 @@ fileNames.forEach(fileName => {
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
"use strict";
var ts = require("typescript");
function delint(sourceFile) {
delintNode(sourceFile);
@@ -22,6 +22,7 @@ console.log(JSON.stringify(result));
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
"use strict";
var ts = require("typescript");
var source = "let x: string = 'string'";
var result = ts.transpile(source, { module: ts.ModuleKind.CommonJS });
@@ -109,6 +109,7 @@ watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS });
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
"use strict";
var ts = require("typescript");
function watch(rootFileNames, options) {
var files = {};
@@ -5,6 +5,7 @@ export class C {
export = B;
//// [ExportAssignment7.js]
"use strict";
var C = (function () {
function C() {
}
@@ -5,6 +5,7 @@ export class C {
}
//// [ExportAssignment8.js]
"use strict";
var C = (function () {
function C() {
}
@@ -30,6 +30,7 @@ export module A {
//// [part1.js]
"use strict";
var A;
(function (A) {
var Utils;
@@ -42,6 +43,7 @@ var A;
A.Origin = { x: 0, y: 0 };
})(A = exports.A || (exports.A = {}));
//// [part2.js]
"use strict";
var A;
(function (A) {
// collision with 'Origin' var in other part of merged module
@@ -14,6 +14,7 @@ y = moduleA; // should be error
//// [aliasAssignments_moduleA.js]
"use strict";
var someClass = (function () {
function someClass() {
}
@@ -21,6 +22,7 @@ var someClass = (function () {
})();
exports.someClass = someClass;
//// [aliasAssignments_1.js]
"use strict";
var moduleA = require("./aliasAssignments_moduleA");
var x = moduleA;
x = 1; // Should be error
@@ -23,6 +23,7 @@ var x: foo.A = foo.bar("hello"); // foo.A should be ok but foo.bar should be err
//// [aliasOnMergedModuleInterface_0.js]
//// [aliasOnMergedModuleInterface_1.js]
"use strict";
var z;
z.bar("hello"); // This should be ok
var x = foo.bar("hello"); // foo.A should be ok but foo.bar should be error
@@ -28,6 +28,7 @@ class C2 {
}
//// [aliasUsage1_backbone.js]
"use strict";
var Model = (function () {
function Model() {
}
@@ -35,6 +36,7 @@ var Model = (function () {
})();
exports.Model = Model;
//// [aliasUsage1_moduleA.js]
"use strict";
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; }
@@ -50,6 +52,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsage1_main.js]
"use strict";
var moduleA = require("./aliasUsage1_moduleA");
var C2 = (function () {
function C2() {
@@ -22,6 +22,7 @@ var xs: IHasVisualizationModel[] = [moduleA];
var xs2: typeof moduleA[] = [moduleA];
//// [aliasUsageInArray_backbone.js]
"use strict";
var Model = (function () {
function Model() {
}
@@ -29,6 +30,7 @@ var Model = (function () {
})();
exports.Model = Model;
//// [aliasUsageInArray_moduleA.js]
"use strict";
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; }
@@ -44,6 +46,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInArray_main.js]
"use strict";
var moduleA = require("./aliasUsageInArray_moduleA");
var xs = [moduleA];
var xs2 = [moduleA];
@@ -21,6 +21,7 @@ var f = (x: IHasVisualizationModel) => x;
f = (x) => moduleA;
//// [aliasUsageInFunctionExpression_backbone.js]
"use strict";
var Model = (function () {
function Model() {
}
@@ -28,6 +29,7 @@ var Model = (function () {
})();
exports.Model = Model;
//// [aliasUsageInFunctionExpression_moduleA.js]
"use strict";
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; }
@@ -43,6 +45,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInFunctionExpression_main.js]
"use strict";
var moduleA = require("./aliasUsageInFunctionExpression_moduleA");
var f = function (x) { return x; };
f = function (x) { return moduleA; };
@@ -25,6 +25,7 @@ var r2 = foo({ a: <IHasVisualizationModel>null });
//// [aliasUsageInGenericFunction_backbone.js]
"use strict";
var Model = (function () {
function Model() {
}
@@ -32,6 +33,7 @@ var Model = (function () {
})();
exports.Model = Model;
//// [aliasUsageInGenericFunction_moduleA.js]
"use strict";
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; }
@@ -47,6 +49,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInGenericFunction_main.js]
"use strict";
var moduleA = require("./aliasUsageInGenericFunction_moduleA");
function foo(x) {
return x;
@@ -27,6 +27,7 @@ class N2 {
}
//// [aliasUsageInIndexerOfClass_backbone.js]
"use strict";
var Model = (function () {
function Model() {
}
@@ -34,6 +35,7 @@ var Model = (function () {
})();
exports.Model = Model;
//// [aliasUsageInIndexerOfClass_moduleA.js]
"use strict";
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; }
@@ -49,6 +51,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInIndexerOfClass_main.js]
"use strict";
var moduleA = require("./aliasUsageInIndexerOfClass_moduleA");
var N = (function () {
function N() {
@@ -22,6 +22,7 @@ var b: { x: IHasVisualizationModel } = { x: moduleA };
var c: { y: { z: IHasVisualizationModel } } = { y: { z: moduleA } };
//// [aliasUsageInObjectLiteral_backbone.js]
"use strict";
var Model = (function () {
function Model() {
}
@@ -29,6 +30,7 @@ var Model = (function () {
})();
exports.Model = Model;
//// [aliasUsageInObjectLiteral_moduleA.js]
"use strict";
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; }
@@ -44,6 +46,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInObjectLiteral_main.js]
"use strict";
var moduleA = require("./aliasUsageInObjectLiteral_moduleA");
var a = { x: moduleA };
var b = { x: moduleA };
@@ -25,6 +25,7 @@ var e: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null || {
var f: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null ? { x: moduleA } : null;
//// [aliasUsageInOrExpression_backbone.js]
"use strict";
var Model = (function () {
function Model() {
}
@@ -32,6 +33,7 @@ var Model = (function () {
})();
exports.Model = Model;
//// [aliasUsageInOrExpression_moduleA.js]
"use strict";
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; }
@@ -47,6 +49,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInOrExpression_main.js]
"use strict";
var moduleA = require("./aliasUsageInOrExpression_moduleA");
var i;
var d1 = i || moduleA;
@@ -25,6 +25,7 @@ class D extends C<IHasVisualizationModel> {
}
//// [aliasUsageInTypeArgumentOfExtendsClause_backbone.js]
"use strict";
var Model = (function () {
function Model() {
}
@@ -32,6 +33,7 @@ var Model = (function () {
})();
exports.Model = Model;
//// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.js]
"use strict";
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; }
@@ -47,6 +49,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInTypeArgumentOfExtendsClause_main.js]
"use strict";
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; }
@@ -21,6 +21,7 @@ var i: IHasVisualizationModel;
var m: typeof moduleA = i;
//// [aliasUsageInVarAssignment_backbone.js]
"use strict";
var Model = (function () {
function Model() {
}
@@ -28,6 +29,7 @@ var Model = (function () {
})();
exports.Model = Model;
//// [aliasUsageInVarAssignment_moduleA.js]
"use strict";
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; }
@@ -43,5 +45,6 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInVarAssignment_main.js]
"use strict";
var i;
var m = i;
@@ -19,10 +19,13 @@ export var a = function () {
//// [aliasUsedAsNameValue_0.js]
"use strict";
//// [aliasUsedAsNameValue_1.js]
"use strict";
function b(a) { return null; }
exports.b = b;
//// [aliasUsedAsNameValue_2.js]
"use strict";
///<reference path='aliasUsedAsNameValue_0.ts' />
///<reference path='aliasUsedAsNameValue_1.ts' />
var mod = require("./aliasUsedAsNameValue_0");
@@ -11,5 +11,7 @@ import moduleA = require("./aliasWithInterfaceExportAssignmentUsedInVarInitializ
var d = b.q3;
//// [aliasWithInterfaceExportAssignmentUsedInVarInitializer_0.js]
"use strict";
//// [aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.js]
"use strict";
var d = b.q3;
@@ -18,6 +18,7 @@ module M {
//// [aliasesInSystemModule1.js]
System.register(['foo'], function(exports_1) {
"use strict";
var alias;
var cls, cls2, x, y, z, M;
return {
@@ -17,6 +17,7 @@ module M {
//// [aliasesInSystemModule2.js]
System.register(["foo"], function(exports_1) {
"use strict";
var foo_1;
var cls, cls2, x, y, z, M;
return {
@@ -27,6 +27,7 @@ var n: number;
//// [decls.js]
// Ambient external import declaration referencing ambient external module using top level module name
//// [consumer.js]
"use strict";
// Ambient external module members are always exported with or without export keyword when module lacks export assignment
var imp3 = require('equ2');
var n = imp3.x;
@@ -13,6 +13,7 @@ var x = ext;
//// [ambientExternalModuleInAnotherExternalModule.js]
define(["require", "exports", "ext"], function (require, exports, ext) {
"use strict";
var D = (function () {
function D() {
}
@@ -3,4 +3,5 @@ export declare module "M" { }
//// [ambientExternalModuleInsideNonAmbientExternalModule.js]
define(["require", "exports"], function (require, exports) {
"use strict";
});
@@ -18,6 +18,7 @@ declare module "M" {
//// [ambientExternalModuleMerging_use.js]
define(["require", "exports", "M"], function (require, exports, M) {
"use strict";
// Should be strings
var x = M.x;
var y = M.y;
@@ -21,5 +21,6 @@ var c = new A();
//// [ambientExternalModuleWithInternalImportDeclaration_0.js]
//// [ambientExternalModuleWithInternalImportDeclaration_1.js]
define(["require", "exports", 'M'], function (require, exports, A) {
"use strict";
var c = new A();
});
@@ -20,5 +20,6 @@ var c = new A();
//// [ambientExternalModuleWithoutInternalImportDeclaration_0.js]
//// [ambientExternalModuleWithoutInternalImportDeclaration_1.js]
define(["require", "exports", 'M'], function (require, exports, A) {
"use strict";
var c = new A();
});
@@ -7,4 +7,5 @@ export declare module M { }
//// [ambientInsideNonAmbientExternalModule.js]
define(["require", "exports"], function (require, exports) {
"use strict";
});
@@ -6,5 +6,6 @@ m1.f();
//// [amdDependencyComment1.js]
///<amd-dependency path='bar'/>
"use strict";
var m1 = require("m2");
m1.f();
@@ -7,5 +7,6 @@ m1.f();
//// [amdDependencyComment2.js]
///<amd-dependency path='bar'/>
define(["require", "exports", "m2", "bar"], function (require, exports, m1) {
"use strict";
m1.f();
});
@@ -6,5 +6,6 @@ m1.f();
//// [amdDependencyCommentName1.js]
///<amd-dependency path='bar' name='b'/>
"use strict";
var m1 = require("m2");
m1.f();
@@ -7,5 +7,6 @@ m1.f();
//// [amdDependencyCommentName2.js]
///<amd-dependency path='bar' name='b'/>
define(["require", "exports", "bar", "m2"], function (require, exports, b, m1) {
"use strict";
m1.f();
});
@@ -11,5 +11,6 @@ m1.f();
///<amd-dependency path='foo'/>
///<amd-dependency path='goo' name='c'/>
define(["require", "exports", "bar", "goo", "m2", "foo"], function (require, exports, b, c, m1) {
"use strict";
m1.f();
});
@@ -26,6 +26,7 @@ import "unaliasedModule2";
///<amd-dependency path='aliasedModule6' name='n2'/>
///<amd-dependency path='unaliasedModule4'/>
define(["require", "exports", "aliasedModule5", "aliasedModule6", "aliasedModule1", "aliasedModule2", "aliasedModule3", "aliasedModule4", "unaliasedModule3", "unaliasedModule4", "unaliasedModule1", "unaliasedModule2"], function (require, exports, n1, n2, r1, aliasedModule2_1, aliasedModule3_1, ns) {
"use strict";
r1;
aliasedModule2_1.p1;
aliasedModule3_1["default"];
@@ -14,6 +14,7 @@ if(foo.E1.A === 0){
//// [foo_0.js]
define(["require", "exports"], function (require, exports) {
"use strict";
(function (E1) {
E1[E1["A"] = 0] = "A";
E1[E1["B"] = 1] = "B";
@@ -23,6 +24,7 @@ define(["require", "exports"], function (require, exports) {
});
//// [foo_1.js]
define(["require", "exports", "./foo_0"], function (require, exports, foo) {
"use strict";
if (foo.E1.A === 0) {
}
});
@@ -33,6 +33,7 @@ var e: number = <foo.E1>0;
//// [foo_0.js]
define(["require", "exports"], function (require, exports) {
"use strict";
var C1 = (function () {
function C1() {
this.m1 = 42;
@@ -50,6 +51,7 @@ define(["require", "exports"], function (require, exports) {
});
//// [foo_1.js]
define(["require", "exports"], function (require, exports) {
"use strict";
var i;
var x = {};
var y = false;
@@ -11,6 +11,7 @@ export = Foo;
//// [amdModuleName1.js]
define("NamedModule", ["require", "exports"], function (require, exports) {
"use strict";
///<amd-module name='NamedModule'/>
var Foo = (function () {
function Foo() {
@@ -12,6 +12,7 @@ export = Foo;
//// [amdModuleName2.js]
define("SecondModuleName", ["require", "exports"], function (require, exports) {
"use strict";
///<amd-module name='FirstModuleName'/>
///<amd-module name='SecondModuleName'/>
var Foo = (function () {
@@ -25,6 +25,7 @@ export = Road;
//// [arrayOfExportedClass_0.js]
"use strict";
var Car = (function () {
function Car() {
}
@@ -32,6 +33,7 @@ var Car = (function () {
})();
module.exports = Car;
//// [arrayOfExportedClass_1.js]
"use strict";
var Road = (function () {
function Road() {
}
+2
View File
@@ -13,9 +13,11 @@ import { foo } from './foo';
//// [foo.js]
"use strict";
function foo() { }
exports.foo = foo;
//// [bar.js]
"use strict";
var foo_1 = require('./foo');
// These should emit identically
foo_1.foo;
@@ -5,6 +5,7 @@ module c5 { } // should be ok everywhere
//// [augmentedTypesExternalModule1.js]
define(["require", "exports"], function (require, exports) {
"use strict";
exports.a = 1;
var c5 = (function () {
function c5() {
@@ -8,4 +8,5 @@ export declare var a: {
//// [badExternalModuleReference.js]
define(["require", "exports"], function (require, exports) {
"use strict";
});
@@ -0,0 +1,24 @@
//// [tests/cases/compiler/bangInModuleName.ts] ////
//// [a.d.ts]
declare module "http" {
}
declare module 'intern/dojo/node!http' {
import http = require('http');
export = http;
}
//// [a.ts]
/// <reference path="a.d.ts"/>
import * as http from 'intern/dojo/node!http';
//// [a.js]
/// <reference path="a.d.ts"/>
define(["require", "exports"], function (require, exports) {
"use strict";
});
@@ -0,0 +1,21 @@
=== tests/cases/compiler/a.ts ===
/// <reference path="a.d.ts"/>
import * as http from 'intern/dojo/node!http';
>http : Symbol(http, Decl(a.ts, 3, 6))
=== tests/cases/compiler/a.d.ts ===
declare module "http" {
}
declare module 'intern/dojo/node!http' {
import http = require('http');
>http : Symbol(http, Decl(a.d.ts, 5, 40))
export = http;
>http : Symbol(http, Decl(a.d.ts, 5, 40))
}
@@ -0,0 +1,21 @@
=== tests/cases/compiler/a.ts ===
/// <reference path="a.d.ts"/>
import * as http from 'intern/dojo/node!http';
>http : typeof http
=== tests/cases/compiler/a.d.ts ===
declare module "http" {
}
declare module 'intern/dojo/node!http' {
import http = require('http');
>http : typeof http
export = http;
>http : typeof http
}
@@ -0,0 +1,124 @@
//// [capturedLetConstInLoop10.ts]
class A {
foo() {
for (let x of [0]) {
let f = function() { return x; };
this.bar(f());
}
}
bar(a: number) {
}
baz() {
for (let x of [1]) {
let a = function() { return x; };
for (let y of [1]) {
let b = function() { return y; };
this.bar(b());
}
this.bar(a());
}
}
baz2() {
for (let x of [1]) {
let a = function() { return x; };
this.bar(a());
for (let y of [1]) {
let b = function() { return y; };
this.bar(b());
}
}
}
}
class B {
foo() {
let a =
() => {
for (let x of [0]) {
let f = () => x;
this.bar(f());
}
}
}
bar(a: number) {
}
}
//// [capturedLetConstInLoop10.js]
var A = (function () {
function A() {
}
A.prototype.foo = function () {
var _loop_1 = function(x) {
var f = function () { return x; };
this_1.bar(f());
};
var this_1 = this;
for (var _i = 0, _a = [0]; _i < _a.length; _i++) {
var x = _a[_i];
_loop_1(x);
}
};
A.prototype.bar = function (a) {
};
A.prototype.baz = function () {
var _loop_2 = function(x) {
var a = function () { return x; };
var _loop_3 = function(y) {
var b = function () { return y; };
this_2.bar(b());
};
for (var _i = 0, _a = [1]; _i < _a.length; _i++) {
var y = _a[_i];
_loop_3(y);
}
this_2.bar(a());
};
var this_2 = this;
for (var _b = 0, _c = [1]; _b < _c.length; _b++) {
var x = _c[_b];
_loop_2(x);
}
};
A.prototype.baz2 = function () {
var _loop_4 = function(x) {
var a = function () { return x; };
this_3.bar(a());
var _loop_5 = function(y) {
var b = function () { return y; };
this_3.bar(b());
};
for (var _i = 0, _a = [1]; _i < _a.length; _i++) {
var y = _a[_i];
_loop_5(y);
}
};
var this_3 = this;
for (var _b = 0, _c = [1]; _b < _c.length; _b++) {
var x = _c[_b];
_loop_4(x);
}
};
return A;
})();
var B = (function () {
function B() {
}
B.prototype.foo = function () {
var _this = this;
var a = function () {
var _loop_6 = function(x) {
var f = function () { return x; };
_this.bar(f());
};
for (var _i = 0, _a = [0]; _i < _a.length; _i++) {
var x = _a[_i];
_loop_6(x);
}
};
};
B.prototype.bar = function (a) {
};
return B;
})();
@@ -0,0 +1,119 @@
=== tests/cases/compiler/capturedLetConstInLoop10.ts ===
class A {
>A : Symbol(A, Decl(capturedLetConstInLoop10.ts, 0, 0))
foo() {
>foo : Symbol(foo, Decl(capturedLetConstInLoop10.ts, 0, 9))
for (let x of [0]) {
>x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 2, 16))
let f = function() { return x; };
>f : Symbol(f, Decl(capturedLetConstInLoop10.ts, 3, 15))
>x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 2, 16))
this.bar(f());
>this.bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5))
>this : Symbol(A, Decl(capturedLetConstInLoop10.ts, 0, 0))
>bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5))
>f : Symbol(f, Decl(capturedLetConstInLoop10.ts, 3, 15))
}
}
bar(a: number) {
>bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5))
>a : Symbol(a, Decl(capturedLetConstInLoop10.ts, 7, 8))
}
baz() {
>baz : Symbol(baz, Decl(capturedLetConstInLoop10.ts, 8, 5))
for (let x of [1]) {
>x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 11, 16))
let a = function() { return x; };
>a : Symbol(a, Decl(capturedLetConstInLoop10.ts, 12, 15))
>x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 11, 16))
for (let y of [1]) {
>y : Symbol(y, Decl(capturedLetConstInLoop10.ts, 13, 20))
let b = function() { return y; };
>b : Symbol(b, Decl(capturedLetConstInLoop10.ts, 14, 19))
>y : Symbol(y, Decl(capturedLetConstInLoop10.ts, 13, 20))
this.bar(b());
>this.bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5))
>this : Symbol(A, Decl(capturedLetConstInLoop10.ts, 0, 0))
>bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5))
>b : Symbol(b, Decl(capturedLetConstInLoop10.ts, 14, 19))
}
this.bar(a());
>this.bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5))
>this : Symbol(A, Decl(capturedLetConstInLoop10.ts, 0, 0))
>bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5))
>a : Symbol(a, Decl(capturedLetConstInLoop10.ts, 12, 15))
}
}
baz2() {
>baz2 : Symbol(baz2, Decl(capturedLetConstInLoop10.ts, 19, 5))
for (let x of [1]) {
>x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 21, 16))
let a = function() { return x; };
>a : Symbol(a, Decl(capturedLetConstInLoop10.ts, 22, 15))
>x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 21, 16))
this.bar(a());
>this.bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5))
>this : Symbol(A, Decl(capturedLetConstInLoop10.ts, 0, 0))
>bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5))
>a : Symbol(a, Decl(capturedLetConstInLoop10.ts, 22, 15))
for (let y of [1]) {
>y : Symbol(y, Decl(capturedLetConstInLoop10.ts, 24, 20))
let b = function() { return y; };
>b : Symbol(b, Decl(capturedLetConstInLoop10.ts, 25, 19))
>y : Symbol(y, Decl(capturedLetConstInLoop10.ts, 24, 20))
this.bar(b());
>this.bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5))
>this : Symbol(A, Decl(capturedLetConstInLoop10.ts, 0, 0))
>bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5))
>b : Symbol(b, Decl(capturedLetConstInLoop10.ts, 25, 19))
}
}
}
}
class B {
>B : Symbol(B, Decl(capturedLetConstInLoop10.ts, 30, 1))
foo() {
>foo : Symbol(foo, Decl(capturedLetConstInLoop10.ts, 32, 9))
let a =
>a : Symbol(a, Decl(capturedLetConstInLoop10.ts, 34, 11))
() => {
for (let x of [0]) {
>x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 36, 24))
let f = () => x;
>f : Symbol(f, Decl(capturedLetConstInLoop10.ts, 37, 23))
>x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 36, 24))
this.bar(f());
>this.bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 41, 5))
>this : Symbol(B, Decl(capturedLetConstInLoop10.ts, 30, 1))
>bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 41, 5))
>f : Symbol(f, Decl(capturedLetConstInLoop10.ts, 37, 23))
}
}
}
bar(a: number) {
>bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 41, 5))
>a : Symbol(a, Decl(capturedLetConstInLoop10.ts, 42, 8))
}
}
@@ -0,0 +1,151 @@
=== tests/cases/compiler/capturedLetConstInLoop10.ts ===
class A {
>A : A
foo() {
>foo : () => void
for (let x of [0]) {
>x : number
>[0] : number[]
>0 : number
let f = function() { return x; };
>f : () => number
>function() { return x; } : () => number
>x : number
this.bar(f());
>this.bar(f()) : void
>this.bar : (a: number) => void
>this : this
>bar : (a: number) => void
>f() : number
>f : () => number
}
}
bar(a: number) {
>bar : (a: number) => void
>a : number
}
baz() {
>baz : () => void
for (let x of [1]) {
>x : number
>[1] : number[]
>1 : number
let a = function() { return x; };
>a : () => number
>function() { return x; } : () => number
>x : number
for (let y of [1]) {
>y : number
>[1] : number[]
>1 : number
let b = function() { return y; };
>b : () => number
>function() { return y; } : () => number
>y : number
this.bar(b());
>this.bar(b()) : void
>this.bar : (a: number) => void
>this : this
>bar : (a: number) => void
>b() : number
>b : () => number
}
this.bar(a());
>this.bar(a()) : void
>this.bar : (a: number) => void
>this : this
>bar : (a: number) => void
>a() : number
>a : () => number
}
}
baz2() {
>baz2 : () => void
for (let x of [1]) {
>x : number
>[1] : number[]
>1 : number
let a = function() { return x; };
>a : () => number
>function() { return x; } : () => number
>x : number
this.bar(a());
>this.bar(a()) : void
>this.bar : (a: number) => void
>this : this
>bar : (a: number) => void
>a() : number
>a : () => number
for (let y of [1]) {
>y : number
>[1] : number[]
>1 : number
let b = function() { return y; };
>b : () => number
>function() { return y; } : () => number
>y : number
this.bar(b());
>this.bar(b()) : void
>this.bar : (a: number) => void
>this : this
>bar : (a: number) => void
>b() : number
>b : () => number
}
}
}
}
class B {
>B : B
foo() {
>foo : () => void
let a =
>a : () => void
() => {
>() => { for (let x of [0]) { let f = () => x; this.bar(f()); } } : () => void
for (let x of [0]) {
>x : number
>[0] : number[]
>0 : number
let f = () => x;
>f : () => number
>() => x : () => number
>x : number
this.bar(f());
>this.bar(f()) : void
>this.bar : (a: number) => void
>this : this
>bar : (a: number) => void
>f() : number
>f : () => number
}
}
}
bar(a: number) {
>bar : (a: number) => void
>a : number
}
}
@@ -0,0 +1,90 @@
//// [capturedLetConstInLoop10_ES6.ts]
class A {
foo() {
for (let x of [0]) {
let f = function() { return x; };
this.bar(f());
}
}
bar(a: number) {
}
baz() {
for (let x of [1]) {
let a = function() { return x; };
for (let y of [1]) {
let b = function() { return y; };
this.bar(b());
}
this.bar(a());
}
}
baz2() {
for (let x of [1]) {
let a = function() { return x; };
this.bar(a());
for (let y of [1]) {
let b = function() { return y; };
this.bar(b());
}
}
}
}
class B {
foo() {
let a =
() => {
for (let x of [0]) {
let f = () => x;
this.bar(f());
}
}
}
bar(a: number) {
}
}
//// [capturedLetConstInLoop10_ES6.js]
class A {
foo() {
for (let x of [0]) {
let f = function () { return x; };
this.bar(f());
}
}
bar(a) {
}
baz() {
for (let x of [1]) {
let a = function () { return x; };
for (let y of [1]) {
let b = function () { return y; };
this.bar(b());
}
this.bar(a());
}
}
baz2() {
for (let x of [1]) {
let a = function () { return x; };
this.bar(a());
for (let y of [1]) {
let b = function () { return y; };
this.bar(b());
}
}
}
}
class B {
foo() {
let a = () => {
for (let x of [0]) {
let f = () => x;
this.bar(f());
}
};
}
bar(a) {
}
}
@@ -0,0 +1,119 @@
=== tests/cases/compiler/capturedLetConstInLoop10_ES6.ts ===
class A {
>A : Symbol(A, Decl(capturedLetConstInLoop10_ES6.ts, 0, 0))
foo() {
>foo : Symbol(foo, Decl(capturedLetConstInLoop10_ES6.ts, 0, 9))
for (let x of [0]) {
>x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 2, 16))
let f = function() { return x; };
>f : Symbol(f, Decl(capturedLetConstInLoop10_ES6.ts, 3, 15))
>x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 2, 16))
this.bar(f());
>this.bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5))
>this : Symbol(A, Decl(capturedLetConstInLoop10_ES6.ts, 0, 0))
>bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5))
>f : Symbol(f, Decl(capturedLetConstInLoop10_ES6.ts, 3, 15))
}
}
bar(a: number) {
>bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5))
>a : Symbol(a, Decl(capturedLetConstInLoop10_ES6.ts, 7, 8))
}
baz() {
>baz : Symbol(baz, Decl(capturedLetConstInLoop10_ES6.ts, 8, 5))
for (let x of [1]) {
>x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 11, 16))
let a = function() { return x; };
>a : Symbol(a, Decl(capturedLetConstInLoop10_ES6.ts, 12, 15))
>x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 11, 16))
for (let y of [1]) {
>y : Symbol(y, Decl(capturedLetConstInLoop10_ES6.ts, 13, 20))
let b = function() { return y; };
>b : Symbol(b, Decl(capturedLetConstInLoop10_ES6.ts, 14, 19))
>y : Symbol(y, Decl(capturedLetConstInLoop10_ES6.ts, 13, 20))
this.bar(b());
>this.bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5))
>this : Symbol(A, Decl(capturedLetConstInLoop10_ES6.ts, 0, 0))
>bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5))
>b : Symbol(b, Decl(capturedLetConstInLoop10_ES6.ts, 14, 19))
}
this.bar(a());
>this.bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5))
>this : Symbol(A, Decl(capturedLetConstInLoop10_ES6.ts, 0, 0))
>bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5))
>a : Symbol(a, Decl(capturedLetConstInLoop10_ES6.ts, 12, 15))
}
}
baz2() {
>baz2 : Symbol(baz2, Decl(capturedLetConstInLoop10_ES6.ts, 19, 5))
for (let x of [1]) {
>x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 21, 16))
let a = function() { return x; };
>a : Symbol(a, Decl(capturedLetConstInLoop10_ES6.ts, 22, 15))
>x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 21, 16))
this.bar(a());
>this.bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5))
>this : Symbol(A, Decl(capturedLetConstInLoop10_ES6.ts, 0, 0))
>bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5))
>a : Symbol(a, Decl(capturedLetConstInLoop10_ES6.ts, 22, 15))
for (let y of [1]) {
>y : Symbol(y, Decl(capturedLetConstInLoop10_ES6.ts, 24, 20))
let b = function() { return y; };
>b : Symbol(b, Decl(capturedLetConstInLoop10_ES6.ts, 25, 19))
>y : Symbol(y, Decl(capturedLetConstInLoop10_ES6.ts, 24, 20))
this.bar(b());
>this.bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5))
>this : Symbol(A, Decl(capturedLetConstInLoop10_ES6.ts, 0, 0))
>bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5))
>b : Symbol(b, Decl(capturedLetConstInLoop10_ES6.ts, 25, 19))
}
}
}
}
class B {
>B : Symbol(B, Decl(capturedLetConstInLoop10_ES6.ts, 30, 1))
foo() {
>foo : Symbol(foo, Decl(capturedLetConstInLoop10_ES6.ts, 32, 9))
let a =
>a : Symbol(a, Decl(capturedLetConstInLoop10_ES6.ts, 34, 11))
() => {
for (let x of [0]) {
>x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 36, 24))
let f = () => x;
>f : Symbol(f, Decl(capturedLetConstInLoop10_ES6.ts, 37, 23))
>x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 36, 24))
this.bar(f());
>this.bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 41, 5))
>this : Symbol(B, Decl(capturedLetConstInLoop10_ES6.ts, 30, 1))
>bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 41, 5))
>f : Symbol(f, Decl(capturedLetConstInLoop10_ES6.ts, 37, 23))
}
}
}
bar(a: number) {
>bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 41, 5))
>a : Symbol(a, Decl(capturedLetConstInLoop10_ES6.ts, 42, 8))
}
}
@@ -0,0 +1,151 @@
=== tests/cases/compiler/capturedLetConstInLoop10_ES6.ts ===
class A {
>A : A
foo() {
>foo : () => void
for (let x of [0]) {
>x : number
>[0] : number[]
>0 : number
let f = function() { return x; };
>f : () => number
>function() { return x; } : () => number
>x : number
this.bar(f());
>this.bar(f()) : void
>this.bar : (a: number) => void
>this : this
>bar : (a: number) => void
>f() : number
>f : () => number
}
}
bar(a: number) {
>bar : (a: number) => void
>a : number
}
baz() {
>baz : () => void
for (let x of [1]) {
>x : number
>[1] : number[]
>1 : number
let a = function() { return x; };
>a : () => number
>function() { return x; } : () => number
>x : number
for (let y of [1]) {
>y : number
>[1] : number[]
>1 : number
let b = function() { return y; };
>b : () => number
>function() { return y; } : () => number
>y : number
this.bar(b());
>this.bar(b()) : void
>this.bar : (a: number) => void
>this : this
>bar : (a: number) => void
>b() : number
>b : () => number
}
this.bar(a());
>this.bar(a()) : void
>this.bar : (a: number) => void
>this : this
>bar : (a: number) => void
>a() : number
>a : () => number
}
}
baz2() {
>baz2 : () => void
for (let x of [1]) {
>x : number
>[1] : number[]
>1 : number
let a = function() { return x; };
>a : () => number
>function() { return x; } : () => number
>x : number
this.bar(a());
>this.bar(a()) : void
>this.bar : (a: number) => void
>this : this
>bar : (a: number) => void
>a() : number
>a : () => number
for (let y of [1]) {
>y : number
>[1] : number[]
>1 : number
let b = function() { return y; };
>b : () => number
>function() { return y; } : () => number
>y : number
this.bar(b());
>this.bar(b()) : void
>this.bar : (a: number) => void
>this : this
>bar : (a: number) => void
>b() : number
>b : () => number
}
}
}
}
class B {
>B : B
foo() {
>foo : () => void
let a =
>a : () => void
() => {
>() => { for (let x of [0]) { let f = () => x; this.bar(f()); } } : () => void
for (let x of [0]) {
>x : number
>[0] : number[]
>0 : number
let f = () => x;
>f : () => number
>() => x : () => number
>x : number
this.bar(f());
>this.bar(f()) : void
>this.bar : (a: number) => void
>this : this
>bar : (a: number) => void
>f() : number
>f : () => number
}
}
}
bar(a: number) {
>bar : (a: number) => void
>a : number
}
}
@@ -145,6 +145,7 @@ for (const y = 0; y < 1;) {
//// [capturedLetConstInLoop4.js]
System.register([], function(exports_1) {
"use strict";
var v0, v00, v1, v2, v3, v4, v5, v6, v7, v8, v0_c, v00_c, v1_c, v2_c, v3_c, v4_c, v5_c, v6_c, v7_c, v8_c;
//======let
function exportedFoo() {
@@ -12,12 +12,14 @@ y.m.foo();
//// [chainedImportAlias_file0.js]
"use strict";
var m;
(function (m) {
function foo() { }
m.foo = foo;
})(m = exports.m || (exports.m = {}));
//// [chainedImportAlias_file1.js]
"use strict";
var x = require('./chainedImportAlias_file0');
var y = x;
y.m.foo();
@@ -34,6 +34,7 @@ export module M1 {
//// [foo1.js]
"use strict";
var foo2 = require('./foo2');
var M1;
(function (M1) {
@@ -48,6 +49,7 @@ var M1;
M1.C1 = C1;
})(M1 = exports.M1 || (exports.M1 = {}));
//// [foo2.js]
"use strict";
var foo1 = require('./foo1');
var M1;
(function (M1) {
@@ -5,6 +5,7 @@ default abstract class C {}
import abstract class D {}
//// [classAbstractManyKeywords.js]
"use strict";
var A = (function () {
function A() {
}
@@ -20,6 +20,7 @@ export class Test1 {
//// [classMemberInitializerWithLamdaScoping3_0.js]
var field1;
//// [classMemberInitializerWithLamdaScoping3_1.js]
"use strict";
var Test1 = (function () {
function Test1(field1) {
this.field1 = field1;
@@ -16,7 +16,9 @@ export class Test1 {
}
//// [classMemberInitializerWithLamdaScoping3_0.js]
"use strict";
//// [classMemberInitializerWithLamdaScoping3_1.js]
"use strict";
var Test1 = (function () {
function Test1(field1) {
this.field1 = field1;
@@ -26,6 +26,7 @@ export = Foo;
//// [clinterfaces.js]
"use strict";
var M;
(function (M) {
var C = (function () {
@@ -19,18 +19,21 @@ export function foo2() {
//// [collisionExportsRequireAndAlias_file1.js]
define(["require", "exports"], function (require, exports) {
"use strict";
function bar() {
}
exports.bar = bar;
});
//// [collisionExportsRequireAndAlias_file3333.js]
define(["require", "exports"], function (require, exports) {
"use strict";
function bar2() {
}
exports.bar2 = bar2;
});
//// [collisionExportsRequireAndAlias_file2.js]
define(["require", "exports", 'collisionExportsRequireAndAlias_file1', 'collisionExportsRequireAndAlias_file3333'], function (require, exports, require, exports) {
"use strict";
function foo() {
require.bar();
}
@@ -39,6 +39,7 @@ module m4 {
//// [collisionExportsRequireAndAmbientClass_externalmodule.js]
define(["require", "exports"], function (require, exports) {
"use strict";
var m2;
(function (m2) {
})(m2 || (m2 = {}));
@@ -62,6 +62,7 @@ module m4 {
//// [collisionExportsRequireAndAmbientEnum_externalmodule.js]
define(["require", "exports"], function (require, exports) {
"use strict";
var m2;
(function (m2) {
})(m2 || (m2 = {}));
@@ -15,6 +15,7 @@ module m2 {
//// [collisionExportsRequireAndAmbientFunction.js]
define(["require", "exports"], function (require, exports) {
"use strict";
var m2;
(function (m2) {
var a = 10;
@@ -96,6 +96,7 @@ module m4 {
//// [collisionExportsRequireAndAmbientModule_externalmodule.js]
define(["require", "exports"], function (require, exports) {
"use strict";
function foo() {
return null;
}
@@ -28,6 +28,7 @@ module m4 {
//// [collisionExportsRequireAndAmbientVar_externalmodule.js]
define(["require", "exports"], function (require, exports) {
"use strict";
var m2;
(function (m2) {
var a = 10;
@@ -38,6 +38,7 @@ module m4 {
//// [collisionExportsRequireAndClass_externalmodule.js]
define(["require", "exports"], function (require, exports) {
"use strict";
var require = (function () {
function require() {
}
@@ -62,6 +62,7 @@ module m4 {
//// [collisionExportsRequireAndEnum_externalmodule.js]
define(["require", "exports"], function (require, exports) {
"use strict";
(function (require) {
require[require["_thisVal1"] = 0] = "_thisVal1";
require[require["_thisVal2"] = 1] = "_thisVal2";
@@ -24,6 +24,7 @@ module m2 {
//// [collisionExportsRequireAndFunction.js]
define(["require", "exports"], function (require, exports) {
"use strict";
function exports() {
return 1;
}
@@ -24,6 +24,7 @@ module m2 {
//// [collisionExportsRequireAndInternalModuleAlias.js]
define(["require", "exports"], function (require, exports) {
"use strict";
var m;
(function (m) {
var c = (function () {
@@ -93,6 +93,7 @@ module m4 {
//// [collisionExportsRequireAndModule_externalmodule.js]
define(["require", "exports"], function (require, exports) {
"use strict";
var require;
(function (require) {
var C = (function () {
@@ -16,6 +16,7 @@ export function foo2(): exports.I {
//// [collisionExportsRequireAndUninstantiatedModule.js]
define(["require", "exports"], function (require, exports) {
"use strict";
function foo() {
return null;
}
@@ -28,6 +28,7 @@ module m4 {
//// [collisionExportsRequireAndVar_externalmodule.js]
define(["require", "exports"], function (require, exports) {
"use strict";
function foo() {
}
exports.foo = foo;
@@ -7,4 +7,5 @@ import foo = require('./foo');
//// [commentOnImportStatement1.js]
/* Copyright */
define(["require", "exports"], function (require, exports) {
"use strict";
});
@@ -3,3 +3,4 @@
import foo = require('./foo');
//// [commentOnImportStatement2.js]
"use strict";
@@ -6,3 +6,4 @@ import foo = require('./foo');
//// [commentOnImportStatement3.js]
/* copyright */
"use strict";
@@ -5,4 +5,5 @@ export var b: number;
//// [commentsBeforeVariableStatement1.js]
define(["require", "exports"], function (require, exports) {
"use strict";
});
@@ -9,6 +9,7 @@ export module outerModule.InnerModule {
//// [commentsDottedModuleName.js]
define(["require", "exports"], function (require, exports) {
"use strict";
/** this is multi declare module*/
var outerModule;
(function (outerModule) {
@@ -63,6 +63,7 @@ var newVar2 = new extMod.m4.m2.c();
//// [commentsExternalModules_0.js]
define(["require", "exports"], function (require, exports) {
"use strict";
/** Module comment*/
var m1;
(function (m1) {
@@ -126,6 +127,7 @@ define(["require", "exports"], function (require, exports) {
});
//// [commentsExternalModules_1.js]
define(["require", "exports", "commentsExternalModules_0"], function (require, exports, extMod) {
"use strict";
extMod.m1.fooExport();
var newVar = new extMod.m1.m2.c();
extMod.m4.fooExport();
@@ -63,6 +63,7 @@ export var newVar2 = new extMod.m4.m2.c();
//// [commentsExternalModules2_0.js]
define(["require", "exports"], function (require, exports) {
"use strict";
/** Module comment*/
var m1;
(function (m1) {
@@ -126,6 +127,7 @@ define(["require", "exports"], function (require, exports) {
});
//// [commentsExternalModules_1.js]
define(["require", "exports", "commentsExternalModules2_0"], function (require, exports, extMod) {
"use strict";
extMod.m1.fooExport();
exports.newVar = new extMod.m1.m2.c();
extMod.m4.fooExport();
@@ -62,6 +62,7 @@ export var newVar2 = new extMod.m4.m2.c();
//// [commentsExternalModules2_0.js]
"use strict";
/** Module comment*/
var m1;
(function (m1) {
@@ -123,6 +124,7 @@ var m4;
m4.fooExport();
var myvar2 = new m4.m2.c();
//// [commentsExternalModules_1.js]
"use strict";
/**This is on import declaration*/
var extMod = require("./commentsExternalModules2_0"); // trailing comment 1
extMod.m1.fooExport();
@@ -38,6 +38,7 @@ new multiM.d();
//// [commentsMultiModuleMultiFile_0.js]
define(["require", "exports"], function (require, exports) {
"use strict";
/** this is multi declare module*/
var multiM;
(function (multiM) {
@@ -72,6 +73,7 @@ define(["require", "exports"], function (require, exports) {
});
//// [commentsMultiModuleMultiFile_1.js]
define(["require", "exports"], function (require, exports) {
"use strict";
/** this is multi module 3 comment*/
var multiM;
(function (multiM) {
@@ -14,6 +14,7 @@ if(foo.C1.s1){
//// [foo_0.js]
"use strict";
var C1 = (function () {
function C1() {
this.m1 = 42;
@@ -23,6 +24,7 @@ var C1 = (function () {
})();
exports.C1 = C1;
//// [foo_1.js]
"use strict";
var foo = require("./foo_0");
if (foo.C1.s1) {
}
@@ -32,6 +32,7 @@ var z: foo.M1.I2;
var e: number = <foo.E1>0;
//// [foo_0.js]
"use strict";
var C1 = (function () {
function C1() {
this.m1 = 42;
@@ -47,6 +48,7 @@ exports.C1 = C1;
})(exports.E1 || (exports.E1 = {}));
var E1 = exports.E1;
//// [foo_1.js]
"use strict";
var i;
var x = {};
var y = false;
@@ -0,0 +1,32 @@
//// [tests/cases/compiler/commonSourceDir5.ts] ////
//// [bar.ts]
import {z} from "./foo";
export var x = z + z;
//// [foo.ts]
import {pi} from "B:/baz";
export var i = Math.sqrt(-1);
export var z = pi * pi;
//// [baz.ts]
import {x} from "A:/bar";
import {i} from "A:/foo";
export var pi = Math.PI;
export var y = x * i;
//// [concat.js]
define("B:/baz", ["require", "exports", "A:/bar", "A:/foo"], function (require, exports, bar_1, foo_1) {
"use strict";
exports.pi = Math.PI;
exports.y = bar_1.x * foo_1.i;
});
define("A:/foo", ["require", "exports", "B:/baz"], function (require, exports, baz_1) {
"use strict";
exports.i = Math.sqrt(-1);
exports.z = baz_1.pi * baz_1.pi;
});
define("A:/bar", ["require", "exports", "A:/foo"], function (require, exports, foo_2) {
"use strict";
exports.x = foo_2.z + foo_2.z;
});
@@ -0,0 +1,42 @@
=== A:/bar.ts ===
import {z} from "./foo";
>z : Symbol(z, Decl(bar.ts, 0, 8))
export var x = z + z;
>x : Symbol(x, Decl(bar.ts, 1, 10))
>z : Symbol(z, Decl(bar.ts, 0, 8))
>z : Symbol(z, Decl(bar.ts, 0, 8))
=== A:/foo.ts ===
import {pi} from "B:/baz";
>pi : Symbol(pi, Decl(foo.ts, 0, 8))
export var i = Math.sqrt(-1);
>i : Symbol(i, Decl(foo.ts, 1, 10))
>Math.sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, --, --))
export var z = pi * pi;
>z : Symbol(z, Decl(foo.ts, 2, 10))
>pi : Symbol(pi, Decl(foo.ts, 0, 8))
>pi : Symbol(pi, Decl(foo.ts, 0, 8))
=== B:/baz.ts ===
import {x} from "A:/bar";
>x : Symbol(x, Decl(baz.ts, 0, 8))
import {i} from "A:/foo";
>i : Symbol(i, Decl(baz.ts, 1, 8))
export var pi = Math.PI;
>pi : Symbol(pi, Decl(baz.ts, 2, 10))
>Math.PI : Symbol(Math.PI, Decl(lib.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>PI : Symbol(Math.PI, Decl(lib.d.ts, --, --))
export var y = x * i;
>y : Symbol(y, Decl(baz.ts, 3, 10))
>x : Symbol(x, Decl(baz.ts, 0, 8))
>i : Symbol(i, Decl(baz.ts, 1, 8))
@@ -0,0 +1,48 @@
=== A:/bar.ts ===
import {z} from "./foo";
>z : number
export var x = z + z;
>x : number
>z + z : number
>z : number
>z : number
=== A:/foo.ts ===
import {pi} from "B:/baz";
>pi : number
export var i = Math.sqrt(-1);
>i : number
>Math.sqrt(-1) : number
>Math.sqrt : (x: number) => number
>Math : Math
>sqrt : (x: number) => number
>-1 : number
>1 : number
export var z = pi * pi;
>z : number
>pi * pi : number
>pi : number
>pi : number
=== B:/baz.ts ===
import {x} from "A:/bar";
>x : number
import {i} from "A:/foo";
>i : number
export var pi = Math.PI;
>pi : number
>Math.PI : number
>Math : Math
>PI : number
export var y = x * i;
>y : number
>x * i : number
>x : number
>i : number
@@ -0,0 +1,32 @@
//// [tests/cases/compiler/commonSourceDir6.ts] ////
//// [bar.ts]
import {z} from "./foo";
export var x = z + z;
//// [foo.ts]
import {pi} from "../baz";
export var i = Math.sqrt(-1);
export var z = pi * pi;
//// [baz.ts]
import {x} from "a/bar";
import {i} from "a/foo";
export var pi = Math.PI;
export var y = x * i;
//// [concat.js]
define("tests/cases/compiler/baz", ["require", "exports", "tests/cases/compiler/a/bar", "tests/cases/compiler/a/foo"], function (require, exports, bar_1, foo_1) {
"use strict";
exports.pi = Math.PI;
exports.y = bar_1.x * foo_1.i;
});
define("tests/cases/compiler/a/foo", ["require", "exports", "tests/cases/compiler/baz"], function (require, exports, baz_1) {
"use strict";
exports.i = Math.sqrt(-1);
exports.z = baz_1.pi * baz_1.pi;
});
define("tests/cases/compiler/a/bar", ["require", "exports", "tests/cases/compiler/a/foo"], function (require, exports, foo_2) {
"use strict";
exports.x = foo_2.z + foo_2.z;
});

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