Skip to content

Commit 7367bf6

Browse files
committed
Study what happens when you type tsc (to scanner)
1 parent 5ec5815 commit 7367bf6

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-11
lines changed

src/compiler/parser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ namespace ts {
595595
}
596596
}
597597

598+
/** 单个文件的parser */
598599
export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false, scriptKind?: ScriptKind): SourceFile {
599600
performance.mark("beforeParse");
600601
let result: SourceFile;
@@ -775,7 +776,7 @@ namespace ts {
775776
let parseErrorBeforeNextFinishedNode = false;
776777

777778
/**
778-
* 设置初始状态,并将工作交给 parseSourceFileWorker 函数(For simplified Stack)
779+
* Do parser. 设置初始状态,并将工作交给 parseSourceFileWorker 函数
779780
* @param fileName The name of source file
780781
* @param sourceText The text of source file
781782
* @param languageVersion 编译后的版本,如es5, es6等

src/compiler/program.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ namespace ts {
708708
let noDiagnosticsTypeChecker: TypeChecker;
709709
let classifiableNames: UnderscoreEscapedMap<true>;
710710
const ambientModuleNameToUnmodifiedFileName = createMap<string>();
711-
// Todo:: Use this to report why file was included in --extendedDiagnostics
711+
// TODO: Use this to report why file was included in --extendedDiagnostics
712712
let refFileMap: MultiMap<ts.RefFile> | undefined;
713713

714714
const cachedBindAndCheckDiagnosticsForFile: DiagnosticCache<Diagnostic> = {};
@@ -2239,7 +2239,8 @@ namespace ts {
22392239
fileName: string,
22402240
getSourceFile: (fileName: string) => SourceFile | undefined,
22412241
fail?: (diagnostic: DiagnosticMessage, ...argument: string[]) => void,
2242-
refFile?: SourceFile): SourceFile | undefined {
2242+
refFile?: SourceFile
2243+
): SourceFile | undefined {
22432244

22442245
if (hasExtension(fileName)) {
22452246
const canonicalFileName = host.getCanonicalFileName(fileName);
@@ -2339,7 +2340,7 @@ namespace ts {
23392340
return redirect;
23402341
}
23412342

2342-
// Get source file from normalized fileName
2343+
/** Get source file from normalized fileName */
23432344
function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, refFile: RefFile | undefined, packageId: PackageId | undefined): SourceFile | undefined {
23442345
if (useSourceOfProjectReferenceRedirect) {
23452346
let source = getSourceOfProjectReferenceRedirect(fileName);
@@ -2543,7 +2544,6 @@ namespace ts {
25432544
return getResolvedProjectReferenceToRedirect(fileName);
25442545
}
25452546

2546-
25472547
function getProjectReferenceOutputName(referencedProject: ResolvedProjectReference, fileName: string) {
25482548
const out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
25492549
return out ?

0 commit comments

Comments
 (0)