Skip to content

Commit fc37b79

Browse files
authored
Stop not emitting mappings for function and class names (microsoft#25210)
1 parent b59824a commit fc37b79

File tree

805 files changed

+1898
-1285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

805 files changed

+1898
-1285
lines changed

src/compiler/emitter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ namespace ts {
545545
return pipelineEmitWithoutComments;
546546

547547
case PipelinePhase.SourceMaps:
548-
if (onEmitSourceMapOfNode && hint !== EmitHint.SourceFile && hint !== EmitHint.IdentifierName) {
548+
if (onEmitSourceMapOfNode && hint !== EmitHint.SourceFile) {
549549
return pipelineEmitWithSourceMap;
550550
}
551551
// falls through
@@ -578,7 +578,7 @@ namespace ts {
578578
}
579579

580580
function pipelineEmitWithSourceMap(hint: EmitHint, node: Node) {
581-
Debug.assert(hint !== EmitHint.SourceFile && hint !== EmitHint.IdentifierName);
581+
Debug.assert(hint !== EmitHint.SourceFile);
582582
Debug.assertDefined(onEmitSourceMapOfNode)(hint, node, pipelineEmitWithHint);
583583
}
584584

tests/baselines/reference/ES5For-of34.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/ES5For-of34.sourcemap.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@ sourceFile:ES5For-of34.ts
2121
>>>var e_1, _a;
2222
>>>function foo() {
2323
1 >
24-
2 >^^^^^^^^^^^^^^^^^^^^^->
24+
2 >^^^^^^^^^
25+
3 > ^^^
26+
4 > ^^^^^^^^^->
2527
1 >
28+
2 >function
29+
3 > foo
2630
1 >Emitted(12, 1) Source(1, 1) + SourceIndex(0)
31+
2 >Emitted(12, 10) Source(1, 10) + SourceIndex(0)
32+
3 >Emitted(12, 13) Source(1, 13) + SourceIndex(0)
2733
---
2834
>>> return { x: 0 };
2935
1->^^^^
@@ -34,7 +40,7 @@ sourceFile:ES5For-of34.ts
3440
6 > ^
3541
7 > ^^
3642
8 > ^
37-
1->function foo() {
43+
1->() {
3844
>
3945
2 > return
4046
3 > {

tests/baselines/reference/ES5For-of8.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/ES5For-of8.sourcemap.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@ sourceFile:ES5For-of8.ts
1010
-------------------------------------------------------------------
1111
>>>function foo() {
1212
1 >
13-
2 >^^^^^^^^^^^^^^^^^^^^^->
13+
2 >^^^^^^^^^
14+
3 > ^^^
15+
4 > ^^^^^^^^^->
1416
1 >
17+
2 >function
18+
3 > foo
1519
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
20+
2 >Emitted(1, 10) Source(1, 10) + SourceIndex(0)
21+
3 >Emitted(1, 13) Source(1, 13) + SourceIndex(0)
1622
---
1723
>>> return { x: 0 };
1824
1->^^^^
@@ -23,7 +29,7 @@ sourceFile:ES5For-of8.ts
2329
6 > ^
2430
7 > ^^
2531
8 > ^
26-
1->function foo() {
32+
1->() {
2733
>
2834
2 > return
2935
3 > {

tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,23 @@ sourceFile:computedPropertyNamesSourceMap1_ES6.ts
1010
-------------------------------------------------------------------
1111
>>>class C {
1212
1 >
13-
2 >^^^^^^^^^^^^^^^^^^->
13+
2 >^^^^^^
14+
3 > ^
15+
4 > ^^^^^^^^^^^->
1416
1 >
17+
2 >class
18+
3 > C
1519
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
20+
2 >Emitted(1, 7) Source(1, 7) + SourceIndex(0)
21+
3 >Emitted(1, 8) Source(1, 8) + SourceIndex(0)
1622
---
1723
>>> ["hello"]() {
1824
1->^^^^
1925
2 > ^
2026
3 > ^^^^^^^
2127
4 > ^
2228
5 > ^^^^^->
23-
1->class C {
29+
1-> {
2430
>
2531
2 > [
2632
3 > "hello"

tests/baselines/reference/contextualTyping.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/contextualTyping.sourcemap.txt

Lines changed: 60 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,21 +2070,27 @@ sourceFile:contextualTyping.ts
20702070
---
20712071
>>>function c9t5(f) { }
20722072
1 >
2073-
2 >^^^^^^^^^^^^^^
2074-
3 > ^
2075-
4 > ^^^^
2076-
5 > ^
2073+
2 >^^^^^^^^^
2074+
3 > ^^^^
2075+
4 > ^
2076+
5 > ^
2077+
6 > ^^^^
2078+
7 > ^
20772079
1 >
20782080
>
2079-
2 >function c9t5(
2080-
3 > f: (n: number) => IFoo
2081-
4 > ) {
2082-
5 > }
2081+
2 >function
2082+
3 > c9t5
2083+
4 > (
2084+
5 > f: (n: number) => IFoo
2085+
6 > ) {
2086+
7 > }
20832087
1 >Emitted(86, 1) Source(146, 1) + SourceIndex(0)
2084-
2 >Emitted(86, 15) Source(146, 15) + SourceIndex(0)
2085-
3 >Emitted(86, 16) Source(146, 37) + SourceIndex(0)
2086-
4 >Emitted(86, 20) Source(146, 40) + SourceIndex(0)
2087-
5 >Emitted(86, 21) Source(146, 41) + SourceIndex(0)
2088+
2 >Emitted(86, 10) Source(146, 10) + SourceIndex(0)
2089+
3 >Emitted(86, 14) Source(146, 14) + SourceIndex(0)
2090+
4 >Emitted(86, 15) Source(146, 15) + SourceIndex(0)
2091+
5 >Emitted(86, 16) Source(146, 37) + SourceIndex(0)
2092+
6 >Emitted(86, 20) Source(146, 40) + SourceIndex(0)
2093+
7 >Emitted(86, 21) Source(146, 41) + SourceIndex(0)
20882094
---
20892095
>>>;
20902096
1 >
@@ -3019,18 +3025,20 @@ sourceFile:contextualTyping.ts
30193025
---
30203026
>>>function EF1(a, b) { return a + b; }
30213027
1->
3022-
2 >^^^^^^^^^^^^^
3023-
3 > ^
3024-
4 > ^^
3025-
5 > ^
3026-
6 > ^^^^
3027-
7 > ^^^^^^^
3028-
8 > ^
3029-
9 > ^^^
3030-
10> ^
3031-
11> ^
3032-
12> ^
3033-
13> ^
3028+
2 >^^^^^^^^^
3029+
3 > ^^^
3030+
4 > ^
3031+
5 > ^
3032+
6 > ^^
3033+
7 > ^
3034+
8 > ^^^^
3035+
9 > ^^^^^^^
3036+
10> ^
3037+
11> ^^^
3038+
12> ^
3039+
13> ^
3040+
14> ^
3041+
15> ^
30343042
1->
30353043
>
30363044
>// CONTEXT: Contextual typing declarations
@@ -3039,31 +3047,35 @@ sourceFile:contextualTyping.ts
30393047
>declare function EF1(a:number, b:number):number;
30403048
>
30413049
>
3042-
2 >function EF1(
3043-
3 > a
3044-
4 > ,
3045-
5 > b
3046-
6 > ) {
3047-
7 > return
3048-
8 > a
3049-
9 > +
3050-
10> b
3051-
11> ;
3052-
12>
3053-
13> }
3050+
2 >function
3051+
3 > EF1
3052+
4 > (
3053+
5 > a
3054+
6 > ,
3055+
7 > b
3056+
8 > ) {
3057+
9 > return
3058+
10> a
3059+
11> +
3060+
12> b
3061+
13> ;
3062+
14>
3063+
15> }
30543064
1->Emitted(124, 1) Source(191, 1) + SourceIndex(0)
3055-
2 >Emitted(124, 14) Source(191, 14) + SourceIndex(0)
3056-
3 >Emitted(124, 15) Source(191, 15) + SourceIndex(0)
3057-
4 >Emitted(124, 17) Source(191, 16) + SourceIndex(0)
3058-
5 >Emitted(124, 18) Source(191, 17) + SourceIndex(0)
3059-
6 >Emitted(124, 22) Source(191, 21) + SourceIndex(0)
3060-
7 >Emitted(124, 29) Source(191, 28) + SourceIndex(0)
3061-
8 >Emitted(124, 30) Source(191, 29) + SourceIndex(0)
3062-
9 >Emitted(124, 33) Source(191, 30) + SourceIndex(0)
3063-
10>Emitted(124, 34) Source(191, 31) + SourceIndex(0)
3064-
11>Emitted(124, 35) Source(191, 32) + SourceIndex(0)
3065-
12>Emitted(124, 36) Source(191, 33) + SourceIndex(0)
3066-
13>Emitted(124, 37) Source(191, 34) + SourceIndex(0)
3065+
2 >Emitted(124, 10) Source(191, 10) + SourceIndex(0)
3066+
3 >Emitted(124, 13) Source(191, 13) + SourceIndex(0)
3067+
4 >Emitted(124, 14) Source(191, 14) + SourceIndex(0)
3068+
5 >Emitted(124, 15) Source(191, 15) + SourceIndex(0)
3069+
6 >Emitted(124, 17) Source(191, 16) + SourceIndex(0)
3070+
7 >Emitted(124, 18) Source(191, 17) + SourceIndex(0)
3071+
8 >Emitted(124, 22) Source(191, 21) + SourceIndex(0)
3072+
9 >Emitted(124, 29) Source(191, 28) + SourceIndex(0)
3073+
10>Emitted(124, 30) Source(191, 29) + SourceIndex(0)
3074+
11>Emitted(124, 33) Source(191, 30) + SourceIndex(0)
3075+
12>Emitted(124, 34) Source(191, 31) + SourceIndex(0)
3076+
13>Emitted(124, 35) Source(191, 32) + SourceIndex(0)
3077+
14>Emitted(124, 36) Source(191, 33) + SourceIndex(0)
3078+
15>Emitted(124, 37) Source(191, 34) + SourceIndex(0)
30673079
---
30683080
>>>var efv = EF1(1, 2);
30693081
1 >

tests/baselines/reference/declarationMapsGeneratedMapsEnableMapping.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var Foo = /** @class */ (function () {
1616
}());
1717
exports.Foo = Foo;
1818
FileName : ./dist/index.d.ts.map
19-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../tests/cases/fourslash/index.ts"],"names":[],"mappings":"AAAA;IACI,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IACpC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"}FileName : ./dist/index.d.ts
19+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../tests/cases/fourslash/index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IACpC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"}FileName : ./dist/index.d.ts
2020
export declare class Foo {
2121
member: string;
2222
methodName(propName: SomeType): void;

0 commit comments

Comments
 (0)