fix(compiler): don't convert undefined to null literals (#11503)
Fixes #11493
This commit is contained in:

committed by
vikerman

parent
051d74802a
commit
f0cdb428f5
@ -105,6 +105,11 @@ export function main() {
|
||||
expect(emitStmt(o.literalMap([['someKey', o.literal(1)]]).toStmt())).toEqual(`{someKey: 1};`);
|
||||
});
|
||||
|
||||
it('should support blank literals', () => {
|
||||
expect(emitStmt(o.literal(null).toStmt())).toEqual('null;');
|
||||
expect(emitStmt(o.literal(undefined).toStmt())).toEqual('undefined;');
|
||||
});
|
||||
|
||||
it('should support external identifiers', () => {
|
||||
expect(emitStmt(o.importExpr(sameModuleIdentifier).toStmt())).toEqual('someLocalId;');
|
||||
expect(emitStmt(o.importExpr(externalModuleIdentifier).toStmt())).toEqual([
|
||||
|
@ -107,6 +107,11 @@ export function main() {
|
||||
expect(emitStmt(o.literalMap([['someKey', o.literal(1)]]).toStmt())).toEqual(`{someKey: 1};`);
|
||||
});
|
||||
|
||||
it('should support blank literals', () => {
|
||||
expect(emitStmt(o.literal(null).toStmt())).toEqual('(null as any);');
|
||||
expect(emitStmt(o.literal(undefined).toStmt())).toEqual('(undefined as any);');
|
||||
});
|
||||
|
||||
it('should support external identifiers', () => {
|
||||
expect(emitStmt(o.importExpr(sameModuleIdentifier).toStmt())).toEqual('someLocalId;');
|
||||
expect(emitStmt(o.importExpr(externalModuleIdentifier).toStmt())).toEqual([
|
||||
|
Reference in New Issue
Block a user