Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop not emitting mappings for function and class names #25210

Merged
merged 1 commit into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ namespace ts {
return pipelineEmitWithoutComments;

case PipelinePhase.SourceMaps:
if (onEmitSourceMapOfNode && hint !== EmitHint.SourceFile && hint !== EmitHint.IdentifierName) {
if (onEmitSourceMapOfNode && hint !== EmitHint.SourceFile) {
return pipelineEmitWithSourceMap;
}
// falls through
Expand Down Expand Up @@ -578,7 +578,7 @@ namespace ts {
}

function pipelineEmitWithSourceMap(hint: EmitHint, node: Node) {
Debug.assert(hint !== EmitHint.SourceFile && hint !== EmitHint.IdentifierName);
Debug.assert(hint !== EmitHint.SourceFile);
Debug.assertDefined(onEmitSourceMapOfNode)(hint, node, pipelineEmitWithHint);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5For-of34.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions tests/baselines/reference/ES5For-of34.sourcemap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ sourceFile:ES5For-of34.ts
>>>var e_1, _a;
>>>function foo() {
1 >
2 >^^^^^^^^^^^^^^^^^^^^^->
2 >^^^^^^^^^
3 > ^^^
4 > ^^^^^^^^^->
1 >
2 >function
3 > foo
1 >Emitted(12, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(12, 10) Source(1, 10) + SourceIndex(0)
3 >Emitted(12, 13) Source(1, 13) + SourceIndex(0)
---
>>> return { x: 0 };
1->^^^^
Expand All @@ -34,7 +40,7 @@ sourceFile:ES5For-of34.ts
6 > ^
7 > ^^
8 > ^
1->function foo() {
1->() {
>
2 > return
3 > {
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5For-of8.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions tests/baselines/reference/ES5For-of8.sourcemap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ sourceFile:ES5For-of8.ts
-------------------------------------------------------------------
>>>function foo() {
1 >
2 >^^^^^^^^^^^^^^^^^^^^^->
2 >^^^^^^^^^
3 > ^^^
4 > ^^^^^^^^^->
1 >
2 >function
3 > foo
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 10) Source(1, 10) + SourceIndex(0)
3 >Emitted(1, 13) Source(1, 13) + SourceIndex(0)
---
>>> return { x: 0 };
1->^^^^
Expand All @@ -23,7 +29,7 @@ sourceFile:ES5For-of8.ts
6 > ^
7 > ^^
8 > ^
1->function foo() {
1->() {
>
2 > return
3 > {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@ sourceFile:computedPropertyNamesSourceMap1_ES6.ts
-------------------------------------------------------------------
>>>class C {
1 >
2 >^^^^^^^^^^^^^^^^^^->
2 >^^^^^^
3 > ^
4 > ^^^^^^^^^^^->
1 >
2 >class
3 > C
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 7) Source(1, 7) + SourceIndex(0)
3 >Emitted(1, 8) Source(1, 8) + SourceIndex(0)
---
>>> ["hello"]() {
1->^^^^
2 > ^
3 > ^^^^^^^
4 > ^
5 > ^^^^^->
1->class C {
1-> {
>
2 > [
3 > "hello"
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/contextualTyping.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

108 changes: 60 additions & 48 deletions tests/baselines/reference/contextualTyping.sourcemap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2070,21 +2070,27 @@ sourceFile:contextualTyping.ts
---
>>>function c9t5(f) { }
1 >
2 >^^^^^^^^^^^^^^
3 > ^
4 > ^^^^
5 > ^
2 >^^^^^^^^^
3 > ^^^^
4 > ^
5 > ^
6 > ^^^^
7 > ^
1 >
>
2 >function c9t5(
3 > f: (n: number) => IFoo
4 > ) {
5 > }
2 >function
3 > c9t5
4 > (
5 > f: (n: number) => IFoo
6 > ) {
7 > }
1 >Emitted(86, 1) Source(146, 1) + SourceIndex(0)
2 >Emitted(86, 15) Source(146, 15) + SourceIndex(0)
3 >Emitted(86, 16) Source(146, 37) + SourceIndex(0)
4 >Emitted(86, 20) Source(146, 40) + SourceIndex(0)
5 >Emitted(86, 21) Source(146, 41) + SourceIndex(0)
2 >Emitted(86, 10) Source(146, 10) + SourceIndex(0)
3 >Emitted(86, 14) Source(146, 14) + SourceIndex(0)
4 >Emitted(86, 15) Source(146, 15) + SourceIndex(0)
5 >Emitted(86, 16) Source(146, 37) + SourceIndex(0)
6 >Emitted(86, 20) Source(146, 40) + SourceIndex(0)
7 >Emitted(86, 21) Source(146, 41) + SourceIndex(0)
---
>>>;
1 >
Expand Down Expand Up @@ -3019,18 +3025,20 @@ sourceFile:contextualTyping.ts
---
>>>function EF1(a, b) { return a + b; }
1->
2 >^^^^^^^^^^^^^
3 > ^
4 > ^^
5 > ^
6 > ^^^^
7 > ^^^^^^^
8 > ^
9 > ^^^
10> ^
11> ^
12> ^
13> ^
2 >^^^^^^^^^
3 > ^^^
4 > ^
5 > ^
6 > ^^
7 > ^
8 > ^^^^
9 > ^^^^^^^
10> ^
11> ^^^
12> ^
13> ^
14> ^
15> ^
1->
>
>// CONTEXT: Contextual typing declarations
Expand All @@ -3039,31 +3047,35 @@ sourceFile:contextualTyping.ts
>declare function EF1(a:number, b:number):number;
>
>
2 >function EF1(
3 > a
4 > ,
5 > b
6 > ) {
7 > return
8 > a
9 > +
10> b
11> ;
12>
13> }
2 >function
3 > EF1
4 > (
5 > a
6 > ,
7 > b
8 > ) {
9 > return
10> a
11> +
12> b
13> ;
14>
15> }
1->Emitted(124, 1) Source(191, 1) + SourceIndex(0)
2 >Emitted(124, 14) Source(191, 14) + SourceIndex(0)
3 >Emitted(124, 15) Source(191, 15) + SourceIndex(0)
4 >Emitted(124, 17) Source(191, 16) + SourceIndex(0)
5 >Emitted(124, 18) Source(191, 17) + SourceIndex(0)
6 >Emitted(124, 22) Source(191, 21) + SourceIndex(0)
7 >Emitted(124, 29) Source(191, 28) + SourceIndex(0)
8 >Emitted(124, 30) Source(191, 29) + SourceIndex(0)
9 >Emitted(124, 33) Source(191, 30) + SourceIndex(0)
10>Emitted(124, 34) Source(191, 31) + SourceIndex(0)
11>Emitted(124, 35) Source(191, 32) + SourceIndex(0)
12>Emitted(124, 36) Source(191, 33) + SourceIndex(0)
13>Emitted(124, 37) Source(191, 34) + SourceIndex(0)
2 >Emitted(124, 10) Source(191, 10) + SourceIndex(0)
3 >Emitted(124, 13) Source(191, 13) + SourceIndex(0)
4 >Emitted(124, 14) Source(191, 14) + SourceIndex(0)
5 >Emitted(124, 15) Source(191, 15) + SourceIndex(0)
6 >Emitted(124, 17) Source(191, 16) + SourceIndex(0)
7 >Emitted(124, 18) Source(191, 17) + SourceIndex(0)
8 >Emitted(124, 22) Source(191, 21) + SourceIndex(0)
9 >Emitted(124, 29) Source(191, 28) + SourceIndex(0)
10>Emitted(124, 30) Source(191, 29) + SourceIndex(0)
11>Emitted(124, 33) Source(191, 30) + SourceIndex(0)
12>Emitted(124, 34) Source(191, 31) + SourceIndex(0)
13>Emitted(124, 35) Source(191, 32) + SourceIndex(0)
14>Emitted(124, 36) Source(191, 33) + SourceIndex(0)
15>Emitted(124, 37) Source(191, 34) + SourceIndex(0)
---
>>>var efv = EF1(1, 2);
1 >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var Foo = /** @class */ (function () {
}());
exports.Foo = Foo;
FileName : ./dist/index.d.ts.map
{"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
{"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
export declare class Foo {
member: string;
methodName(propName: SomeType): void;
Expand Down
Loading