mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'watchImprovements' into builder
This commit is contained in:
+2
-1
@@ -16,4 +16,5 @@ Jakefile.js
|
||||
.gitattributes
|
||||
.settings/
|
||||
.travis.yml
|
||||
.vscode/
|
||||
.vscode/
|
||||
test.config
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "2.5.0",
|
||||
"version": "2.6.0",
|
||||
"license": "Apache-2.0",
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
|
||||
+49
-46
@@ -138,6 +138,9 @@ namespace ts {
|
||||
node = getParseTreeNode(node, isExportSpecifier);
|
||||
return node ? getExportSpecifierLocalTargetSymbol(node) : undefined;
|
||||
},
|
||||
getExportSymbolOfSymbol(symbol) {
|
||||
return getMergedSymbol(symbol.exportSymbol || symbol);
|
||||
},
|
||||
getTypeAtLocation: node => {
|
||||
node = getParseTreeNode(node);
|
||||
return node ? getTypeOfNode(node) : unknownType;
|
||||
@@ -1691,7 +1694,6 @@ namespace ts {
|
||||
if (ambientModule) {
|
||||
return ambientModule;
|
||||
}
|
||||
const isRelative = isExternalModuleNameRelative(moduleReference);
|
||||
const resolvedModule = getResolvedModule(getSourceFileOfNode(location), moduleReference);
|
||||
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule);
|
||||
const sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
|
||||
@@ -1715,7 +1717,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// May be an untyped module. If so, ignore resolutionDiagnostic.
|
||||
if (!isRelative && resolvedModule && !extensionIsTypeScript(resolvedModule.extension)) {
|
||||
if (resolvedModule && resolvedModule.isExternalLibraryImport && !extensionIsTypeScript(resolvedModule.extension)) {
|
||||
if (isForAugmentation) {
|
||||
const diag = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
|
||||
error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName);
|
||||
@@ -2153,6 +2155,11 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function isTypeSymbolAccessible(typeSymbol: Symbol, enclosingDeclaration: Node): boolean {
|
||||
const access = isSymbolAccessible(typeSymbol, enclosingDeclaration, SymbolFlags.Type, /*shouldComputeAliasesToMakeVisible*/ false);
|
||||
return access.accessibility === SymbolAccessibility.Accessible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given symbol in given enclosing declaration is accessible and mark all associated alias to be visible if requested
|
||||
*
|
||||
@@ -2483,8 +2490,7 @@ namespace ts {
|
||||
// Ignore constraint/default when creating a usage (as opposed to declaration) of a type parameter.
|
||||
return createTypeReferenceNode(name, /*typeArguments*/ undefined);
|
||||
}
|
||||
if (!inTypeAlias && type.aliasSymbol &&
|
||||
isSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration, SymbolFlags.Type, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === SymbolAccessibility.Accessible) {
|
||||
if (!inTypeAlias && type.aliasSymbol && isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration)) {
|
||||
const name = symbolToTypeReferenceName(type.aliasSymbol);
|
||||
const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
|
||||
return createTypeReferenceNode(name, typeArgumentNodes);
|
||||
@@ -3251,7 +3257,7 @@ namespace ts {
|
||||
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Type, SymbolFormatFlags.None, nextFlags);
|
||||
}
|
||||
else if (!(flags & TypeFormatFlags.InTypeAlias) && type.aliasSymbol &&
|
||||
isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, SymbolFlags.Type, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === SymbolAccessibility.Accessible) {
|
||||
((flags & TypeFormatFlags.UseAliasDefinedOutsideCurrentScope) || isTypeSymbolAccessible(type.aliasSymbol, enclosingDeclaration))) {
|
||||
const typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, length(typeArguments), nextFlags);
|
||||
}
|
||||
@@ -6575,6 +6581,10 @@ namespace ts {
|
||||
return signature.resolvedReturnType;
|
||||
}
|
||||
|
||||
function isResolvingReturnTypeOfSignature(signature: Signature) {
|
||||
return !signature.resolvedReturnType && findResolutionCycleStartIndex(signature, TypeSystemPropertyName.ResolvedReturnType) >= 0;
|
||||
}
|
||||
|
||||
function getRestTypeOfSignature(signature: Signature): Type {
|
||||
if (signature.hasRestParameter) {
|
||||
const type = getTypeOfSymbol(lastOrUndefined(signature.parameters));
|
||||
@@ -7565,7 +7575,6 @@ namespace ts {
|
||||
if (indexInfo) {
|
||||
if (accessExpression && indexInfo.isReadonly && (isAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression))) {
|
||||
error(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
||||
return unknownType;
|
||||
}
|
||||
return indexInfo.type;
|
||||
}
|
||||
@@ -7606,7 +7615,6 @@ namespace ts {
|
||||
}
|
||||
if (accessNode.kind === SyntaxKind.ElementAccessExpression && isAssignmentTarget(accessNode) && type.declaration.readonlyToken) {
|
||||
error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type));
|
||||
return unknownType;
|
||||
}
|
||||
}
|
||||
const mapper = createTypeMapper([getTypeParameterFromMappedType(type)], [indexType]);
|
||||
@@ -12948,7 +12956,7 @@ namespace ts {
|
||||
// Otherwise, if the containing function is contextually typed by a function type with exactly one call signature
|
||||
// and that call signature is non-generic, return statements are contextually typed by the return type of the signature
|
||||
const signature = getContextualSignatureForFunctionLikeDeclaration(<FunctionExpression>functionDecl);
|
||||
if (signature) {
|
||||
if (signature && !isResolvingReturnTypeOfSignature(signature)) {
|
||||
return getReturnTypeOfSignature(signature);
|
||||
}
|
||||
|
||||
@@ -14604,9 +14612,12 @@ namespace ts {
|
||||
}
|
||||
const prop = getPropertyOfType(apparentType, right.escapedText);
|
||||
if (!prop) {
|
||||
const stringIndexType = getIndexTypeOfType(apparentType, IndexKind.String);
|
||||
if (stringIndexType) {
|
||||
return stringIndexType;
|
||||
const indexInfo = getIndexInfoOfType(apparentType, IndexKind.String);
|
||||
if (indexInfo && indexInfo.type) {
|
||||
if (indexInfo.isReadonly && (isAssignmentTarget(node) || isDeleteTarget(node))) {
|
||||
error(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
|
||||
}
|
||||
return indexInfo.type;
|
||||
}
|
||||
if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) {
|
||||
reportNonexistentProperty(right, type.flags & TypeFlags.TypeParameter && (type as TypeParameter).isThisType ? apparentType : type);
|
||||
@@ -16351,7 +16362,7 @@ namespace ts {
|
||||
*/
|
||||
function checkCallExpression(node: CallExpression | NewExpression): Type {
|
||||
// Grammar checking; stop grammar-checking if checkGrammarTypeArguments return true
|
||||
checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments);
|
||||
checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node.arguments);
|
||||
|
||||
const signature = getResolvedSignature(node);
|
||||
|
||||
@@ -16399,7 +16410,7 @@ namespace ts {
|
||||
|
||||
function checkImportCallExpression(node: ImportCall): Type {
|
||||
// Check grammar of dynamic import
|
||||
checkGrammarArguments(node, node.arguments) || checkGrammarImportCallExpression(node);
|
||||
checkGrammarArguments(node.arguments) || checkGrammarImportCallExpression(node);
|
||||
|
||||
if (node.arguments.length === 0) {
|
||||
return createPromiseReturnType(node, anyType);
|
||||
@@ -17127,7 +17138,9 @@ namespace ts {
|
||||
if (operandType === silentNeverType) {
|
||||
return silentNeverType;
|
||||
}
|
||||
const ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand),
|
||||
const ok = checkArithmeticOperandType(
|
||||
node.operand,
|
||||
checkNonNullType(operandType, node.operand),
|
||||
Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type);
|
||||
if (ok) {
|
||||
// run check only if former checks succeeded to avoid reporting cascading errors
|
||||
@@ -18686,7 +18699,7 @@ namespace ts {
|
||||
function checkTypeReferenceNode(node: TypeReferenceNode | ExpressionWithTypeArguments) {
|
||||
checkGrammarTypeArguments(node, node.typeArguments);
|
||||
if (node.kind === SyntaxKind.TypeReference && node.typeName.jsdocDotPos !== undefined && !isInJavaScriptFile(node) && !isInJSDoc(node)) {
|
||||
grammarErrorAtPos(getSourceFileOfNode(node), node.typeName.jsdocDotPos, 1, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
||||
grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
||||
|
||||
}
|
||||
const type = getTypeFromTypeReference(node);
|
||||
@@ -18758,13 +18771,10 @@ namespace ts {
|
||||
if (isTypeAssignableTo(indexType, getIndexType(objectType))) {
|
||||
return type;
|
||||
}
|
||||
// Check if we're indexing with a numeric type and the object type is a generic
|
||||
// type with a constraint that has a numeric index signature.
|
||||
if (maybeTypeOfKind(objectType, TypeFlags.TypeVariable) && isTypeAssignableToKind(indexType, TypeFlags.NumberLike)) {
|
||||
const constraint = getBaseConstraintOfType(objectType);
|
||||
if (constraint && getIndexInfoOfType(constraint, IndexKind.Number)) {
|
||||
return type;
|
||||
}
|
||||
// Check if we're indexing with a numeric type and if either object or index types
|
||||
// is a generic type with a constraint that has a numeric index signature.
|
||||
if (getIndexInfoOfType(getApparentType(objectType), IndexKind.Number) && isTypeAssignableToKind(indexType, TypeFlags.NumberLike)) {
|
||||
return type;
|
||||
}
|
||||
error(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
|
||||
return type;
|
||||
@@ -19644,7 +19654,7 @@ namespace ts {
|
||||
// checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function.
|
||||
const firstDeclaration = find(localSymbol.declarations,
|
||||
// Get first non javascript function declaration
|
||||
declaration => declaration.kind === node.kind && !isSourceFileJavaScript(getSourceFileOfNode(declaration)));
|
||||
declaration => declaration.kind === node.kind && !(declaration.flags & NodeFlags.JavaScriptFile));
|
||||
|
||||
// Only type check the symbol once
|
||||
if (node === firstDeclaration) {
|
||||
@@ -22910,10 +22920,7 @@ namespace ts {
|
||||
// index access
|
||||
if (node.parent.kind === SyntaxKind.ElementAccessExpression && (<ElementAccessExpression>node.parent).argumentExpression === node) {
|
||||
const objectType = getTypeOfExpression((<ElementAccessExpression>node.parent).expression);
|
||||
if (objectType === unknownType) return undefined;
|
||||
const apparentType = getApparentType(objectType);
|
||||
if (apparentType === unknownType) return undefined;
|
||||
return getPropertyOfType(apparentType, (<NumericLiteral>node).text as __String);
|
||||
return getPropertyOfType(objectType, (<NumericLiteral>node).text as __String);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -24128,8 +24135,7 @@ namespace ts {
|
||||
if (list && list.hasTrailingComma) {
|
||||
const start = list.end - ",".length;
|
||||
const end = list.end;
|
||||
const sourceFile = getSourceFileOfNode(list[0]);
|
||||
return grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Trailing_comma_not_allowed);
|
||||
return grammarErrorAtPos(list[0], start, end - start, Diagnostics.Trailing_comma_not_allowed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24257,19 +24263,18 @@ namespace ts {
|
||||
checkGrammarForAtLeastOneTypeArgument(node, typeArguments);
|
||||
}
|
||||
|
||||
function checkGrammarForOmittedArgument(node: CallExpression | NewExpression, args: NodeArray<Expression>): boolean {
|
||||
function checkGrammarForOmittedArgument(args: NodeArray<Expression>): boolean {
|
||||
if (args) {
|
||||
const sourceFile = getSourceFileOfNode(node);
|
||||
for (const arg of args) {
|
||||
if (arg.kind === SyntaxKind.OmittedExpression) {
|
||||
return grammarErrorAtPos(sourceFile, arg.pos, 0, Diagnostics.Argument_expression_expected);
|
||||
return grammarErrorAtPos(arg, arg.pos, 0, Diagnostics.Argument_expression_expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkGrammarArguments(node: CallExpression | NewExpression, args: NodeArray<Expression>): boolean {
|
||||
return checkGrammarForOmittedArgument(node, args);
|
||||
function checkGrammarArguments(args: NodeArray<Expression>): boolean {
|
||||
return checkGrammarForOmittedArgument(args);
|
||||
}
|
||||
|
||||
function checkGrammarHeritageClause(node: HeritageClause): boolean {
|
||||
@@ -24279,8 +24284,7 @@ namespace ts {
|
||||
}
|
||||
if (types && types.length === 0) {
|
||||
const listType = tokenToString(node.token);
|
||||
const sourceFile = getSourceFileOfNode(node);
|
||||
return grammarErrorAtPos(sourceFile, types.pos, 0, Diagnostics._0_list_cannot_be_empty, listType);
|
||||
return grammarErrorAtPos(node, types.pos, 0, Diagnostics._0_list_cannot_be_empty, listType);
|
||||
}
|
||||
return forEach(types, checkGrammarExpressionWithTypeArguments);
|
||||
}
|
||||
@@ -24558,7 +24562,7 @@ namespace ts {
|
||||
return grammarErrorOnNode(accessor.name, Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context);
|
||||
}
|
||||
else if (accessor.body === undefined && !hasModifier(accessor, ModifierFlags.Abstract)) {
|
||||
return grammarErrorAtPos(getSourceFileOfNode(accessor), accessor.end - 1, ";".length, Diagnostics._0_expected, "{");
|
||||
return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, Diagnostics._0_expected, "{");
|
||||
}
|
||||
else if (accessor.body && hasModifier(accessor, ModifierFlags.Abstract)) {
|
||||
return grammarErrorOnNode(accessor, Diagnostics.An_abstract_accessor_cannot_have_an_implementation);
|
||||
@@ -24623,7 +24627,7 @@ namespace ts {
|
||||
return true;
|
||||
}
|
||||
else if (node.body === undefined) {
|
||||
return grammarErrorAtPos(getSourceFileOfNode(node), node.end - 1, ";".length, Diagnostics._0_expected, "{");
|
||||
return grammarErrorAtPos(node, node.end - 1, ";".length, Diagnostics._0_expected, "{");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24715,7 +24719,7 @@ namespace ts {
|
||||
|
||||
if (node.initializer) {
|
||||
// Error on equals token which immediately precedes the initializer
|
||||
return grammarErrorAtPos(getSourceFileOfNode(node), node.initializer.pos - 1, 1, Diagnostics.A_rest_element_cannot_have_an_initializer);
|
||||
return grammarErrorAtPos(node, node.initializer.pos - 1, 1, Diagnostics.A_rest_element_cannot_have_an_initializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24738,15 +24742,13 @@ namespace ts {
|
||||
else {
|
||||
// Error on equals token which immediate precedes the initializer
|
||||
const equalsTokenLength = "=".length;
|
||||
return grammarErrorAtPos(getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength,
|
||||
equalsTokenLength, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
|
||||
return grammarErrorAtPos(node, node.initializer.pos - equalsTokenLength, equalsTokenLength, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
|
||||
}
|
||||
}
|
||||
if (node.initializer && !(isConst(node) && isStringOrNumberLiteralExpression(node.initializer))) {
|
||||
// Error on equals token which immediate precedes the initializer
|
||||
const equalsTokenLength = "=".length;
|
||||
return grammarErrorAtPos(getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength,
|
||||
equalsTokenLength, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
|
||||
return grammarErrorAtPos(node, node.initializer.pos - equalsTokenLength, equalsTokenLength, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
|
||||
}
|
||||
}
|
||||
else if (!node.initializer) {
|
||||
@@ -24815,7 +24817,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (!declarationList.declarations.length) {
|
||||
return grammarErrorAtPos(getSourceFileOfNode(declarationList), declarations.pos, declarations.end - declarations.pos, Diagnostics.Variable_declaration_list_cannot_be_empty);
|
||||
return grammarErrorAtPos(declarationList, declarations.pos, declarations.end - declarations.pos, Diagnostics.Variable_declaration_list_cannot_be_empty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24868,7 +24870,8 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function grammarErrorAtPos(sourceFile: SourceFile, start: number, length: number, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean {
|
||||
function grammarErrorAtPos(nodeForSourceFile: Node, start: number, length: number, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean {
|
||||
const sourceFile = getSourceFileOfNode(nodeForSourceFile);
|
||||
if (!hasParseDiagnostics(sourceFile)) {
|
||||
diagnostics.add(createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2));
|
||||
return true;
|
||||
@@ -24885,7 +24888,7 @@ namespace ts {
|
||||
|
||||
function checkGrammarConstructorTypeParameters(node: ConstructorDeclaration) {
|
||||
if (node.typeParameters) {
|
||||
return grammarErrorAtPos(getSourceFileOfNode(node), node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration);
|
||||
return grammarErrorAtPos(node, node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1116,7 +1116,7 @@ namespace ts {
|
||||
if (option && !isString(option.type)) {
|
||||
const customOption = <CommandLineOptionOfCustomType>option;
|
||||
// Validate custom option type
|
||||
if (!customOption.type.has(text)) {
|
||||
if (!customOption.type.has(text.toLowerCase())) {
|
||||
errors.push(
|
||||
createDiagnosticForInvalidCustomType(
|
||||
customOption,
|
||||
@@ -1822,7 +1822,7 @@ namespace ts {
|
||||
return value;
|
||||
}
|
||||
else if (!isString(option.type)) {
|
||||
return option.type.get(value);
|
||||
return option.type.get(isString(value) ? value.toLowerCase() : value);
|
||||
}
|
||||
return normalizeNonListOptionValue(option, basePath, value);
|
||||
}
|
||||
|
||||
+10
-6
@@ -4,7 +4,7 @@
|
||||
namespace ts {
|
||||
// WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
export const versionMajorMinor = "2.5";
|
||||
export const versionMajorMinor = "2.6";
|
||||
/** The version of the TypeScript compiler release */
|
||||
export const version = `${versionMajorMinor}.0`;
|
||||
}
|
||||
@@ -1573,16 +1573,20 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function normalizePath(path: string): string {
|
||||
return normalizePathAndParts(path).path;
|
||||
}
|
||||
|
||||
export function normalizePathAndParts(path: string): { path: string, parts: string[] } {
|
||||
path = normalizeSlashes(path);
|
||||
const rootLength = getRootLength(path);
|
||||
const root = path.substr(0, rootLength);
|
||||
const normalized = getNormalizedParts(path, rootLength);
|
||||
if (normalized.length) {
|
||||
const joinedParts = root + normalized.join(directorySeparator);
|
||||
return pathEndsWithDirectorySeparator(path) ? joinedParts + directorySeparator : joinedParts;
|
||||
const parts = getNormalizedParts(path, rootLength);
|
||||
if (parts.length) {
|
||||
const joinedParts = root + parts.join(directorySeparator);
|
||||
return { path: pathEndsWithDirectorySeparator(path) ? joinedParts + directorySeparator : joinedParts, parts };
|
||||
}
|
||||
else {
|
||||
return root;
|
||||
return { path: root, parts };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -349,7 +349,6 @@ namespace ts {
|
||||
errorNameNode = declaration.name;
|
||||
const format = TypeFormatFlags.UseTypeOfFunction |
|
||||
TypeFormatFlags.WriteClassExpressionAsTypeLiteral |
|
||||
TypeFormatFlags.UseTypeAliasValue |
|
||||
(shouldUseResolverType ? TypeFormatFlags.AddUndefined : 0);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, format, writer);
|
||||
errorNameNode = undefined;
|
||||
@@ -368,7 +367,7 @@ namespace ts {
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(
|
||||
signature,
|
||||
enclosingDeclaration,
|
||||
TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.UseTypeAliasValue | TypeFormatFlags.WriteClassExpressionAsTypeLiteral,
|
||||
TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.WriteClassExpressionAsTypeLiteral,
|
||||
writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
@@ -633,7 +632,7 @@ namespace ts {
|
||||
resolver.writeTypeOfExpression(
|
||||
expr,
|
||||
enclosingDeclaration,
|
||||
TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.UseTypeAliasValue | TypeFormatFlags.WriteClassExpressionAsTypeLiteral,
|
||||
TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.WriteClassExpressionAsTypeLiteral,
|
||||
writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace ts {
|
||||
let resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective | undefined;
|
||||
if (resolved) {
|
||||
if (!options.preserveSymlinks) {
|
||||
resolved = realpath(resolved, host, traceEnabled);
|
||||
resolved = realPath(resolved, host, traceEnabled);
|
||||
}
|
||||
|
||||
if (traceEnabled) {
|
||||
@@ -741,20 +741,21 @@ namespace ts {
|
||||
|
||||
let resolvedValue = resolved.value;
|
||||
if (!compilerOptions.preserveSymlinks) {
|
||||
resolvedValue = resolvedValue && { ...resolved.value, path: realpath(resolved.value.path, host, traceEnabled), extension: resolved.value.extension };
|
||||
resolvedValue = resolvedValue && { ...resolved.value, path: realPath(resolved.value.path, host, traceEnabled), extension: resolved.value.extension };
|
||||
}
|
||||
// For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files.
|
||||
return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
|
||||
}
|
||||
else {
|
||||
const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
|
||||
const { path: candidate, parts } = normalizePathAndParts(combinePaths(containingDirectory, moduleName));
|
||||
const resolved = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state, /*considerPackageJson*/ true);
|
||||
return resolved && toSearchResult({ resolved, isExternalLibraryImport: false });
|
||||
// Treat explicit "node_modules" import as an external library import.
|
||||
return resolved && toSearchResult({ resolved, isExternalLibraryImport: contains(parts, "node_modules") });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function realpath(path: string, host: ModuleResolutionHost, traceEnabled: boolean): string {
|
||||
function realPath(path: string, host: ModuleResolutionHost, traceEnabled: boolean): string {
|
||||
if (!host.realpath) {
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -840,7 +840,7 @@ namespace ts {
|
||||
outer.end = skipTrivia(currentText, node.pos);
|
||||
setEmitFlags(outer, EmitFlags.NoComments);
|
||||
|
||||
return createParen(
|
||||
const result = createParen(
|
||||
createCall(
|
||||
outer,
|
||||
/*typeArguments*/ undefined,
|
||||
@@ -849,6 +849,8 @@ namespace ts {
|
||||
: []
|
||||
)
|
||||
);
|
||||
addSyntheticLeadingComment(result, SyntaxKind.MultiLineCommentTrivia, "* @class ");
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -151,7 +151,17 @@ namespace ts {
|
||||
break;
|
||||
}
|
||||
|
||||
recordEmittedDeclarationInScope(node);
|
||||
// Record these declarations provided that they have a name.
|
||||
if ((node as ClassDeclaration | FunctionDeclaration).name) {
|
||||
recordEmittedDeclarationInScope(node as ClassDeclaration | FunctionDeclaration);
|
||||
}
|
||||
else {
|
||||
// These nodes should always have names unless they are default-exports;
|
||||
// however, class declaration parsing allows for undefined names, so syntactically invalid
|
||||
// programs may also have an undefined name.
|
||||
Debug.assert(node.kind === SyntaxKind.ClassDeclaration || hasModifier(node, ModifierFlags.Default));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2639,36 +2649,33 @@ namespace ts {
|
||||
/**
|
||||
* Records that a declaration was emitted in the current scope, if it was the first
|
||||
* declaration for the provided symbol.
|
||||
*
|
||||
* NOTE: if there is ever a transformation above this one, we may not be able to rely
|
||||
* on symbol names.
|
||||
*/
|
||||
function recordEmittedDeclarationInScope(node: Node) {
|
||||
const name = node.symbol && node.symbol.escapedName;
|
||||
if (name) {
|
||||
if (!currentScopeFirstDeclarationsOfName) {
|
||||
currentScopeFirstDeclarationsOfName = createUnderscoreEscapedMap<Node>();
|
||||
}
|
||||
function recordEmittedDeclarationInScope(node: FunctionDeclaration | ClassDeclaration | ModuleDeclaration | EnumDeclaration) {
|
||||
if (!currentScopeFirstDeclarationsOfName) {
|
||||
currentScopeFirstDeclarationsOfName = createUnderscoreEscapedMap<Node>();
|
||||
}
|
||||
|
||||
if (!currentScopeFirstDeclarationsOfName.has(name)) {
|
||||
currentScopeFirstDeclarationsOfName.set(name, node);
|
||||
}
|
||||
const name = declaredNameInScope(node);
|
||||
if (!currentScopeFirstDeclarationsOfName.has(name)) {
|
||||
currentScopeFirstDeclarationsOfName.set(name, node);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a declaration is the first declaration with the same name emitted
|
||||
* in the current scope.
|
||||
* Determines whether a declaration is the first declaration with
|
||||
* the same name emitted in the current scope.
|
||||
*/
|
||||
function isFirstEmittedDeclarationInScope(node: Node) {
|
||||
function isFirstEmittedDeclarationInScope(node: ModuleDeclaration | EnumDeclaration) {
|
||||
if (currentScopeFirstDeclarationsOfName) {
|
||||
const name = node.symbol && node.symbol.escapedName;
|
||||
if (name) {
|
||||
return currentScopeFirstDeclarationsOfName.get(name) === node;
|
||||
}
|
||||
const name = declaredNameInScope(node);
|
||||
return currentScopeFirstDeclarationsOfName.get(name) === node;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
function declaredNameInScope(node: FunctionDeclaration | ClassDeclaration | ModuleDeclaration | EnumDeclaration): __String {
|
||||
Debug.assertNode(node.name, isIdentifier);
|
||||
return (node.name as Identifier).escapedText;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2746,7 +2753,7 @@ namespace ts {
|
||||
return createNotEmittedStatement(node);
|
||||
}
|
||||
|
||||
Debug.assert(isIdentifier(node.name), "TypeScript module should have an Identifier name.");
|
||||
Debug.assertNode(node.name, isIdentifier, "A TypeScript namespace should have an Identifier name.");
|
||||
enableSubstitutionForNamespaceExports();
|
||||
|
||||
const statements: Statement[] = [];
|
||||
|
||||
+14
-9
@@ -2569,6 +2569,15 @@ namespace ts {
|
||||
getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
|
||||
getShorthandAssignmentValueSymbol(location: Node): Symbol | undefined;
|
||||
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol | undefined;
|
||||
/**
|
||||
* If a symbol is a local symbol with an associated exported symbol, returns the exported symbol.
|
||||
* Otherwise returns its input.
|
||||
* For example, at `export type T = number;`:
|
||||
* - `getSymbolAtLocation` at the location `T` will return the exported symbol for `T`.
|
||||
* - But the result of `getSymbolsInScope` will contain the *local* symbol for `T`, not the exported symbol.
|
||||
* - Calling `getExportSymbolOfSymbol` on that local symbol will return the exported symbol.
|
||||
*/
|
||||
getExportSymbolOfSymbol(symbol: Symbol): Symbol;
|
||||
getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined;
|
||||
getTypeAtLocation(node: Node): Type;
|
||||
getTypeFromTypeNode(node: TypeNode): Type;
|
||||
@@ -2709,11 +2718,12 @@ namespace ts {
|
||||
UseFullyQualifiedType = 1 << 8, // Write out the fully qualified type name (eg. Module.Type, instead of Type)
|
||||
InFirstTypeArgument = 1 << 9, // Writing first type argument of the instantiated type
|
||||
InTypeAlias = 1 << 10, // Writing type in type alias declaration
|
||||
UseTypeAliasValue = 1 << 11, // Serialize the type instead of using type-alias. This is needed when we emit declaration file.
|
||||
SuppressAnyReturnType = 1 << 12, // If the return type is any-like, don't offer a return type.
|
||||
AddUndefined = 1 << 13, // Add undefined to types of initialized, non-optional parameters
|
||||
WriteClassExpressionAsTypeLiteral = 1 << 14, // Write a type literal instead of (Anonymous class)
|
||||
InArrayType = 1 << 15, // Writing an array element type
|
||||
UseAliasDefinedOutsideCurrentScope = 1 << 16, // For a `type T = ... ` defined in a different file, write `T` instead of its value,
|
||||
// even though `T` can't be accessed in the current scope.
|
||||
}
|
||||
|
||||
export const enum SymbolFormatFlags {
|
||||
@@ -2922,7 +2932,7 @@ namespace ts {
|
||||
|
||||
export interface Symbol {
|
||||
flags: SymbolFlags; // Symbol flags
|
||||
escapedName: __String; // Name of symbol
|
||||
escapedName: __String; // Name of symbol
|
||||
declarations?: Declaration[]; // Declarations associated with this symbol
|
||||
valueDeclaration?: Declaration; // First value declaration of the symbol
|
||||
members?: SymbolTable; // Class, interface or literal instance members
|
||||
@@ -3127,7 +3137,7 @@ namespace ts {
|
||||
/* @internal */
|
||||
ContainsObjectLiteral = 1 << 22, // Type is or contains object literal type
|
||||
/* @internal */
|
||||
ContainsAnyFunctionType = 1 << 23, // Type is or contains object literal type
|
||||
ContainsAnyFunctionType = 1 << 23, // Type is or contains the anyFunctionType
|
||||
NonPrimitive = 1 << 24, // intrinsic object type
|
||||
/* @internal */
|
||||
JsxAttributes = 1 << 25, // Jsx attributes type
|
||||
@@ -3962,12 +3972,7 @@ namespace ts {
|
||||
export interface ResolvedModule {
|
||||
/** Path of the file the module was resolved to. */
|
||||
resolvedFileName: string;
|
||||
/**
|
||||
* Denotes if 'resolvedFileName' is isExternalLibraryImport and thus should be a proper external module:
|
||||
* - be a .d.ts file
|
||||
* - use top level imports\exports
|
||||
* - don't use tripleslash references
|
||||
*/
|
||||
/** True if `resolvedFileName` comes from `node_modules`. */
|
||||
isExternalLibraryImport?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -650,7 +650,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile) {
|
||||
return getLeadingCommentRanges(sourceFileOfNode.text, node.pos);
|
||||
return node.kind !== SyntaxKind.JsxText ? getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : undefined;
|
||||
}
|
||||
|
||||
export function getJSDocCommentRanges(node: Node, text: string) {
|
||||
|
||||
@@ -2508,6 +2508,23 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifySpanOfEnclosingComment(negative: boolean, onlyMultiLineDiverges?: boolean) {
|
||||
const expected = !negative;
|
||||
const position = this.currentCaretPosition;
|
||||
const fileName = this.activeFile.fileName;
|
||||
const actual = !!this.languageService.getSpanOfEnclosingComment(fileName, position, /*onlyMultiLine*/ false);
|
||||
const actualOnlyMultiLine = !!this.languageService.getSpanOfEnclosingComment(fileName, position, /*onlyMultiLine*/ true);
|
||||
if (expected !== actual || onlyMultiLineDiverges === (actual === actualOnlyMultiLine)) {
|
||||
this.raiseError(`verifySpanOfEnclosingComment failed:
|
||||
position: '${position}'
|
||||
fileName: '${fileName}'
|
||||
onlyMultiLineDiverges: '${onlyMultiLineDiverges}'
|
||||
actual: '${actual}'
|
||||
actualOnlyMultiLine: '${actualOnlyMultiLine}'
|
||||
expected: '${expected}'.`);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Check number of navigationItems which match both searchValue and matchKind,
|
||||
if a filename is passed in, limit the results to that file.
|
||||
@@ -3648,6 +3665,10 @@ namespace FourSlashInterface {
|
||||
this.state.verifyBraceCompletionAtPosition(this.negative, openingBrace);
|
||||
}
|
||||
|
||||
public isInCommentAtPosition(onlyMultiLineDiverges?: boolean) {
|
||||
this.state.verifySpanOfEnclosingComment(this.negative, onlyMultiLineDiverges);
|
||||
}
|
||||
|
||||
public codeFixAvailable() {
|
||||
this.state.verifyCodeFixAvailable(this.negative);
|
||||
}
|
||||
|
||||
@@ -487,6 +487,9 @@ namespace Harness.LanguageService {
|
||||
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean {
|
||||
return unwrapJSONCallResult(this.shim.isValidBraceCompletionAtPosition(fileName, position, openingBrace));
|
||||
}
|
||||
getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): ts.TextSpan {
|
||||
return unwrapJSONCallResult(this.shim.getSpanOfEnclosingComment(fileName, position, onlyMultiLine));
|
||||
}
|
||||
getCodeFixesAtPosition(): ts.CodeAction[] {
|
||||
throw new Error("Not supported on the shim.");
|
||||
}
|
||||
@@ -686,7 +689,7 @@ namespace Harness.LanguageService {
|
||||
this.host.log(message);
|
||||
}
|
||||
|
||||
err(message: string): void {
|
||||
msg(message: string): void {
|
||||
this.host.log(message);
|
||||
}
|
||||
|
||||
@@ -702,7 +705,8 @@ namespace Harness.LanguageService {
|
||||
return false;
|
||||
}
|
||||
|
||||
group() { throw ts.notImplemented(); }
|
||||
startGroup() { throw ts.notImplemented(); }
|
||||
endGroup() { throw ts.notImplemented(); }
|
||||
|
||||
perftrc(message: string): void {
|
||||
return this.host.log(message);
|
||||
|
||||
@@ -90,9 +90,16 @@ namespace RWC {
|
||||
ts.setConfigFileInOptions(opts.options, configParseResult.options.configFile);
|
||||
}
|
||||
|
||||
// Load the files
|
||||
// Deduplicate files so they are only printed once in baselines (they are deduplicated within the compiler already)
|
||||
const uniqueNames = ts.createMap<true>();
|
||||
for (const fileName of fileNames) {
|
||||
inputFiles.push(getHarnessCompilerInputUnit(fileName));
|
||||
// Must maintain order, build result list while checking map
|
||||
const normalized = ts.normalizeSlashes(fileName);
|
||||
if (!uniqueNames.has(normalized)) {
|
||||
uniqueNames.set(normalized, true);
|
||||
// Load the file
|
||||
inputFiles.push(getHarnessCompilerInputUnit(fileName));
|
||||
}
|
||||
}
|
||||
|
||||
// Add files to compilation
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace ts {
|
||||
const projectService = new server.ProjectService(svcOpts);
|
||||
const rootScriptInfo = projectService.getOrCreateScriptInfo(rootFile, /* openedByClient */ true, /*containingProject*/ undefined);
|
||||
|
||||
const project = projectService.assignScriptInfoToInferredProject(rootScriptInfo);
|
||||
const project = projectService.assignOrphanScriptInfoToInferredProject(rootScriptInfo);
|
||||
project.setCompilerOptions({ module: ts.ModuleKind.AMD, noLib: true } );
|
||||
return {
|
||||
project,
|
||||
|
||||
@@ -74,6 +74,70 @@ namespace ts {
|
||||
}
|
||||
}).outputText;
|
||||
});
|
||||
|
||||
testBaseline("rewrittenNamespace", () => {
|
||||
return ts.transpileModule(`namespace Reflect { const x = 1; }`, {
|
||||
transformers: {
|
||||
before: [forceNamespaceRewrite],
|
||||
},
|
||||
compilerOptions: {
|
||||
newLine: NewLineKind.CarriageReturnLineFeed,
|
||||
}
|
||||
}).outputText;
|
||||
});
|
||||
|
||||
testBaseline("rewrittenNamespaceFollowingClass", () => {
|
||||
return ts.transpileModule(`
|
||||
class C { foo = 10; static bar = 20 }
|
||||
namespace C { export let x = 10; }
|
||||
`, {
|
||||
transformers: {
|
||||
before: [forceNamespaceRewrite],
|
||||
},
|
||||
compilerOptions: {
|
||||
target: ts.ScriptTarget.ESNext,
|
||||
newLine: NewLineKind.CarriageReturnLineFeed,
|
||||
}
|
||||
}).outputText;
|
||||
});
|
||||
|
||||
testBaseline("synthesizedClassAndNamespaceCombination", () => {
|
||||
return ts.transpileModule("", {
|
||||
transformers: {
|
||||
before: [replaceWithClassAndNamespace],
|
||||
},
|
||||
compilerOptions: {
|
||||
target: ts.ScriptTarget.ESNext,
|
||||
newLine: NewLineKind.CarriageReturnLineFeed,
|
||||
}
|
||||
}).outputText;
|
||||
|
||||
function replaceWithClassAndNamespace() {
|
||||
return (sourceFile: ts.SourceFile) => {
|
||||
const result = getMutableClone(sourceFile);
|
||||
result.statements = ts.createNodeArray([
|
||||
ts.createClassDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, "Foo", /*typeParameters*/ undefined, /*heritageClauses*/ undefined, /*members*/ undefined),
|
||||
ts.createModuleDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createIdentifier("Foo"), createModuleBlock([createEmptyStatement()]))
|
||||
]);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
function forceNamespaceRewrite(context: ts.TransformationContext) {
|
||||
return (sourceFile: ts.SourceFile): ts.SourceFile => {
|
||||
return visitNode(sourceFile);
|
||||
|
||||
function visitNode<T extends ts.Node>(node: T): T {
|
||||
if (node.kind === ts.SyntaxKind.ModuleBlock) {
|
||||
const block = node as T & ts.ModuleBlock;
|
||||
const statements = ts.createNodeArray([...block.statements]);
|
||||
return ts.updateModuleBlock(block, statements) as typeof block;
|
||||
}
|
||||
return ts.visitEachChild(node, visitNode, context);
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,9 @@ namespace ts.projectSystem {
|
||||
loggingEnabled: () => false,
|
||||
perftrc: noop,
|
||||
info: noop,
|
||||
err: noop,
|
||||
group: noop,
|
||||
msg: noop,
|
||||
startGroup: noop,
|
||||
endGroup: noop,
|
||||
getLogFileName: (): string => undefined
|
||||
};
|
||||
|
||||
@@ -170,7 +171,7 @@ namespace ts.projectSystem {
|
||||
typingsInstaller: undefined,
|
||||
byteLength: Utils.byteLength,
|
||||
hrtime: process.hrtime,
|
||||
logger: nullLogger,
|
||||
logger: opts.logger || nullLogger,
|
||||
canUseEvents: false
|
||||
};
|
||||
|
||||
@@ -2147,6 +2148,47 @@ namespace ts.projectSystem {
|
||||
checkNumberOfProjects(projectService, { configuredProjects: 0, externalProjects: 1, inferredProjects: 0 });
|
||||
checkProjectActualFiles(projectService.externalProjects[0], [site.path, libFile.path]);
|
||||
});
|
||||
|
||||
it("Getting errors from closed script info does not throw exception (because of getting project from orphan script info)", () => {
|
||||
let hasErrorMsg = false;
|
||||
const { close, hasLevel, loggingEnabled, startGroup, endGroup, info, getLogFileName, perftrc } = nullLogger;
|
||||
const logger: server.Logger = {
|
||||
close, hasLevel, loggingEnabled, startGroup, endGroup, info, getLogFileName, perftrc,
|
||||
msg: () => {
|
||||
hasErrorMsg = true;
|
||||
}
|
||||
};
|
||||
const f1 = {
|
||||
path: "/a/b/app.ts",
|
||||
content: "let x = 1;"
|
||||
};
|
||||
const config = {
|
||||
path: "/a/b/tsconfig.json",
|
||||
content: JSON.stringify({ compilerOptions: {} })
|
||||
};
|
||||
const host = createServerHost([f1, libFile, config]);
|
||||
const session = createSession(host, { logger });
|
||||
session.executeCommandSeq(<protocol.OpenRequest>{
|
||||
command: server.CommandNames.Open,
|
||||
arguments: {
|
||||
file: f1.path
|
||||
}
|
||||
});
|
||||
session.executeCommandSeq(<protocol.CloseRequest>{
|
||||
command: server.CommandNames.Close,
|
||||
arguments: {
|
||||
file: f1.path
|
||||
}
|
||||
});
|
||||
session.executeCommandSeq(<protocol.GeterrRequest>{
|
||||
command: server.CommandNames.Geterr,
|
||||
arguments: {
|
||||
delay: 0,
|
||||
files: [f1.path]
|
||||
}
|
||||
});
|
||||
assert.isFalse(hasErrorMsg);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Proper errors", () => {
|
||||
|
||||
Vendored
+4
-4
@@ -980,12 +980,12 @@ interface ReadonlyArray<T> {
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat(...items: T[][]): T[];
|
||||
concat(...items: ReadonlyArray<T>[]): T[];
|
||||
/**
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat(...items: (T | T[])[]): T[];
|
||||
concat(...items: (T | ReadonlyArray<T>)[]): T[];
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
|
||||
@@ -1099,12 +1099,12 @@ interface Array<T> {
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat(...items: T[][]): T[];
|
||||
concat(...items: ReadonlyArray<T>[]): T[];
|
||||
/**
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat(...items: (T | T[])[]): T[];
|
||||
concat(...items: (T | ReadonlyArray<T>)[]): T[];
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
|
||||
|
||||
@@ -527,6 +527,10 @@ namespace ts.server {
|
||||
return notImplemented();
|
||||
}
|
||||
|
||||
getSpanOfEnclosingComment(_fileName: string, _position: number, _onlyMultiLine: boolean): TextSpan {
|
||||
return notImplemented();
|
||||
}
|
||||
|
||||
getCodeFixesAtPosition(file: string, start: number, end: number, errorCodes: number[]): CodeAction[] {
|
||||
const args: protocol.CodeFixRequestArgs = { ...this.createFileRangeRequestArgs(file, start, end), errorCodes };
|
||||
|
||||
|
||||
@@ -563,7 +563,7 @@ namespace ts.server {
|
||||
this.ensureProjectStructuresUptoDate();
|
||||
}
|
||||
const scriptInfo = this.getScriptInfoForNormalizedPath(fileName);
|
||||
return scriptInfo && scriptInfo.getDefaultProject();
|
||||
return scriptInfo && !scriptInfo.isOrphan() && scriptInfo.getDefaultProject();
|
||||
}
|
||||
|
||||
getScriptInfoEnsuringProjectsUptoDate(uncheckedFileName: string) {
|
||||
@@ -592,7 +592,7 @@ namespace ts.server {
|
||||
else {
|
||||
projectsToUpdate = [];
|
||||
for (const f of this.changedFiles) {
|
||||
projectsToUpdate = projectsToUpdate.concat(f.containingProjects);
|
||||
addRange(projectsToUpdate, f.containingProjects);
|
||||
}
|
||||
}
|
||||
this.changedFiles = undefined;
|
||||
@@ -642,7 +642,7 @@ namespace ts.server {
|
||||
private onSourceFileChanged(fileName: NormalizedPath, eventKind: FileWatcherEventKind) {
|
||||
const info = this.getScriptInfoForNormalizedPath(fileName);
|
||||
if (!info) {
|
||||
this.logger.err(`Error: got watch notification for unknown file: ${fileName}`);
|
||||
this.logger.msg(`Error: got watch notification for unknown file: ${fileName}`);
|
||||
}
|
||||
else if (eventKind === FileWatcherEventKind.Deleted) {
|
||||
// File was deleted
|
||||
@@ -793,8 +793,8 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
/*@internal*/
|
||||
assignScriptInfoToInferredProject(info: ScriptInfo, projectRootPath?: string) {
|
||||
Debug.assert(info.containingProjects.length === 0);
|
||||
assignOrphanScriptInfoToInferredProject(info: ScriptInfo, projectRootPath?: string) {
|
||||
Debug.assert(info.isOrphan());
|
||||
|
||||
const project = this.getOrCreateInferredProjectForProjectRootPathIfEnabled(info, projectRootPath) ||
|
||||
this.getOrCreateSingleInferredProjectIfEnabled() ||
|
||||
@@ -827,7 +827,7 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
private addToListOfOpenFiles(info: ScriptInfo) {
|
||||
Debug.assert(info.containingProjects.length !== 0);
|
||||
Debug.assert(!info.isOrphan());
|
||||
for (const p of info.containingProjects) {
|
||||
// file is the part of configured project, addref the project
|
||||
if (p.projectKind === ProjectKind.Configured) {
|
||||
@@ -889,8 +889,8 @@ namespace ts.server {
|
||||
|
||||
// collect orphaned files and assign them to inferred project just like we treat open of a file
|
||||
for (const f of this.openFiles) {
|
||||
if (f.containingProjects.length === 0) {
|
||||
this.assignScriptInfoToInferredProject(f);
|
||||
if (f.isOrphan()) {
|
||||
this.assignOrphanScriptInfoToInferredProject(f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -911,7 +911,7 @@ namespace ts.server {
|
||||
|
||||
private deleteOrphanScriptInfoNotInAnyProject() {
|
||||
this.filenameToScriptInfo.forEach(info => {
|
||||
if (!info.isScriptOpen() && info.containingProjects.length === 0) {
|
||||
if (!info.isScriptOpen() && info.isOrphan()) {
|
||||
// if there are not projects that include this script info - delete it
|
||||
this.stopWatchingScriptInfo(info, WatcherCloseReason.OrphanScriptInfo);
|
||||
this.filenameToScriptInfo.delete(info.path);
|
||||
@@ -1201,27 +1201,27 @@ namespace ts.server {
|
||||
return;
|
||||
}
|
||||
|
||||
this.logger.group(info => {
|
||||
let counter = 0;
|
||||
counter = printProjects(this.externalProjects, info, counter);
|
||||
counter = printProjects(arrayFrom(this.configuredProjects.values()), info, counter);
|
||||
printProjects(this.inferredProjects, info, counter);
|
||||
|
||||
info("Open files: ");
|
||||
for (const rootFile of this.openFiles) {
|
||||
info(`\t${rootFile.fileName}`);
|
||||
}
|
||||
});
|
||||
|
||||
function printProjects(projects: Project[], info: (msg: string) => void, counter: number): number {
|
||||
this.logger.startGroup();
|
||||
let counter = 0;
|
||||
const printProjects = (projects: Project[], counter: number): number => {
|
||||
for (const project of projects) {
|
||||
info(`Project '${project.getProjectName()}' (${ProjectKind[project.projectKind]}) ${counter}`);
|
||||
info(project.filesToString());
|
||||
info("-----------------------------------------------");
|
||||
this.logger.info(`Project '${project.getProjectName()}' (${ProjectKind[project.projectKind]}) ${counter}`);
|
||||
this.logger.info(project.filesToString());
|
||||
this.logger.info("-----------------------------------------------");
|
||||
counter++;
|
||||
}
|
||||
return counter;
|
||||
};
|
||||
counter = printProjects(this.externalProjects, counter);
|
||||
counter = printProjects(arrayFrom(this.configuredProjects.values()), counter);
|
||||
printProjects(this.inferredProjects, counter);
|
||||
|
||||
this.logger.info("Open files: ");
|
||||
for (const rootFile of this.openFiles) {
|
||||
this.logger.info(`\t${rootFile.fileName}`);
|
||||
}
|
||||
|
||||
this.logger.endGroup();
|
||||
}
|
||||
|
||||
private findConfiguredProjectByProjectName(configFileName: NormalizedPath): ConfiguredProject | undefined {
|
||||
@@ -1813,8 +1813,8 @@ namespace ts.server {
|
||||
|
||||
for (const info of this.openFiles) {
|
||||
// collect all orphaned script infos from open files
|
||||
if (info.containingProjects.length === 0) {
|
||||
this.assignScriptInfoToInferredProject(info);
|
||||
if (info.isOrphan()) {
|
||||
this.assignOrphanScriptInfoToInferredProject(info);
|
||||
}
|
||||
else {
|
||||
// Or remove the root of inferred project if is referenced in more than one projects
|
||||
@@ -1871,8 +1871,8 @@ namespace ts.server {
|
||||
|
||||
// At this point if file is part of any any configured or external project, then it would be present in the containing projects
|
||||
// So if it still doesnt have any containing projects, it needs to be part of inferred project
|
||||
if (info.containingProjects.length === 0) {
|
||||
this.assignScriptInfoToInferredProject(info, projectRootPath);
|
||||
if (info.isOrphan()) {
|
||||
this.assignOrphanScriptInfoToInferredProject(info, projectRootPath);
|
||||
}
|
||||
this.addToListOfOpenFiles(info);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace ts.server.protocol {
|
||||
/* @internal */
|
||||
BraceFull = "brace-full",
|
||||
BraceCompletion = "braceCompletion",
|
||||
GetSpanOfEnclosingComment = "getSpanOfEnclosingComment",
|
||||
Change = "change",
|
||||
Close = "close",
|
||||
Completions = "completions",
|
||||
@@ -241,6 +242,21 @@ namespace ts.server.protocol {
|
||||
body?: TodoComment[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A request to determine if the caret is inside a comment.
|
||||
*/
|
||||
export interface SpanOfEnclosingCommentRequest extends FileLocationRequest {
|
||||
command: CommandTypes.GetSpanOfEnclosingComment;
|
||||
arguments: SpanOfEnclosingCommentRequestArgs;
|
||||
}
|
||||
|
||||
export interface SpanOfEnclosingCommentRequestArgs extends FileLocationRequestArgs {
|
||||
/**
|
||||
* Requires that the enclosing span be a multi-line comment, or else the request returns undefined.
|
||||
*/
|
||||
onlyMultiLine: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to obtain outlining spans in file.
|
||||
*/
|
||||
|
||||
@@ -328,6 +328,10 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
isOrphan() {
|
||||
return this.containingProjects.length === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param line 1 based index
|
||||
*/
|
||||
|
||||
+15
-13
@@ -140,6 +140,8 @@ namespace ts.server {
|
||||
class Logger implements server.Logger {
|
||||
private fd = -1;
|
||||
private seq = 0;
|
||||
private inGroup = false;
|
||||
private firstInGroup = true;
|
||||
|
||||
constructor(private readonly logFilename: string,
|
||||
private readonly traceToConsole: boolean,
|
||||
@@ -169,24 +171,24 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
perftrc(s: string) {
|
||||
this.msg(s, "Perf");
|
||||
this.msg(s, Msg.Perf);
|
||||
}
|
||||
|
||||
info(s: string) {
|
||||
this.msg(s, "Info");
|
||||
this.msg(s, Msg.Info);
|
||||
}
|
||||
|
||||
err(s: string) {
|
||||
this.msg(s, "Err");
|
||||
this.msg(s, Msg.Err);
|
||||
}
|
||||
|
||||
group(logGroupEntries: (log: (msg: string) => void) => void) {
|
||||
let firstInGroup = false;
|
||||
logGroupEntries(s => {
|
||||
this.msg(s, "Info", /*inGroup*/ true, firstInGroup);
|
||||
firstInGroup = false;
|
||||
});
|
||||
this.seq++;
|
||||
startGroup() {
|
||||
this.inGroup = true;
|
||||
this.firstInGroup = true;
|
||||
}
|
||||
|
||||
endGroup() {
|
||||
this.inGroup = false;
|
||||
}
|
||||
|
||||
loggingEnabled() {
|
||||
@@ -197,16 +199,16 @@ namespace ts.server {
|
||||
return this.loggingEnabled() && this.level >= level;
|
||||
}
|
||||
|
||||
private msg(s: string, type: string, inGroup = false, firstInGroup = false) {
|
||||
msg(s: string, type: Msg.Types = Msg.Err) {
|
||||
if (!this.canWrite) return;
|
||||
|
||||
s = `[${nowString()}] ${s}\n`;
|
||||
if (!inGroup || firstInGroup) {
|
||||
if (!this.inGroup || this.firstInGroup) {
|
||||
const prefix = Logger.padStringRight(type + " " + this.seq.toString(), " ");
|
||||
s = prefix + s;
|
||||
}
|
||||
this.write(s);
|
||||
if (!inGroup) {
|
||||
if (!this.inGroup) {
|
||||
this.seq++;
|
||||
}
|
||||
}
|
||||
|
||||
+19
-11
@@ -368,7 +368,7 @@ namespace ts.server {
|
||||
msg += "\n" + (<StackTraceError>err).stack;
|
||||
}
|
||||
}
|
||||
this.logger.err(msg);
|
||||
this.logger.msg(msg, Msg.Err);
|
||||
}
|
||||
|
||||
public send(msg: protocol.Message) {
|
||||
@@ -616,7 +616,7 @@ namespace ts.server {
|
||||
|
||||
const definitions = project.getLanguageService().getTypeDefinitionAtPosition(file, position);
|
||||
if (!definitions) {
|
||||
return undefined;
|
||||
return emptyArray;
|
||||
}
|
||||
|
||||
return definitions.map(def => {
|
||||
@@ -706,7 +706,7 @@ namespace ts.server {
|
||||
const documentHighlights = project.getLanguageService().getDocumentHighlights(file, position, args.filesToSearch);
|
||||
|
||||
if (!documentHighlights) {
|
||||
return undefined;
|
||||
return emptyArray;
|
||||
}
|
||||
|
||||
if (simplifiedResult) {
|
||||
@@ -893,7 +893,7 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
private getReferences(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): protocol.ReferencesResponseBody | ReadonlyArray<ReferencedSymbol> {
|
||||
private getReferences(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): protocol.ReferencesResponseBody | undefined | ReadonlyArray<ReferencedSymbol> {
|
||||
const file = toNormalizedPath(args.file);
|
||||
const projects = this.getProjects(args);
|
||||
|
||||
@@ -903,7 +903,7 @@ namespace ts.server {
|
||||
if (simplifiedResult) {
|
||||
const nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position);
|
||||
if (!nameInfo) {
|
||||
return emptyArray;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const displayString = displayPartsToString(nameInfo.displayParts);
|
||||
@@ -1015,6 +1015,14 @@ namespace ts.server {
|
||||
return project.getLanguageService(/*ensureSynchronized*/ false).getDocCommentTemplateAtPosition(file, position);
|
||||
}
|
||||
|
||||
private getSpanOfEnclosingComment(args: protocol.SpanOfEnclosingCommentRequestArgs) {
|
||||
const { file, project } = this.getFileAndProjectWithoutRefreshingInferredProjects(args);
|
||||
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
||||
const onlyMultiLine = args.onlyMultiLine;
|
||||
const position = this.getPosition(args, scriptInfo);
|
||||
return project.getLanguageService(/*ensureSynchronized*/ false).getSpanOfEnclosingComment(file, position, onlyMultiLine);
|
||||
}
|
||||
|
||||
private getIndentation(args: protocol.IndentationRequestArgs) {
|
||||
const { file, project } = this.getFileAndProjectWithoutRefreshingInferredProjects(args);
|
||||
const position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file));
|
||||
@@ -1157,7 +1165,7 @@ namespace ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
private getCompletions(args: protocol.CompletionsRequestArgs, simplifiedResult: boolean): ReadonlyArray<protocol.CompletionEntry> | CompletionInfo {
|
||||
private getCompletions(args: protocol.CompletionsRequestArgs, simplifiedResult: boolean): ReadonlyArray<protocol.CompletionEntry> | CompletionInfo | undefined {
|
||||
const prefix = args.prefix || "";
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
|
||||
@@ -1165,11 +1173,8 @@ namespace ts.server {
|
||||
const position = this.getPosition(args, scriptInfo);
|
||||
|
||||
const completions = project.getLanguageService().getCompletionsAtPosition(file, position);
|
||||
if (!completions) {
|
||||
return emptyArray;
|
||||
}
|
||||
if (simplifiedResult) {
|
||||
return mapDefined(completions.entries, entry => {
|
||||
return mapDefined(completions && completions.entries, entry => {
|
||||
if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) {
|
||||
const { name, kind, kindModifiers, sortText, replacementSpan } = entry;
|
||||
const convertedSpan = replacementSpan ? this.decorateSpan(replacementSpan, scriptInfo) : undefined;
|
||||
@@ -1758,6 +1763,9 @@ namespace ts.server {
|
||||
[CommandNames.DocCommentTemplate]: (request: protocol.DocCommentTemplateRequest) => {
|
||||
return this.requiredResponse(this.getDocCommentTemplate(request.arguments));
|
||||
},
|
||||
[CommandNames.GetSpanOfEnclosingComment]: (request: protocol.SpanOfEnclosingCommentRequest) => {
|
||||
return this.requiredResponse(this.getSpanOfEnclosingComment(request.arguments));
|
||||
},
|
||||
[CommandNames.Format]: (request: protocol.FormatRequest) => {
|
||||
return this.requiredResponse(this.getFormattingEditsForRange(request.arguments));
|
||||
},
|
||||
@@ -1940,7 +1948,7 @@ namespace ts.server {
|
||||
return this.executeWithRequestId(request.seq, () => handler(request));
|
||||
}
|
||||
else {
|
||||
this.logger.err(`Unrecognized JSON command: ${JSON.stringify(request)}`);
|
||||
this.logger.msg(`Unrecognized JSON command: ${JSON.stringify(request)}`, Msg.Err);
|
||||
this.output(undefined, CommandNames.Unknown, request.seq, `Unrecognized JSON command: ${request.command}`);
|
||||
return { responseRequired: false };
|
||||
}
|
||||
|
||||
+13
-4
@@ -17,11 +17,22 @@ namespace ts.server {
|
||||
loggingEnabled(): boolean;
|
||||
perftrc(s: string): void;
|
||||
info(s: string): void;
|
||||
err(s: string): void;
|
||||
group(logGroupEntries: (log: (msg: string) => void) => void): void;
|
||||
startGroup(): void;
|
||||
endGroup(): void;
|
||||
msg(s: string, type?: Msg.Types): void;
|
||||
getLogFileName(): string;
|
||||
}
|
||||
|
||||
export namespace Msg {
|
||||
export type Err = "Err";
|
||||
export const Err: Err = "Err";
|
||||
export type Info = "Info";
|
||||
export const Info: Info = "Info";
|
||||
export type Perf = "Perf";
|
||||
export const Perf: Perf = "Perf";
|
||||
export type Types = Err | Info | Perf;
|
||||
}
|
||||
|
||||
function getProjectRootPath(project: Project): Path {
|
||||
switch (project.projectKind) {
|
||||
case ProjectKind.Configured:
|
||||
@@ -115,9 +126,7 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
export function createNormalizedPathMap<T>(): NormalizedPathMap<T> {
|
||||
/* tslint:disable:no-null-keyword */
|
||||
const map = createMap<T>();
|
||||
/* tslint:enable:no-null-keyword */
|
||||
return {
|
||||
get(path) {
|
||||
return map.get(path);
|
||||
|
||||
@@ -398,7 +398,6 @@ namespace ts.formatting {
|
||||
|
||||
// formatting context is used by rules provider
|
||||
const formattingContext = new FormattingContext(sourceFile, requestKind, options);
|
||||
let previousRangeHasError: boolean;
|
||||
let previousRange: TextRangeWithKind;
|
||||
let previousParent: Node;
|
||||
let previousRangeStartLine: number;
|
||||
@@ -883,7 +882,7 @@ namespace ts.formatting {
|
||||
|
||||
const rangeHasError = rangeContainsError(range);
|
||||
let lineAdded: boolean;
|
||||
if (!rangeHasError && !previousRangeHasError) {
|
||||
if (!rangeHasError) {
|
||||
if (!previousRange) {
|
||||
// trim whitespaces starting from the beginning of the span up to the current line
|
||||
const originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos);
|
||||
@@ -898,7 +897,6 @@ namespace ts.formatting {
|
||||
previousRange = range;
|
||||
previousParent = parent;
|
||||
previousRangeStartLine = rangeStart.line;
|
||||
previousRangeHasError = rangeHasError;
|
||||
|
||||
return lineAdded;
|
||||
}
|
||||
@@ -1152,6 +1150,56 @@ namespace ts.formatting {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param precedingToken pass `null` if preceding token was already computed and result was `undefined`.
|
||||
*/
|
||||
export function getRangeOfEnclosingComment(
|
||||
sourceFile: SourceFile,
|
||||
position: number,
|
||||
onlyMultiLine: boolean,
|
||||
precedingToken?: Node | null, // tslint:disable-line:no-null-keyword
|
||||
tokenAtPosition = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false),
|
||||
predicate?: (c: CommentRange) => boolean): CommentRange | undefined {
|
||||
const tokenStart = tokenAtPosition.getStart(sourceFile);
|
||||
if (tokenStart <= position && position < tokenAtPosition.getEnd()) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (precedingToken === undefined) {
|
||||
precedingToken = findPrecedingToken(position, sourceFile);
|
||||
}
|
||||
|
||||
// Between two consecutive tokens, all comments are either trailing on the former
|
||||
// or leading on the latter (and none are in both lists).
|
||||
const trailingRangesOfPreviousToken = precedingToken && getTrailingCommentRanges(sourceFile.text, precedingToken.end);
|
||||
const leadingCommentRangesOfNextToken = getLeadingCommentRangesOfNode(tokenAtPosition, sourceFile);
|
||||
const commentRanges = trailingRangesOfPreviousToken && leadingCommentRangesOfNextToken ?
|
||||
trailingRangesOfPreviousToken.concat(leadingCommentRangesOfNextToken) :
|
||||
trailingRangesOfPreviousToken || leadingCommentRangesOfNextToken;
|
||||
if (commentRanges) {
|
||||
for (const range of commentRanges) {
|
||||
// The end marker of a single-line comment does not include the newline character.
|
||||
// With caret at `^`, in the following case, we are inside a comment (^ denotes the cursor position):
|
||||
//
|
||||
// // asdf ^\n
|
||||
//
|
||||
// But for closed multi-line comments, we don't want to be inside the comment in the following case:
|
||||
//
|
||||
// /* asdf */^
|
||||
//
|
||||
// However, unterminated multi-line comments *do* contain their end.
|
||||
//
|
||||
// Internally, we represent the end of the comment at the newline and closing '/', respectively.
|
||||
//
|
||||
if ((range.pos < position && position < range.end ||
|
||||
position === range.end && (range.kind === SyntaxKind.SingleLineCommentTrivia || position === sourceFile.getFullWidth()))) {
|
||||
return (range.kind === SyntaxKind.MultiLineCommentTrivia || !onlyMultiLine) && (!predicate || predicate(range)) ? range : undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getOpenTokenForList(node: Node, list: ReadonlyArray<Node>) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Constructor:
|
||||
|
||||
@@ -32,13 +32,36 @@ namespace ts.formatting {
|
||||
}
|
||||
|
||||
const precedingToken = findPrecedingToken(position, sourceFile);
|
||||
|
||||
const enclosingCommentRange = getRangeOfEnclosingComment(sourceFile, position, /*onlyMultiLine*/ true, precedingToken || null); // tslint:disable-line:no-null-keyword
|
||||
if (enclosingCommentRange) {
|
||||
const previousLine = getLineAndCharacterOfPosition(sourceFile, position).line - 1;
|
||||
const commentStartLine = getLineAndCharacterOfPosition(sourceFile, enclosingCommentRange.pos).line;
|
||||
|
||||
Debug.assert(commentStartLine >= 0);
|
||||
|
||||
if (previousLine <= commentStartLine) {
|
||||
return findFirstNonWhitespaceColumn(getStartPositionOfLine(commentStartLine, sourceFile), position, sourceFile, options);
|
||||
}
|
||||
|
||||
const startPostionOfLine = getStartPositionOfLine(previousLine, sourceFile);
|
||||
const { column, character } = findFirstNonWhitespaceCharacterAndColumn(startPostionOfLine, position, sourceFile, options);
|
||||
|
||||
if (column === 0) {
|
||||
return column;
|
||||
}
|
||||
|
||||
const firstNonWhitespaceCharacterCode = sourceFile.text.charCodeAt(startPostionOfLine + character);
|
||||
return firstNonWhitespaceCharacterCode === CharacterCodes.asterisk ? column - 1 : column;
|
||||
}
|
||||
|
||||
if (!precedingToken) {
|
||||
return getBaseIndentation(options);
|
||||
}
|
||||
|
||||
// no indentation in string \regex\template literals
|
||||
const precedingTokenIsLiteral = isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind);
|
||||
if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {
|
||||
if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && position < precedingToken.end) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -405,13 +428,13 @@ namespace ts.formatting {
|
||||
return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options);
|
||||
}
|
||||
|
||||
/*
|
||||
Character is the actual index of the character since the beginning of the line.
|
||||
Column - position of the character after expanding tabs to spaces
|
||||
"0\t2$"
|
||||
value of 'character' for '$' is 3
|
||||
value of 'column' for '$' is 6 (assuming that tab size is 4)
|
||||
*/
|
||||
/**
|
||||
* Character is the actual index of the character since the beginning of the line.
|
||||
* Column - position of the character after expanding tabs to spaces.
|
||||
* "0\t2$"
|
||||
* value of 'character' for '$' is 3
|
||||
* value of 'column' for '$' is 6 (assuming that tab size is 4)
|
||||
*/
|
||||
export function findFirstNonWhitespaceCharacterAndColumn(startPos: number, endPos: number, sourceFile: SourceFileLike, options: EditorSettings) {
|
||||
let character = 0;
|
||||
let column = 0;
|
||||
|
||||
@@ -830,10 +830,6 @@ namespace ts.refactor.extractMethod {
|
||||
}
|
||||
}
|
||||
|
||||
function isModuleBlock(n: Node): n is ModuleBlock {
|
||||
return n.kind === SyntaxKind.ModuleBlock;
|
||||
}
|
||||
|
||||
function isReadonlyArray(v: any): v is ReadonlyArray<any> {
|
||||
return isArray(v);
|
||||
}
|
||||
@@ -866,7 +862,7 @@ namespace ts.refactor.extractMethod {
|
||||
readonly node: Node;
|
||||
}
|
||||
|
||||
interface ScopeUsages {
|
||||
export interface ScopeUsages {
|
||||
usages: Map<UsageEntry>;
|
||||
substitutions: Map<Node>;
|
||||
}
|
||||
|
||||
+24
-12
@@ -107,12 +107,14 @@ namespace ts {
|
||||
scanner.setTextPos(pos);
|
||||
while (pos < end) {
|
||||
const token = scanner.scan();
|
||||
Debug.assert(token !== SyntaxKind.EndOfFileToken); // Else it would infinitely loop
|
||||
const textPos = scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
}
|
||||
pos = textPos;
|
||||
if (token === SyntaxKind.EndOfFileToken) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
@@ -1692,17 +1694,20 @@ namespace ts {
|
||||
function getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[] {
|
||||
const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
const settings = toEditorSettings(options);
|
||||
if (key === "{") {
|
||||
return formatting.formatOnOpeningCurly(position, sourceFile, getRuleProvider(settings), settings);
|
||||
}
|
||||
else if (key === "}") {
|
||||
return formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(settings), settings);
|
||||
}
|
||||
else if (key === ";") {
|
||||
return formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(settings), settings);
|
||||
}
|
||||
else if (key === "\n") {
|
||||
return formatting.formatOnEnter(position, sourceFile, getRuleProvider(settings), settings);
|
||||
|
||||
if (!isInComment(sourceFile, position)) {
|
||||
if (key === "{") {
|
||||
return formatting.formatOnOpeningCurly(position, sourceFile, getRuleProvider(settings), settings);
|
||||
}
|
||||
else if (key === "}") {
|
||||
return formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(settings), settings);
|
||||
}
|
||||
else if (key === ";") {
|
||||
return formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(settings), settings);
|
||||
}
|
||||
else if (key === "\n") {
|
||||
return formatting.formatOnEnter(position, sourceFile, getRuleProvider(settings), settings);
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
@@ -1761,6 +1766,12 @@ namespace ts {
|
||||
return true;
|
||||
}
|
||||
|
||||
function getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean) {
|
||||
const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
const range = ts.formatting.getRangeOfEnclosingComment(sourceFile, position, onlyMultiLine);
|
||||
return range && createTextSpanFromRange(range);
|
||||
}
|
||||
|
||||
function getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] {
|
||||
// Note: while getting todo comments seems like a syntactic operation, we actually
|
||||
// treat it as a semantic operation here. This is because we expect our host to call
|
||||
@@ -1985,6 +1996,7 @@ namespace ts {
|
||||
getFormattingEditsAfterKeystroke,
|
||||
getDocCommentTemplateAtPosition,
|
||||
isValidBraceCompletionAtPosition,
|
||||
getSpanOfEnclosingComment,
|
||||
getCodeFixesAtPosition,
|
||||
getEmitOutput,
|
||||
getNonBoundSourceFile,
|
||||
|
||||
+13
-1
@@ -254,6 +254,11 @@ namespace ts {
|
||||
*/
|
||||
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): string;
|
||||
|
||||
/**
|
||||
* Returns a JSON-encoded TextSpan | undefined indicating the range of the enclosing comment, if it exists.
|
||||
*/
|
||||
getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): string;
|
||||
|
||||
getEmitOutput(fileName: string): string;
|
||||
getEmitOutputObject(fileName: string): EmitOutput;
|
||||
}
|
||||
@@ -815,6 +820,13 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
|
||||
public getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): string {
|
||||
return this.forwardJSONCall(
|
||||
`getSpanOfEnclosingComment('${fileName}', ${position})`,
|
||||
() => this.languageService.getSpanOfEnclosingComment(fileName, position, onlyMultiLine)
|
||||
);
|
||||
}
|
||||
|
||||
/// GET SMART INDENT
|
||||
public getIndentationAtPosition(fileName: string, position: number, options: string /*Services.EditorOptions*/): string {
|
||||
return this.forwardJSONCall(
|
||||
@@ -1222,4 +1234,4 @@ namespace TypeScript.Services {
|
||||
// TODO: it should be moved into a namespace though.
|
||||
|
||||
/* @internal */
|
||||
const toolsVersion = "2.5";
|
||||
const toolsVersion = "2.6";
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace ts.textChanges {
|
||||
*/
|
||||
export type ConfigurableStartEnd = ConfigurableStart & ConfigurableEnd;
|
||||
|
||||
interface InsertNodeOptions {
|
||||
export interface InsertNodeOptions {
|
||||
/**
|
||||
* Text to be inserted before the new node
|
||||
*/
|
||||
@@ -96,7 +96,7 @@ namespace ts.textChanges {
|
||||
readonly range: TextRange;
|
||||
}
|
||||
|
||||
interface ChangeNodeOptions extends ConfigurableStartEnd, InsertNodeOptions {
|
||||
export interface ChangeNodeOptions extends ConfigurableStartEnd, InsertNodeOptions {
|
||||
readonly useIndentationFromFile?: boolean;
|
||||
}
|
||||
interface ReplaceWithSingleNode extends BaseChange {
|
||||
@@ -111,7 +111,7 @@ namespace ts.textChanges {
|
||||
readonly options?: never;
|
||||
}
|
||||
|
||||
interface ChangeMultipleNodesOptions extends ChangeNodeOptions {
|
||||
export interface ChangeMultipleNodesOptions extends ChangeNodeOptions {
|
||||
nodeSeparator: string;
|
||||
}
|
||||
interface ReplaceWithMultipleNodes extends BaseChange {
|
||||
|
||||
@@ -271,6 +271,8 @@ namespace ts {
|
||||
|
||||
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
|
||||
|
||||
getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan;
|
||||
|
||||
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeAction[];
|
||||
getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange): ApplicableRefactorInfo[];
|
||||
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string): RefactorEditInfo | undefined;
|
||||
|
||||
+36
-50
@@ -720,8 +720,14 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node, includeJsDoc?: boolean): Node {
|
||||
return find(startNode || sourceFile);
|
||||
/**
|
||||
* Finds the rightmost token satisfying `token.end <= position`,
|
||||
* excluding `JsxText` tokens containing only whitespace.
|
||||
*/
|
||||
export function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node, includeJsDoc?: boolean): Node | undefined {
|
||||
const result = find(startNode || sourceFile);
|
||||
Debug.assert(!(result && isWhiteSpaceOnlyJsxText(result)));
|
||||
return result;
|
||||
|
||||
function findRightmostToken(n: Node): Node {
|
||||
if (isToken(n)) {
|
||||
@@ -742,19 +748,17 @@ namespace ts {
|
||||
const children = n.getChildren();
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
const child = children[i];
|
||||
// condition 'position < child.end' checks if child node end after the position
|
||||
// in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc'
|
||||
// aaaa___bbbb___$__ccc
|
||||
// after we found child node with end after the position we check if start of the node is after the position.
|
||||
// if yes - then position is in the trivia and we need to look into the previous child to find the token in question.
|
||||
// if no - position is in the node itself so we should recurse in it.
|
||||
// NOTE: JsxText is a weird kind of node that can contain only whitespaces (since they are not counted as trivia).
|
||||
// if this is the case - then we should assume that token in question is located in previous child.
|
||||
if (position < child.end && (nodeHasTokens(child) || child.kind === SyntaxKind.JsxText)) {
|
||||
// Note that the span of a node's tokens is [node.getStart(...), node.end).
|
||||
// Given that `position < child.end` and child has constituent tokens, we distinguish these cases:
|
||||
// 1) `position` precedes `child`'s tokens or `child` has no tokens (ie: in a comment or whitespace preceding `child`):
|
||||
// we need to find the last token in a previous child.
|
||||
// 2) `position` is within the same span: we recurse on `child`.
|
||||
if (position < child.end) {
|
||||
const start = child.getStart(sourceFile, includeJsDoc);
|
||||
const lookInPreviousChild =
|
||||
(start >= position) || // cursor in the leading trivia
|
||||
(child.kind === SyntaxKind.JsxText && start === child.end); // whitespace only JsxText
|
||||
!nodeHasTokens(child) ||
|
||||
isWhiteSpaceOnlyJsxText(child);
|
||||
|
||||
if (lookInPreviousChild) {
|
||||
// actual start of the node is past the position - previous token should be at the end of previous child
|
||||
@@ -780,10 +784,17 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
/// finds last node that is considered as candidate for search (isCandidate(node) === true) starting from 'exclusiveStartPosition'
|
||||
/**
|
||||
* Finds the rightmost child to the left of `children[exclusiveStartPosition]` which is a non-all-whitespace token or has constituent tokens.
|
||||
*/
|
||||
function findRightmostChildNodeWithTokens(children: Node[], exclusiveStartPosition: number): Node {
|
||||
for (let i = exclusiveStartPosition - 1; i >= 0; i--) {
|
||||
if (nodeHasTokens(children[i])) {
|
||||
const child = children[i];
|
||||
|
||||
if (isWhiteSpaceOnlyJsxText(child)) {
|
||||
Debug.assert(i > 0, "`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`");
|
||||
}
|
||||
else if (nodeHasTokens(children[i])) {
|
||||
return children[i];
|
||||
}
|
||||
}
|
||||
@@ -851,6 +862,10 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isWhiteSpaceOnlyJsxText(node: Node): node is JsxText {
|
||||
return isJsxText(node) && node.containsOnlyWhiteSpaces;
|
||||
}
|
||||
|
||||
export function isInTemplateString(sourceFile: SourceFile, position: number) {
|
||||
const token = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
return isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile);
|
||||
@@ -863,41 +878,11 @@ namespace ts {
|
||||
* @param predicate Additional predicate to test on the comment range.
|
||||
*/
|
||||
export function isInComment(
|
||||
sourceFile: SourceFile,
|
||||
position: number,
|
||||
tokenAtPosition = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false),
|
||||
predicate?: (c: CommentRange) => boolean): boolean {
|
||||
return position <= tokenAtPosition.getStart(sourceFile) &&
|
||||
(isInCommentRange(getLeadingCommentRanges(sourceFile.text, tokenAtPosition.pos)) ||
|
||||
isInCommentRange(getTrailingCommentRanges(sourceFile.text, tokenAtPosition.pos)));
|
||||
|
||||
function isInCommentRange(commentRanges: CommentRange[]): boolean {
|
||||
return forEach(commentRanges, c => isPositionInCommentRange(c, position, sourceFile.text) && (!predicate || predicate(c)));
|
||||
}
|
||||
}
|
||||
|
||||
function isPositionInCommentRange({ pos, end, kind }: ts.CommentRange, position: number, text: string): boolean {
|
||||
if (pos < position && position < end) {
|
||||
return true;
|
||||
}
|
||||
else if (position === end) {
|
||||
// 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):
|
||||
//
|
||||
// // asdf ^\n
|
||||
//
|
||||
// But for multi-line comments, we don't want to be inside the comment in the following case:
|
||||
//
|
||||
// /* asdf */^
|
||||
//
|
||||
// Internally, we represent the end of the comment at the newline and closing '/', respectively.
|
||||
return kind === SyntaxKind.SingleLineCommentTrivia ||
|
||||
// true for unterminated multi-line comment
|
||||
!(text.charCodeAt(end - 1) === CharacterCodes.slash && text.charCodeAt(end - 2) === CharacterCodes.asterisk);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
sourceFile: SourceFile,
|
||||
position: number,
|
||||
tokenAtPosition?: Node,
|
||||
predicate?: (c: CommentRange) => boolean): boolean {
|
||||
return !!formatting.getRangeOfEnclosingComment(sourceFile, position, /*onlyMultiLine*/ false, /*precedingToken*/ undefined, tokenAtPosition, predicate);
|
||||
}
|
||||
|
||||
export function hasDocComment(sourceFile: SourceFile, position: number) {
|
||||
@@ -916,7 +901,7 @@ namespace ts {
|
||||
|
||||
function nodeHasTokens(n: Node): boolean {
|
||||
// If we have a token or node that has a non-zero width, it must have tokens.
|
||||
// Note, that getWidth() does not take trivia into account.
|
||||
// Note: getWidth() does not take trivia into account.
|
||||
return n.getWidth() !== 0;
|
||||
}
|
||||
|
||||
@@ -1241,6 +1226,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[] {
|
||||
flags |= TypeFormatFlags.UseAliasDefinedOutsideCurrentScope;
|
||||
return mapToDisplayParts(writer => {
|
||||
typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags);
|
||||
});
|
||||
|
||||
@@ -16,17 +16,17 @@ class Board {
|
||||
}
|
||||
|
||||
//// [2dArrays.js]
|
||||
var Cell = (function () {
|
||||
var Cell = /** @class */ (function () {
|
||||
function Cell() {
|
||||
}
|
||||
return Cell;
|
||||
}());
|
||||
var Ship = (function () {
|
||||
var Ship = /** @class */ (function () {
|
||||
function Ship() {
|
||||
}
|
||||
return Ship;
|
||||
}());
|
||||
var Board = (function () {
|
||||
var Board = /** @class */ (function () {
|
||||
function Board() {
|
||||
}
|
||||
Board.prototype.allShipsSunk = function () {
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ var p = new A.Point(0, 0); // unexpected error here, bug 840000
|
||||
//// [classPoint.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
+6
-6
@@ -51,7 +51,7 @@ module clodule4 {
|
||||
|
||||
//// [ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js]
|
||||
// all expected to be errors
|
||||
var clodule1 = (function () {
|
||||
var clodule1 = /** @class */ (function () {
|
||||
function clodule1() {
|
||||
}
|
||||
return clodule1;
|
||||
@@ -59,20 +59,20 @@ var clodule1 = (function () {
|
||||
(function (clodule1) {
|
||||
function f(x) { }
|
||||
})(clodule1 || (clodule1 = {}));
|
||||
var clodule2 = (function () {
|
||||
var clodule2 = /** @class */ (function () {
|
||||
function clodule2() {
|
||||
}
|
||||
return clodule2;
|
||||
}());
|
||||
(function (clodule2) {
|
||||
var x;
|
||||
var D = (function () {
|
||||
var D = /** @class */ (function () {
|
||||
function D() {
|
||||
}
|
||||
return D;
|
||||
}());
|
||||
})(clodule2 || (clodule2 = {}));
|
||||
var clodule3 = (function () {
|
||||
var clodule3 = /** @class */ (function () {
|
||||
function clodule3() {
|
||||
}
|
||||
return clodule3;
|
||||
@@ -80,13 +80,13 @@ var clodule3 = (function () {
|
||||
(function (clodule3) {
|
||||
clodule3.y = { id: T };
|
||||
})(clodule3 || (clodule3 = {}));
|
||||
var clodule4 = (function () {
|
||||
var clodule4 = /** @class */ (function () {
|
||||
function clodule4() {
|
||||
}
|
||||
return clodule4;
|
||||
}());
|
||||
(function (clodule4) {
|
||||
var D = (function () {
|
||||
var D = /** @class */ (function () {
|
||||
function D() {
|
||||
}
|
||||
return D;
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ module clodule {
|
||||
|
||||
|
||||
//// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js]
|
||||
var clodule = (function () {
|
||||
var clodule = /** @class */ (function () {
|
||||
function clodule() {
|
||||
}
|
||||
clodule.fn = function (id) { };
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ module clodule {
|
||||
|
||||
|
||||
//// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js]
|
||||
var clodule = (function () {
|
||||
var clodule = /** @class */ (function () {
|
||||
function clodule() {
|
||||
}
|
||||
clodule.fn = function (id) { };
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ module clodule {
|
||||
|
||||
|
||||
//// [ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js]
|
||||
var clodule = (function () {
|
||||
var clodule = /** @class */ (function () {
|
||||
function clodule() {
|
||||
}
|
||||
clodule.sfn = function (id) { return 42; };
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ module A {
|
||||
}
|
||||
|
||||
//// [ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js]
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -37,7 +37,7 @@ var Point = (function () {
|
||||
})(Point || (Point = {}));
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ module A {
|
||||
}
|
||||
|
||||
//// [ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js]
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -36,7 +36,7 @@ var Point = (function () {
|
||||
})(Point || (Point = {}));
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ module A {
|
||||
}
|
||||
|
||||
//// [ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js]
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -36,7 +36,7 @@ var Point = (function () {
|
||||
})(Point || (Point = {}));
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ module A {
|
||||
}
|
||||
|
||||
//// [ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js]
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -36,7 +36,7 @@ var Point = (function () {
|
||||
})(Point || (Point = {}));
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
@@ -45,7 +45,7 @@ var X;
|
||||
(function (X) {
|
||||
var Y;
|
||||
(function (Y) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -71,7 +71,7 @@ var X;
|
||||
var cl = new X.Y.Point(1, 1);
|
||||
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
|
||||
//// [simple.js]
|
||||
var A = (function () {
|
||||
var A = /** @class */ (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
|
||||
@@ -5,7 +5,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [ClassDeclaration10.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
|
||||
@@ -5,7 +5,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [ClassDeclaration11.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () { };
|
||||
|
||||
@@ -5,7 +5,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [ClassDeclaration13.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () { };
|
||||
|
||||
@@ -5,7 +5,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [ClassDeclaration14.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
|
||||
@@ -5,7 +5,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [ClassDeclaration15.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
|
||||
@@ -5,7 +5,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [ClassDeclaration21.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[1] = function () { };
|
||||
|
||||
@@ -5,7 +5,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [ClassDeclaration22.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype["bar"] = function () { };
|
||||
|
||||
@@ -3,7 +3,7 @@ class any {
|
||||
}
|
||||
|
||||
//// [ClassDeclaration24.js]
|
||||
var any = (function () {
|
||||
var any = /** @class */ (function () {
|
||||
function any() {
|
||||
}
|
||||
return any;
|
||||
|
||||
@@ -10,7 +10,7 @@ class List<U> implements IList<U> {
|
||||
|
||||
|
||||
//// [ClassDeclaration25.js]
|
||||
var List = (function () {
|
||||
var List = /** @class */ (function () {
|
||||
function List() {
|
||||
}
|
||||
return List;
|
||||
|
||||
@@ -6,7 +6,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [ClassDeclaration26.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
this.foo = 10;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [ClassDeclaration8.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
|
||||
@@ -4,7 +4,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [ClassDeclaration9.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
|
||||
@@ -4,7 +4,7 @@ class AtomicNumbers {
|
||||
}
|
||||
|
||||
//// [ClassDeclarationWithInvalidConstOnPropertyDeclaration.js]
|
||||
var AtomicNumbers = (function () {
|
||||
var AtomicNumbers = /** @class */ (function () {
|
||||
function AtomicNumbers() {
|
||||
}
|
||||
AtomicNumbers.H = 1;
|
||||
|
||||
@@ -5,7 +5,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [ClassDeclarationWithInvalidConstOnPropertyDeclaration2.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
this.x = 10;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ for (var v of new StringIterator) { }
|
||||
|
||||
//// [ES5For-ofTypeCheck10.js]
|
||||
// In ES3/5, you cannot for...of over an arbitrary iterable.
|
||||
var StringIterator = (function () {
|
||||
var StringIterator = /** @class */ (function () {
|
||||
function StringIterator() {
|
||||
}
|
||||
StringIterator.prototype.next = function () {
|
||||
|
||||
@@ -14,7 +14,7 @@ module M {
|
||||
var M;
|
||||
(function (M) {
|
||||
var Symbol;
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[Symbol.iterator] = function () { };
|
||||
|
||||
@@ -9,7 +9,7 @@ class C {
|
||||
|
||||
//// [ES5SymbolProperty3.js]
|
||||
var Symbol;
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[Symbol.iterator] = function () { };
|
||||
|
||||
@@ -9,7 +9,7 @@ class C {
|
||||
|
||||
//// [ES5SymbolProperty4.js]
|
||||
var Symbol;
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[Symbol.iterator] = function () { };
|
||||
|
||||
@@ -9,7 +9,7 @@ class C {
|
||||
|
||||
//// [ES5SymbolProperty5.js]
|
||||
var Symbol;
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[Symbol.iterator] = function () { };
|
||||
|
||||
@@ -6,7 +6,7 @@ class C {
|
||||
(new C)[Symbol.iterator]
|
||||
|
||||
//// [ES5SymbolProperty6.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[Symbol.iterator] = function () { };
|
||||
|
||||
@@ -9,7 +9,7 @@ class C {
|
||||
|
||||
//// [ES5SymbolProperty7.js]
|
||||
var Symbol;
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[Symbol.iterator] = function () { };
|
||||
|
||||
@@ -23,7 +23,7 @@ var enumdule;
|
||||
enumdule[enumdule["Blue"] = 1] = "Blue";
|
||||
})(enumdule || (enumdule = {}));
|
||||
(function (enumdule) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
@@ -6,7 +6,7 @@ export = B;
|
||||
|
||||
//// [ExportAssignment7.js]
|
||||
"use strict";
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
|
||||
@@ -6,7 +6,7 @@ export class C {
|
||||
|
||||
//// [ExportAssignment8.js]
|
||||
"use strict";
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
|
||||
@@ -22,7 +22,7 @@ module A {
|
||||
//// [ExportClassWhichExtendsInterfaceWithInaccessibleType.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point2d = (function () {
|
||||
var Point2d = /** @class */ (function () {
|
||||
function Point2d(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
+3
-3
@@ -33,14 +33,14 @@ var __extends = (this && this.__extends) || (function () {
|
||||
})();
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point() {
|
||||
}
|
||||
return Point;
|
||||
}());
|
||||
A.Point = Point;
|
||||
A.Origin = { x: 0, y: 0 };
|
||||
var Point3d = (function (_super) {
|
||||
var Point3d = /** @class */ (function (_super) {
|
||||
__extends(Point3d, _super);
|
||||
function Point3d() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
@@ -49,7 +49,7 @@ var A;
|
||||
}(Point));
|
||||
A.Point3d = Point3d;
|
||||
A.Origin3d = { x: 0, y: 0, z: 0 };
|
||||
var Line = (function () {
|
||||
var Line = /** @class */ (function () {
|
||||
function Line(start, end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
|
||||
+2
-2
@@ -18,12 +18,12 @@ module A {
|
||||
//// [ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point() {
|
||||
}
|
||||
return Point;
|
||||
}());
|
||||
var points = (function () {
|
||||
var points = /** @class */ (function () {
|
||||
function points() {
|
||||
}
|
||||
return points;
|
||||
|
||||
+3
-3
@@ -37,13 +37,13 @@ var __extends = (this && this.__extends) || (function () {
|
||||
})();
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point() {
|
||||
}
|
||||
return Point;
|
||||
}());
|
||||
A.Origin = { x: 0, y: 0 };
|
||||
var Point3d = (function (_super) {
|
||||
var Point3d = /** @class */ (function (_super) {
|
||||
__extends(Point3d, _super);
|
||||
function Point3d() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
@@ -52,7 +52,7 @@ var A;
|
||||
}(Point));
|
||||
A.Point3d = Point3d;
|
||||
A.Origin3d = { x: 0, y: 0, z: 0 };
|
||||
var Line = (function () {
|
||||
var Line = /** @class */ (function () {
|
||||
function Line(start, end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
|
||||
+2
-2
@@ -18,13 +18,13 @@ module A {
|
||||
//// [ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point() {
|
||||
}
|
||||
return Point;
|
||||
}());
|
||||
A.Point = Point;
|
||||
var Line = (function () {
|
||||
var Line = /** @class */ (function () {
|
||||
function Line(start, end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
|
||||
+2
-2
@@ -18,12 +18,12 @@ module A {
|
||||
//// [ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point() {
|
||||
}
|
||||
return Point;
|
||||
}());
|
||||
var Line = (function () {
|
||||
var Line = /** @class */ (function () {
|
||||
function Line(start, end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
|
||||
+2
-2
@@ -18,13 +18,13 @@ module A {
|
||||
//// [ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point() {
|
||||
}
|
||||
return Point;
|
||||
}());
|
||||
A.Point = Point;
|
||||
var Line = (function () {
|
||||
var Line = /** @class */ (function () {
|
||||
function Line(start, end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
|
||||
@@ -23,7 +23,7 @@ module A {
|
||||
//// [ExportModuleWithAccessibleTypesOnItsExportedMembers.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -34,7 +34,7 @@ var A;
|
||||
var B;
|
||||
(function (B) {
|
||||
B.Origin = new Point(0, 0);
|
||||
var Line = (function () {
|
||||
var Line = /** @class */ (function () {
|
||||
function Line(start, end) {
|
||||
}
|
||||
Line.fromOrigin = function (p) {
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ module A {
|
||||
//// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ module A {
|
||||
//// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ module A {
|
||||
//// [ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var B = (function () {
|
||||
var B = /** @class */ (function () {
|
||||
function B() {
|
||||
}
|
||||
return B;
|
||||
|
||||
@@ -4,7 +4,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [MemberAccessorDeclaration15.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "Foo", {
|
||||
|
||||
@@ -48,7 +48,7 @@ var X;
|
||||
var Y;
|
||||
(function (Y) {
|
||||
// duplicate identifier
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -64,7 +64,7 @@ var A;
|
||||
A.Instance = new A();
|
||||
})(A || (A = {}));
|
||||
// duplicate identifier
|
||||
var A = (function () {
|
||||
var A = /** @class */ (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
|
||||
@@ -19,7 +19,7 @@ var y = new enumdule.Point(0, 0);
|
||||
//// [ModuleAndEnumWithSameNameAndCommonRoot.js]
|
||||
var enumdule;
|
||||
(function (enumdule) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
@@ -36,24 +36,24 @@ var ag2 = new A.A2<string, number>();
|
||||
//// [ModuleWithExportedAndNonExportedClasses.js]
|
||||
var A;
|
||||
(function (A_1) {
|
||||
var A = (function () {
|
||||
var A = /** @class */ (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
A_1.A = A;
|
||||
var AG = (function () {
|
||||
var AG = /** @class */ (function () {
|
||||
function AG() {
|
||||
}
|
||||
return AG;
|
||||
}());
|
||||
A_1.AG = AG;
|
||||
var A2 = (function () {
|
||||
var A2 = /** @class */ (function () {
|
||||
function A2() {
|
||||
}
|
||||
return A2;
|
||||
}());
|
||||
var AG2 = (function () {
|
||||
var AG2 = /** @class */ (function () {
|
||||
function AG2() {
|
||||
}
|
||||
return AG2;
|
||||
|
||||
@@ -42,7 +42,7 @@ var line = Geometry.Lines.Line;
|
||||
//// [ModuleWithExportedAndNonExportedImportAlias.js]
|
||||
var B;
|
||||
(function (B) {
|
||||
var Line = (function () {
|
||||
var Line = /** @class */ (function () {
|
||||
function Line(start, end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
|
||||
@@ -40,7 +40,7 @@ var Inner;
|
||||
var ;
|
||||
let;
|
||||
var ;
|
||||
var A = (function () {
|
||||
var A = /** @class */ (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
@@ -58,7 +58,7 @@ var Inner;
|
||||
Inner.b1 = 1;
|
||||
Inner.c1 = 'a';
|
||||
Inner.d1 = 1;
|
||||
var D = (function () {
|
||||
var D = /** @class */ (function () {
|
||||
function D() {
|
||||
}
|
||||
return D;
|
||||
|
||||
@@ -5,7 +5,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [ParameterList6.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C(C) {
|
||||
}
|
||||
return C;
|
||||
|
||||
@@ -6,7 +6,7 @@ class C1 {
|
||||
}
|
||||
|
||||
//// [ParameterList7.js]
|
||||
var C1 = (function () {
|
||||
var C1 = /** @class */ (function () {
|
||||
function C1(p3) {
|
||||
this.p3 = p3;
|
||||
} // OK
|
||||
|
||||
@@ -3,7 +3,7 @@ protected class C {
|
||||
}
|
||||
|
||||
//// [Protected1.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
|
||||
@@ -4,7 +4,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [Protected3.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
|
||||
@@ -4,7 +4,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [Protected4.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.m = function () { };
|
||||
|
||||
@@ -4,7 +4,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [Protected5.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.m = function () { };
|
||||
|
||||
@@ -4,7 +4,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [Protected6.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.m = function () { };
|
||||
|
||||
@@ -4,7 +4,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [Protected7.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.m = function () { };
|
||||
|
||||
@@ -4,7 +4,7 @@ class C {
|
||||
}
|
||||
|
||||
//// [Protected9.js]
|
||||
var C = (function () {
|
||||
var C = /** @class */ (function () {
|
||||
function C(p) {
|
||||
this.p = p;
|
||||
}
|
||||
|
||||
+4
-4
@@ -43,7 +43,7 @@ var l: X.Y.Z.Line;
|
||||
//// [TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point() {
|
||||
}
|
||||
return Point;
|
||||
@@ -51,7 +51,7 @@ var A;
|
||||
A.Point = Point;
|
||||
})(A || (A = {}));
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point() {
|
||||
}
|
||||
Point.prototype.fromCarthesian = function (p) {
|
||||
@@ -69,7 +69,7 @@ var X;
|
||||
(function (Y) {
|
||||
var Z;
|
||||
(function (Z) {
|
||||
var Line = (function () {
|
||||
var Line = /** @class */ (function () {
|
||||
function Line() {
|
||||
}
|
||||
return Line;
|
||||
@@ -83,7 +83,7 @@ var X;
|
||||
(function (Y) {
|
||||
var Z;
|
||||
(function (Z) {
|
||||
var Line = (function () {
|
||||
var Line = /** @class */ (function () {
|
||||
function Line() {
|
||||
}
|
||||
return Line;
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ var A;
|
||||
var Origin = "0,0";
|
||||
var Utils;
|
||||
(function (Utils) {
|
||||
var Plane = (function () {
|
||||
var Plane = /** @class */ (function () {
|
||||
function Plane(tl, br) {
|
||||
this.tl = tl;
|
||||
this.br = br;
|
||||
|
||||
+4
-4
@@ -35,7 +35,7 @@ module X {
|
||||
//// [TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point() {
|
||||
}
|
||||
return Point;
|
||||
@@ -44,7 +44,7 @@ var A;
|
||||
})(A || (A = {}));
|
||||
(function (A) {
|
||||
// expected error
|
||||
var Point = (function () {
|
||||
var Point = /** @class */ (function () {
|
||||
function Point() {
|
||||
}
|
||||
return Point;
|
||||
@@ -57,7 +57,7 @@ var X;
|
||||
(function (Y) {
|
||||
var Z;
|
||||
(function (Z) {
|
||||
var Line = (function () {
|
||||
var Line = /** @class */ (function () {
|
||||
function Line() {
|
||||
}
|
||||
return Line;
|
||||
@@ -72,7 +72,7 @@ var X;
|
||||
var Z;
|
||||
(function (Z) {
|
||||
// expected error
|
||||
var Line = (function () {
|
||||
var Line = /** @class */ (function () {
|
||||
function Line() {
|
||||
}
|
||||
return Line;
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ var A;
|
||||
A.Origin = { x: 0, y: 0 };
|
||||
var Utils;
|
||||
(function (Utils) {
|
||||
var Plane = (function () {
|
||||
var Plane = /** @class */ (function () {
|
||||
function Plane(tl, br) {
|
||||
this.tl = tl;
|
||||
this.br = br;
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ var X;
|
||||
(function (Y) {
|
||||
var Z;
|
||||
(function (Z) {
|
||||
var Line = (function () {
|
||||
var Line = /** @class */ (function () {
|
||||
function Line() {
|
||||
}
|
||||
return Line;
|
||||
@@ -69,7 +69,7 @@ var X;
|
||||
(function (Y) {
|
||||
var Z;
|
||||
(function (Z) {
|
||||
var Line = (function () {
|
||||
var Line = /** @class */ (function () {
|
||||
function Line() {
|
||||
}
|
||||
return Line;
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ var otherRoot;
|
||||
A.Origin = { x: 0, y: 0 };
|
||||
var Utils;
|
||||
(function (Utils) {
|
||||
var Plane = (function () {
|
||||
var Plane = /** @class */ (function () {
|
||||
function Plane(tl, br) {
|
||||
this.tl = tl;
|
||||
this.br = br;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user