mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Ensure late painted statements are only transformed once, so inner substitutions are consistently read (#48558)
* Ensure late painted statements are only transformed once, so inner substitutions are consistently read * PR suggestion * Fix lint
This commit is contained in:
parent
702bc5222b
commit
94d33ba85d
@ -1163,6 +1163,9 @@ namespace ts {
|
||||
}
|
||||
|
||||
function transformTopLevelDeclaration(input: LateVisibilityPaintedStatement) {
|
||||
if (lateMarkedStatements) {
|
||||
while (orderedRemoveItem(lateMarkedStatements, input));
|
||||
}
|
||||
if (shouldStripInternal(input)) return;
|
||||
switch (input.kind) {
|
||||
case SyntaxKind.ImportEqualsDeclaration: {
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
//// [declarationEmitNamespaceMergedWithInterfaceNestedFunction.ts]
|
||||
export interface Foo {
|
||||
item: Bar;
|
||||
}
|
||||
|
||||
interface Bar {
|
||||
baz(): void;
|
||||
}
|
||||
|
||||
namespace Bar {
|
||||
export function biz() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//// [declarationEmitNamespaceMergedWithInterfaceNestedFunction.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var Bar;
|
||||
(function (Bar) {
|
||||
function biz() {
|
||||
return 0;
|
||||
}
|
||||
Bar.biz = biz;
|
||||
})(Bar || (Bar = {}));
|
||||
|
||||
|
||||
//// [declarationEmitNamespaceMergedWithInterfaceNestedFunction.d.ts]
|
||||
export interface Foo {
|
||||
item: Bar;
|
||||
}
|
||||
interface Bar {
|
||||
baz(): void;
|
||||
}
|
||||
declare namespace Bar {
|
||||
function biz(): number;
|
||||
}
|
||||
export {};
|
||||
@ -0,0 +1,25 @@
|
||||
=== tests/cases/compiler/declarationEmitNamespaceMergedWithInterfaceNestedFunction.ts ===
|
||||
export interface Foo {
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitNamespaceMergedWithInterfaceNestedFunction.ts, 0, 0))
|
||||
|
||||
item: Bar;
|
||||
>item : Symbol(Foo.item, Decl(declarationEmitNamespaceMergedWithInterfaceNestedFunction.ts, 0, 22))
|
||||
>Bar : Symbol(Bar, Decl(declarationEmitNamespaceMergedWithInterfaceNestedFunction.ts, 2, 1), Decl(declarationEmitNamespaceMergedWithInterfaceNestedFunction.ts, 6, 1))
|
||||
}
|
||||
|
||||
interface Bar {
|
||||
>Bar : Symbol(Bar, Decl(declarationEmitNamespaceMergedWithInterfaceNestedFunction.ts, 2, 1), Decl(declarationEmitNamespaceMergedWithInterfaceNestedFunction.ts, 6, 1))
|
||||
|
||||
baz(): void;
|
||||
>baz : Symbol(Bar.baz, Decl(declarationEmitNamespaceMergedWithInterfaceNestedFunction.ts, 4, 15))
|
||||
}
|
||||
|
||||
namespace Bar {
|
||||
>Bar : Symbol(Bar, Decl(declarationEmitNamespaceMergedWithInterfaceNestedFunction.ts, 2, 1), Decl(declarationEmitNamespaceMergedWithInterfaceNestedFunction.ts, 6, 1))
|
||||
|
||||
export function biz() {
|
||||
>biz : Symbol(biz, Decl(declarationEmitNamespaceMergedWithInterfaceNestedFunction.ts, 8, 15))
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/declarationEmitNamespaceMergedWithInterfaceNestedFunction.ts ===
|
||||
export interface Foo {
|
||||
item: Bar;
|
||||
>item : Bar
|
||||
}
|
||||
|
||||
interface Bar {
|
||||
baz(): void;
|
||||
>baz : () => void
|
||||
}
|
||||
|
||||
namespace Bar {
|
||||
>Bar : typeof Bar
|
||||
|
||||
export function biz() {
|
||||
>biz : () => number
|
||||
|
||||
return 0;
|
||||
>0 : 0
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
// @declaration: true
|
||||
export interface Foo {
|
||||
item: Bar;
|
||||
}
|
||||
|
||||
interface Bar {
|
||||
baz(): void;
|
||||
}
|
||||
|
||||
namespace Bar {
|
||||
export function biz() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user