Skip to content

Commit 126f1bc

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 87cf4ad + dc113f8 commit 126f1bc

File tree

402 files changed

+1515
-1234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

402 files changed

+1515
-1234
lines changed

src/compiler/checker.ts

+36-199
Large diffs are not rendered by default.

src/compiler/diagnosticMessages.json

+8
Original file line numberDiff line numberDiff line change
@@ -7976,5 +7976,13 @@
79767976
"'await using' statements cannot be used inside a class static block.": {
79777977
"category": "Error",
79787978
"code": 18054
7979+
},
7980+
"'{0}' has a string type, but must have syntactically recognizable string syntax when 'isolatedModules' is enabled.": {
7981+
"category": "Error",
7982+
"code": 18055
7983+
},
7984+
"Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled.": {
7985+
"category": "Error",
7986+
"code": 18056
79797987
}
79807988
}

src/compiler/emitter.ts

+14-19
Original file line numberDiff line numberDiff line change
@@ -1106,20 +1106,15 @@ export const notImplementedResolver: EmitResolver = {
11061106
getReferencedValueDeclarations: notImplemented,
11071107
getTypeReferenceSerializationKind: notImplemented,
11081108
isOptionalParameter: notImplemented,
1109-
moduleExportsSomeValue: notImplemented,
11101109
isArgumentsLocalBinding: notImplemented,
11111110
getExternalModuleFileFromDeclaration: notImplemented,
1112-
getTypeReferenceDirectivesForEntityName: notImplemented,
1113-
getTypeReferenceDirectivesForSymbol: notImplemented,
11141111
isLiteralConstDeclaration: notImplemented,
11151112
getJsxFactoryEntity: notImplemented,
11161113
getJsxFragmentFactoryEntity: notImplemented,
11171114
getAllAccessorDeclarations: notImplemented,
1118-
getSymbolOfExternalModuleSpecifier: notImplemented,
11191115
isBindingCapturedByNode: notImplemented,
11201116
getDeclarationStatementsForSourceFile: notImplemented,
11211117
isImportRequiredByAugmentation: notImplemented,
1122-
tryFindAmbientModule: notImplemented,
11231118
};
11241119

11251120
const enum PipelinePhase {
@@ -4185,21 +4180,21 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
41854180
writeLine();
41864181
}
41874182
}
4188-
for (const directive of files) {
4189-
writeComment(`/// <reference path="${directive.fileName}" />`);
4190-
writeLine();
4191-
}
4192-
for (const directive of types) {
4193-
const resolutionMode = directive.resolutionMode && directive.resolutionMode !== currentSourceFile?.impliedNodeFormat
4194-
? `resolution-mode="${directive.resolutionMode === ModuleKind.ESNext ? "import" : "require"}"`
4195-
: "";
4196-
writeComment(`/// <reference types="${directive.fileName}" ${resolutionMode}/>`);
4197-
writeLine();
4198-
}
4199-
for (const directive of libs) {
4200-
writeComment(`/// <reference lib="${directive.fileName}" />`);
4201-
writeLine();
4183+
4184+
function writeDirectives(kind: "path" | "types" | "lib", directives: readonly FileReference[]) {
4185+
for (const directive of directives) {
4186+
const preserve = directive.preserve ? `preserve="true" ` : "";
4187+
const resolutionMode = directive.resolutionMode && directive.resolutionMode !== currentSourceFile?.impliedNodeFormat
4188+
? `resolution-mode="${directive.resolutionMode === ModuleKind.ESNext ? "import" : "require"}" `
4189+
: "";
4190+
writeComment(`/// <reference ${kind}="${directive.fileName}" ${resolutionMode}${preserve}/>`);
4191+
writeLine();
4192+
}
42024193
}
4194+
4195+
writeDirectives("path", files);
4196+
writeDirectives("types", types);
4197+
writeDirectives("lib", libs);
42034198
}
42044199

42054200
function emitSourceFileWorker(node: SourceFile) {

src/compiler/parser.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -9227,7 +9227,7 @@ namespace Parser {
92279227

92289228
let name: EntityName | JSDocMemberName = parseIdentifierName();
92299229
while (parseOptional(SyntaxKind.DotToken)) {
9230-
name = finishNode(factory.createQualifiedName(name, token() === SyntaxKind.PrivateIdentifier ? createMissingNode<Identifier>(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ false) : parseIdentifier()), pos);
9230+
name = finishNode(factory.createQualifiedName(name, token() === SyntaxKind.PrivateIdentifier ? createMissingNode<Identifier>(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ false) : parseIdentifierName()), pos);
92319231
}
92329232
while (token() === SyntaxKind.PrivateIdentifier) {
92339233
reScanHashToken();
@@ -10510,19 +10510,20 @@ export function processPragmasIntoFields(context: PragmaContext, reportDiagnosti
1051010510
const typeReferenceDirectives = context.typeReferenceDirectives;
1051110511
const libReferenceDirectives = context.libReferenceDirectives;
1051210512
forEach(toArray(entryOrList) as PragmaPseudoMap["reference"][], arg => {
10513-
const { types, lib, path, ["resolution-mode"]: res } = arg.arguments;
10513+
const { types, lib, path, ["resolution-mode"]: res, preserve: _preserve } = arg.arguments;
10514+
const preserve = _preserve === "true" ? true : undefined;
1051410515
if (arg.arguments["no-default-lib"] === "true") {
1051510516
context.hasNoDefaultLib = true;
1051610517
}
1051710518
else if (types) {
1051810519
const parsed = parseResolutionMode(res, types.pos, types.end, reportDiagnostic);
10519-
typeReferenceDirectives.push({ pos: types.pos, end: types.end, fileName: types.value, ...(parsed ? { resolutionMode: parsed } : {}) });
10520+
typeReferenceDirectives.push({ pos: types.pos, end: types.end, fileName: types.value, ...(parsed ? { resolutionMode: parsed } : {}), ...(preserve ? { preserve } : {}) });
1052010521
}
1052110522
else if (lib) {
10522-
libReferenceDirectives.push({ pos: lib.pos, end: lib.end, fileName: lib.value });
10523+
libReferenceDirectives.push({ pos: lib.pos, end: lib.end, fileName: lib.value, ...(preserve ? { preserve } : {}) });
1052310524
}
1052410525
else if (path) {
10525-
referencedFiles.push({ pos: path.pos, end: path.end, fileName: path.value });
10526+
referencedFiles.push({ pos: path.pos, end: path.end, fileName: path.value, ...(preserve ? { preserve } : {}) });
1052610527
}
1052710528
else {
1052810529
reportDiagnostic(arg.range.pos, arg.range.end - arg.range.pos, Diagnostics.Invalid_reference_directive_syntax);

src/compiler/program.ts

-1
Original file line numberDiff line numberDiff line change
@@ -2630,7 +2630,6 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
26302630
getSourceFile: program.getSourceFile,
26312631
getSourceFileByPath: program.getSourceFileByPath,
26322632
getSourceFiles: program.getSourceFiles,
2633-
getLibFileFromReference: program.getLibFileFromReference,
26342633
isSourceFileFromExternalLibrary,
26352634
getResolvedProjectReferenceToRedirect,
26362635
getProjectReferenceRedirect,

0 commit comments

Comments
 (0)