fix(compiler-cli): do not lower expressions in non-modules (#21649)
Fixes: #21651 PR Close #21649
This commit is contained in:

committed by
Miško Hevery

parent
982eb7bba8
commit
ba4ea82f68
@ -99,7 +99,17 @@ describe('Expression lowering', () => {
|
||||
.toBeTruthy('did not find the data field');
|
||||
});
|
||||
|
||||
it('should throw a validation execption for invalid files', () => {
|
||||
it('should not lower a non-module', () => {
|
||||
const collected = collect(`
|
||||
declare const global: any;
|
||||
const ngDevMode: boolean = (function(global: any) {
|
||||
return global.ngDevMode = true;
|
||||
})(typeof window != 'undefined' && window || typeof self != 'undefined' && self || typeof global != 'undefined' && global);
|
||||
`);
|
||||
expect(collected.requests.size).toBe(0, 'unexpected rewriting');
|
||||
});
|
||||
|
||||
it('should throw a validation exception for invalid files', () => {
|
||||
const cache = new LowerMetadataCache({}, /* strict */ true);
|
||||
const sourceFile = ts.createSourceFile(
|
||||
'foo.ts', `
|
||||
|
Reference in New Issue
Block a user