This reverts commit 7e9d5f5e826ee80b60d6f6e6e5d17dc94cb491c3. The changes to the case-sensitivity handling in #36968 caused multiple projects to fail to build. See #36992, #36993 and #37000. The issue is related to the logical path handling. But it is felt that it is safer to revert the entire PR and then to investigate further. PR Close #37003
This commit is contained in:
parent
bf446cb2d5
commit
6cce05e2c5
@ -486,8 +486,7 @@ export class NgCompiler {
|
||||
// Execute the typeCheck phase of each decorator in the program.
|
||||
const prepSpan = this.perfRecorder.start('typeCheckPrep');
|
||||
const ctx = new TypeCheckContext(
|
||||
typeCheckingConfig, host, compilation.refEmitter!, compilation.reflector,
|
||||
host.typeCheckFile);
|
||||
typeCheckingConfig, compilation.refEmitter!, compilation.reflector, host.typeCheckFile);
|
||||
compilation.traitCompiler.typeCheck(ctx);
|
||||
this.perfRecorder.stop(prepSpan);
|
||||
|
||||
|
@ -38,11 +38,9 @@ export class TypeCheckContext {
|
||||
private typeCheckFile: TypeCheckFile;
|
||||
|
||||
constructor(
|
||||
private config: TypeCheckingConfig, compilerHost: ts.CompilerHost,
|
||||
private refEmitter: ReferenceEmitter, private reflector: ReflectionHost,
|
||||
typeCheckFilePath: AbsoluteFsPath) {
|
||||
this.typeCheckFile =
|
||||
new TypeCheckFile(typeCheckFilePath, config, refEmitter, reflector, compilerHost);
|
||||
private config: TypeCheckingConfig, private refEmitter: ReferenceEmitter,
|
||||
private reflector: ReflectionHost, typeCheckFilePath: AbsoluteFsPath) {
|
||||
this.typeCheckFile = new TypeCheckFile(typeCheckFilePath, config, refEmitter, reflector);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,12 +33,11 @@ export class TypeCheckFile extends Environment {
|
||||
private tcbStatements: ts.Statement[] = [];
|
||||
|
||||
constructor(
|
||||
readonly fileName: AbsoluteFsPath, config: TypeCheckingConfig, refEmitter: ReferenceEmitter,
|
||||
reflector: ReflectionHost, compilerHost: ts.CompilerHost) {
|
||||
private fileName: string, config: TypeCheckingConfig, refEmitter: ReferenceEmitter,
|
||||
reflector: ReflectionHost) {
|
||||
super(
|
||||
config, new ImportManager(new NoopImportRewriter(), 'i'), refEmitter, reflector,
|
||||
ts.createSourceFile(
|
||||
compilerHost.getCanonicalFileName(fileName), '', ts.ScriptTarget.Latest, true));
|
||||
ts.createSourceFile(fileName, '', ts.ScriptTarget.Latest, true));
|
||||
}
|
||||
|
||||
addTypeCheckBlock(
|
||||
@ -50,7 +49,7 @@ export class TypeCheckFile extends Environment {
|
||||
}
|
||||
|
||||
render(): ts.SourceFile {
|
||||
let source: string = this.importManager.getAllImports(this.contextFile.fileName)
|
||||
let source: string = this.importManager.getAllImports(this.fileName)
|
||||
.map(i => `import * as ${i.qualifier} from '${i.specifier}';`)
|
||||
.join('\n') +
|
||||
'\n\n';
|
||||
@ -76,7 +75,7 @@ export class TypeCheckFile extends Environment {
|
||||
source += '\nexport const IS_A_MODULE = true;\n';
|
||||
|
||||
return ts.createSourceFile(
|
||||
this.contextFile.fileName, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
||||
this.fileName, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
||||
}
|
||||
|
||||
getPreludeStatements(): ts.Statement[] {
|
||||
|
@ -262,7 +262,7 @@ export function typecheck(
|
||||
new LogicalProjectStrategy(reflectionHost, logicalFs),
|
||||
]);
|
||||
const ctx = new TypeCheckContext(
|
||||
{...ALL_ENABLED_CONFIG, ...config}, host, emitter, reflectionHost, typeCheckFilePath);
|
||||
{...ALL_ENABLED_CONFIG, ...config}, emitter, reflectionHost, typeCheckFilePath);
|
||||
|
||||
const templateUrl = 'synthetic.html';
|
||||
const templateFile = new ParseSourceFile(template, templateUrl);
|
||||
|
@ -45,7 +45,7 @@ runInEachFileSystem(() => {
|
||||
const host = new NgtscCompilerHost(getFileSystem());
|
||||
const file = new TypeCheckFile(
|
||||
_('/_typecheck_.ts'), ALL_ENABLED_CONFIG, new ReferenceEmitter([]),
|
||||
/* reflector */ null!, host);
|
||||
/* reflector */ null!);
|
||||
const sf = file.render();
|
||||
expect(sf.statements.length).toBe(1);
|
||||
});
|
||||
@ -75,8 +75,8 @@ TestClass.ngTypeCtor({value: 'test'});
|
||||
new AbsoluteModuleStrategy(program, checker, moduleResolver, reflectionHost),
|
||||
new LogicalProjectStrategy(reflectionHost, logicalFs),
|
||||
]);
|
||||
const ctx = new TypeCheckContext(
|
||||
ALL_ENABLED_CONFIG, host, emitter, reflectionHost, _('/_typecheck_.ts'));
|
||||
const ctx =
|
||||
new TypeCheckContext(ALL_ENABLED_CONFIG, emitter, reflectionHost, _('/_typecheck_.ts'));
|
||||
const TestClass =
|
||||
getDeclaration(program, _('/main.ts'), 'TestClass', isNamedClassDeclaration);
|
||||
ctx.addInlineTypeCtor(
|
||||
@ -111,8 +111,8 @@ TestClass.ngTypeCtor({value: 'test'});
|
||||
new AbsoluteModuleStrategy(program, checker, moduleResolver, reflectionHost),
|
||||
new LogicalProjectStrategy(reflectionHost, logicalFs),
|
||||
]);
|
||||
const ctx = new TypeCheckContext(
|
||||
ALL_ENABLED_CONFIG, host, emitter, reflectionHost, _('/_typecheck_.ts'));
|
||||
const ctx =
|
||||
new TypeCheckContext(ALL_ENABLED_CONFIG, emitter, reflectionHost, _('/_typecheck_.ts'));
|
||||
const TestClass =
|
||||
getDeclaration(program, _('/main.ts'), 'TestClass', isNamedClassDeclaration);
|
||||
ctx.addInlineTypeCtor(
|
||||
@ -153,8 +153,8 @@ TestClass.ngTypeCtor({value: 'test'});
|
||||
new AbsoluteModuleStrategy(program, checker, moduleResolver, reflectionHost),
|
||||
new LogicalProjectStrategy(reflectionHost, logicalFs),
|
||||
]);
|
||||
const ctx = new TypeCheckContext(
|
||||
ALL_ENABLED_CONFIG, host, emitter, reflectionHost, _('/_typecheck_.ts'));
|
||||
const ctx =
|
||||
new TypeCheckContext(ALL_ENABLED_CONFIG, emitter, reflectionHost, _('/_typecheck_.ts'));
|
||||
const TestClass =
|
||||
getDeclaration(program, _('/main.ts'), 'TestClass', isNamedClassDeclaration);
|
||||
ctx.addInlineTypeCtor(
|
||||
|
Loading…
x
Reference in New Issue
Block a user