Fix 8532: Correct source map output for computed getter of object literal

This commit is contained in:
Andy Hanson
2016-05-12 09:30:21 -07:00
parent d8d5dafe1a
commit d713c58c6b
25 changed files with 345 additions and 48 deletions

View File

@@ -1953,7 +1953,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
write("Object.defineProperty(");
emit(tempVar);
write(", ");
emitStart(node.name);
emitStart(property.name);
emitExpressionForPropertyName(property.name);
emitEnd(property.name);
write(", {");

View File

@@ -3,6 +3,9 @@ class C {
["hello"]() {
debugger;
}
get ["goodbye"]() {
return 0;
}
}
//// [computedPropertyNamesSourceMap1_ES5.js]
@@ -12,6 +15,13 @@ var C = (function () {
C.prototype["hello"] = function () {
debugger;
};
Object.defineProperty(C.prototype, "goodbye", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
return C;
}());
//# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map

View File

@@ -1,2 +1,2 @@
//// [computedPropertyNamesSourceMap1_ES5.js.map]
{"version":3,"file":"computedPropertyNamesSourceMap1_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES5.ts"],"names":[],"mappings":"AAAA;IAAA;IAIA,CAAC;IAHG,YAAC,OAAO,CAAC,GAAT;QACI,QAAQ,CAAC;IACb,CAAC;IACL,QAAC;AAAD,CAAC,AAJD,IAIC"}
{"version":3,"file":"computedPropertyNamesSourceMap1_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES5.ts"],"names":[],"mappings":"AAAA;IAAA;IAOA,CAAC;IANG,YAAC,OAAO,CAAC,GAAT;QACI,QAAQ,CAAC;IACb,CAAC;IACD,sBAAI,aAAC,SAAU;aAAf;YACF,MAAM,CAAC,CAAC,CAAC;QACP,CAAC;;;OAAA;IACL,QAAC;AAAD,CAAC,AAPD,IAOC"}

View File

@@ -28,10 +28,13 @@ sourceFile:computedPropertyNamesSourceMap1_ES5.ts
> ["hello"]() {
> debugger;
> }
> get ["goodbye"]() {
> return 0;
> }
>
2 > }
1->Emitted(3, 5) Source(5, 1) + SourceIndex(0)
2 >Emitted(3, 6) Source(5, 2) + SourceIndex(0)
1->Emitted(3, 5) Source(8, 1) + SourceIndex(0)
2 >Emitted(3, 6) Source(8, 2) + SourceIndex(0)
---
>>> C.prototype["hello"] = function () {
1->^^^^
@@ -65,21 +68,78 @@ sourceFile:computedPropertyNamesSourceMap1_ES5.ts
>>> };
1 >^^^^
2 > ^
3 > ^^^^^^^^^->
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(6, 5) Source(4, 5) + SourceIndex(0)
2 >Emitted(6, 6) Source(4, 6) + SourceIndex(0)
---
>>> Object.defineProperty(C.prototype, "goodbye", {
1->^^^^
2 > ^^^^^^^^^^^^^^^^^^^^^^
3 > ^^^^^^^^^^^^^
4 > ^^^^^^^^^
1->
>
2 > get
3 > [
4 > "goodbye"]
1->Emitted(7, 5) Source(5, 5) + SourceIndex(0)
2 >Emitted(7, 27) Source(5, 9) + SourceIndex(0)
3 >Emitted(7, 40) Source(5, 10) + SourceIndex(0)
4 >Emitted(7, 49) Source(5, 20) + SourceIndex(0)
---
>>> get: function () {
1 >^^^^^^^^^^^^^
2 > ^^^^^^^^^->
1 >
1 >Emitted(8, 14) Source(5, 5) + SourceIndex(0)
---
>>> return 0;
1->^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^
5 > ^
1->get ["goodbye"]() {
>
2 > return
3 >
4 > 0
5 > ;
1->Emitted(9, 13) Source(6, 3) + SourceIndex(0)
2 >Emitted(9, 19) Source(6, 9) + SourceIndex(0)
3 >Emitted(9, 20) Source(6, 10) + SourceIndex(0)
4 >Emitted(9, 21) Source(6, 11) + SourceIndex(0)
5 >Emitted(9, 22) Source(6, 12) + SourceIndex(0)
---
>>> },
1 >^^^^^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(10, 9) Source(7, 5) + SourceIndex(0)
2 >Emitted(10, 10) Source(7, 6) + SourceIndex(0)
---
>>> enumerable: true,
>>> configurable: true
>>> });
1->^^^^^^^
2 > ^^^^^^^->
1->
1->Emitted(13, 8) Source(7, 6) + SourceIndex(0)
---
>>> return C;
1->^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(7, 5) Source(5, 1) + SourceIndex(0)
2 >Emitted(7, 13) Source(5, 2) + SourceIndex(0)
1->Emitted(14, 5) Source(8, 1) + SourceIndex(0)
2 >Emitted(14, 13) Source(8, 2) + SourceIndex(0)
---
>>>}());
1 >
@@ -94,10 +154,13 @@ sourceFile:computedPropertyNamesSourceMap1_ES5.ts
> ["hello"]() {
> debugger;
> }
> get ["goodbye"]() {
> return 0;
> }
> }
1 >Emitted(8, 1) Source(5, 1) + SourceIndex(0)
2 >Emitted(8, 2) Source(5, 2) + SourceIndex(0)
3 >Emitted(8, 2) Source(1, 1) + SourceIndex(0)
4 >Emitted(8, 6) Source(5, 2) + SourceIndex(0)
1 >Emitted(15, 1) Source(8, 1) + SourceIndex(0)
2 >Emitted(15, 2) Source(8, 2) + SourceIndex(0)
3 >Emitted(15, 2) Source(1, 1) + SourceIndex(0)
4 >Emitted(15, 6) Source(8, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map

View File

@@ -7,4 +7,9 @@ class C {
debugger;
}
get ["goodbye"]() {
>"goodbye" : Symbol(C[["goodbye"]], Decl(computedPropertyNamesSourceMap1_ES5.ts, 3, 5))
return 0;
}
}

View File

@@ -7,4 +7,10 @@ class C {
debugger;
}
get ["goodbye"]() {
>"goodbye" : string
return 0;
>0 : number
}
}

View File

@@ -2,7 +2,10 @@
class C {
["hello"]() {
debugger;
}
}
get ["goodbye"]() {
return 0;
}
}
//// [computedPropertyNamesSourceMap1_ES6.js]
@@ -10,5 +13,8 @@ class C {
["hello"]() {
debugger;
}
get ["goodbye"]() {
return 0;
}
}
//# sourceMappingURL=computedPropertyNamesSourceMap1_ES6.js.map

View File

@@ -1,2 +1,2 @@
//// [computedPropertyNamesSourceMap1_ES6.js.map]
{"version":3,"file":"computedPropertyNamesSourceMap1_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES6.ts"],"names":[],"mappings":"AAAA;IACI,CAAC,OAAO,CAAC;QACL,QAAQ,CAAC;IACb,CAAC;AACL,CAAC;AAAA"}
{"version":3,"file":"computedPropertyNamesSourceMap1_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES6.ts"],"names":[],"mappings":"AAAA;IACI,CAAC,OAAO,CAAC;QACL,QAAQ,CAAC;IAChB,CAAC;IACD,IAAI,CAAC,SAAS,CAAC;QACd,MAAM,CAAC,CAAC,CAAC;IACV,CAAC;AACF,CAAC;AAAA"}

View File

@@ -45,11 +45,57 @@ sourceFile:computedPropertyNamesSourceMap1_ES6.ts
>>> }
1 >^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^->
1 >
>
>
2 > }
1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0)
2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0)
1 >Emitted(4, 5) Source(4, 2) + SourceIndex(0)
2 >Emitted(4, 6) Source(4, 3) + SourceIndex(0)
---
>>> get ["goodbye"]() {
1->^^^^
2 > ^^^^
3 > ^
4 > ^^^^^^^^^
5 > ^
1->
>
2 > get
3 > [
4 > "goodbye"
5 > ]
1->Emitted(5, 5) Source(5, 2) + SourceIndex(0)
2 >Emitted(5, 9) Source(5, 6) + SourceIndex(0)
3 >Emitted(5, 10) Source(5, 7) + SourceIndex(0)
4 >Emitted(5, 19) Source(5, 16) + SourceIndex(0)
5 >Emitted(5, 20) Source(5, 17) + SourceIndex(0)
---
>>> return 0;
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^
5 > ^
1 >() {
>
2 > return
3 >
4 > 0
5 > ;
1 >Emitted(6, 9) Source(6, 3) + SourceIndex(0)
2 >Emitted(6, 15) Source(6, 9) + SourceIndex(0)
3 >Emitted(6, 16) Source(6, 10) + SourceIndex(0)
4 >Emitted(6, 17) Source(6, 11) + SourceIndex(0)
5 >Emitted(6, 18) Source(6, 12) + SourceIndex(0)
---
>>> }
1 >^^^^
2 > ^
1 >
>
2 > }
1 >Emitted(7, 5) Source(7, 2) + SourceIndex(0)
2 >Emitted(7, 6) Source(7, 3) + SourceIndex(0)
---
>>>}
1 >
@@ -58,11 +104,11 @@ sourceFile:computedPropertyNamesSourceMap1_ES6.ts
1 >
>
2 >}
1 >Emitted(5, 1) Source(5, 1) + SourceIndex(0)
2 >Emitted(5, 2) Source(5, 2) + SourceIndex(0)
1 >Emitted(8, 1) Source(8, 1) + SourceIndex(0)
2 >Emitted(8, 2) Source(8, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=computedPropertyNamesSourceMap1_ES6.js.map1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->
1->Emitted(6, 1) Source(5, 2) + SourceIndex(0)
1->Emitted(9, 1) Source(8, 2) + SourceIndex(0)
---

View File

@@ -6,5 +6,10 @@ class C {
>"hello" : Symbol(C[["hello"]], Decl(computedPropertyNamesSourceMap1_ES6.ts, 0, 9))
debugger;
}
}
get ["goodbye"]() {
>"goodbye" : Symbol(C[["goodbye"]], Decl(computedPropertyNamesSourceMap1_ES6.ts, 3, 2))
return 0;
}
}

View File

@@ -6,5 +6,11 @@ class C {
>"hello" : string
debugger;
}
}
get ["goodbye"]() {
>"goodbye" : string
return 0;
>0 : number
}
}

View File

@@ -2,7 +2,10 @@
var v = {
["hello"]() {
debugger;
}
},
get ["goodbye"]() {
return 0;
}
}
//// [computedPropertyNamesSourceMap2_ES5.js]
@@ -10,6 +13,13 @@ var v = (_a = {},
_a["hello"] = function () {
debugger;
},
Object.defineProperty(_a, "goodbye", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
}),
_a
);
var _a;

View File

@@ -1,2 +1,2 @@
//// [computedPropertyNamesSourceMap2_ES5.js.map]
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC,GAAT;QACI,QAAQ,CAAC;IACb,CAAC;;CACJ,CAAA"}
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC,GAAT;QACI,QAAQ,CAAC;IAChB,CAAC;IACE,0BAAK,SAAU;aAAf;YACF,MAAM,CAAC,CAAC,CAAC;QACV,CAAC;;;MAAA;;CACD,CAAA"}

View File

@@ -56,12 +56,66 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
>>> },
1 >^^^^
2 > ^
3 > ^^->
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
>
2 > }
1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0)
2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0)
1 >Emitted(4, 5) Source(4, 2) + SourceIndex(0)
2 >Emitted(4, 6) Source(4, 3) + SourceIndex(0)
---
>>> Object.defineProperty(_a, "goodbye", {
1->^^^^
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^
3 > ^^^^^^^^^
1->,
>
2 > get [
3 > "goodbye"]
1->Emitted(5, 5) Source(5, 5) + SourceIndex(0)
2 >Emitted(5, 31) Source(5, 10) + SourceIndex(0)
3 >Emitted(5, 40) Source(5, 20) + SourceIndex(0)
---
>>> get: function () {
1 >^^^^^^^^^^^^^
2 > ^^^^^^^^^->
1 >
1 >Emitted(6, 14) Source(5, 5) + SourceIndex(0)
---
>>> return 0;
1->^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^
5 > ^
1->get ["goodbye"]() {
>
2 > return
3 >
4 > 0
5 > ;
1->Emitted(7, 13) Source(6, 3) + SourceIndex(0)
2 >Emitted(7, 19) Source(6, 9) + SourceIndex(0)
3 >Emitted(7, 20) Source(6, 10) + SourceIndex(0)
4 >Emitted(7, 21) Source(6, 11) + SourceIndex(0)
5 >Emitted(7, 22) Source(6, 12) + SourceIndex(0)
---
>>> },
1 >^^^^^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(8, 9) Source(7, 2) + SourceIndex(0)
2 >Emitted(8, 10) Source(7, 3) + SourceIndex(0)
---
>>> enumerable: true,
>>> configurable: true
>>> }),
1->^^^^^^
2 > ^->
1->
1->Emitted(11, 7) Source(7, 3) + SourceIndex(0)
---
>>> _a
>>>);
@@ -71,8 +125,8 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
1->
>}
2 >
1->Emitted(6, 2) Source(5, 2) + SourceIndex(0)
2 >Emitted(6, 3) Source(5, 2) + SourceIndex(0)
1->Emitted(13, 2) Source(8, 2) + SourceIndex(0)
2 >Emitted(13, 3) Source(8, 2) + SourceIndex(0)
---
>>>var _a;
>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map

View File

@@ -6,5 +6,10 @@ var v = {
>"hello" : Symbol(["hello"], Decl(computedPropertyNamesSourceMap2_ES5.ts, 0, 9))
debugger;
}
},
get ["goodbye"]() {
>"goodbye" : Symbol(["goodbye"], Decl(computedPropertyNamesSourceMap2_ES5.ts, 3, 3))
return 0;
}
}

View File

@@ -1,11 +1,17 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts ===
var v = {
>v : { ["hello"](): void; }
>{ ["hello"]() { debugger; }} : { ["hello"](): void; }
>v : { ["hello"](): void; readonly ["goodbye"]: number; }
>{ ["hello"]() { debugger; }, get ["goodbye"]() { return 0; }} : { ["hello"](): void; readonly ["goodbye"]: number; }
["hello"]() {
>"hello" : string
debugger;
}
},
get ["goodbye"]() {
>"goodbye" : string
return 0;
>0 : number
}
}

View File

@@ -2,13 +2,19 @@
var v = {
["hello"]() {
debugger;
}
},
get ["goodbye"]() {
return 0;
}
}
//// [computedPropertyNamesSourceMap2_ES6.js]
var v = {
["hello"]() {
debugger;
},
get ["goodbye"]() {
return 0;
}
};
//# sourceMappingURL=computedPropertyNamesSourceMap2_ES6.js.map

View File

@@ -1,2 +1,2 @@
//// [computedPropertyNamesSourceMap2_ES6.js.map]
{"version":3,"file":"computedPropertyNamesSourceMap2_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES6.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACL,QAAQ,CAAC;IACb,CAAC;CACJ,CAAA"}
{"version":3,"file":"computedPropertyNamesSourceMap2_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES6.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACL,QAAQ,CAAC;IAChB,CAAC;IACD,IAAI,CAAC,SAAS,CAAC;QACd,MAAM,CAAC,CAAC,CAAC;IACV,CAAC;CACD,CAAA"}

View File

@@ -51,14 +51,60 @@ sourceFile:computedPropertyNamesSourceMap2_ES6.ts
2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0)
3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0)
---
>>> },
1 >^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(4, 5) Source(4, 2) + SourceIndex(0)
2 >Emitted(4, 6) Source(4, 3) + SourceIndex(0)
---
>>> get ["goodbye"]() {
1->^^^^
2 > ^^^^
3 > ^
4 > ^^^^^^^^^
5 > ^
1->,
>
2 > get
3 > [
4 > "goodbye"
5 > ]
1->Emitted(5, 5) Source(5, 2) + SourceIndex(0)
2 >Emitted(5, 9) Source(5, 6) + SourceIndex(0)
3 >Emitted(5, 10) Source(5, 7) + SourceIndex(0)
4 >Emitted(5, 19) Source(5, 16) + SourceIndex(0)
5 >Emitted(5, 20) Source(5, 17) + SourceIndex(0)
---
>>> return 0;
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^
5 > ^
1 >() {
>
2 > return
3 >
4 > 0
5 > ;
1 >Emitted(6, 9) Source(6, 3) + SourceIndex(0)
2 >Emitted(6, 15) Source(6, 9) + SourceIndex(0)
3 >Emitted(6, 16) Source(6, 10) + SourceIndex(0)
4 >Emitted(6, 17) Source(6, 11) + SourceIndex(0)
5 >Emitted(6, 18) Source(6, 12) + SourceIndex(0)
---
>>> }
1 >^^^^
2 > ^
1 >
>
>
2 > }
1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0)
2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0)
1 >Emitted(7, 5) Source(7, 2) + SourceIndex(0)
2 >Emitted(7, 6) Source(7, 3) + SourceIndex(0)
---
>>>};
1 >^
@@ -67,7 +113,7 @@ sourceFile:computedPropertyNamesSourceMap2_ES6.ts
1 >
>}
2 >
1 >Emitted(5, 2) Source(5, 2) + SourceIndex(0)
2 >Emitted(5, 3) Source(5, 2) + SourceIndex(0)
1 >Emitted(8, 2) Source(8, 2) + SourceIndex(0)
2 >Emitted(8, 3) Source(8, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES6.js.map

View File

@@ -6,5 +6,10 @@ var v = {
>"hello" : Symbol(["hello"], Decl(computedPropertyNamesSourceMap2_ES6.ts, 0, 9))
debugger;
}
},
get ["goodbye"]() {
>"goodbye" : Symbol(["goodbye"], Decl(computedPropertyNamesSourceMap2_ES6.ts, 3, 3))
return 0;
}
}

View File

@@ -1,11 +1,17 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts ===
var v = {
>v : { ["hello"](): void; }
>{ ["hello"]() { debugger; }} : { ["hello"](): void; }
>v : { ["hello"](): void; readonly ["goodbye"]: number; }
>{ ["hello"]() { debugger; }, get ["goodbye"]() { return 0; }} : { ["hello"](): void; readonly ["goodbye"]: number; }
["hello"]() {
>"hello" : string
debugger;
}
},
get ["goodbye"]() {
>"goodbye" : string
return 0;
>0 : number
}
}

View File

@@ -4,4 +4,7 @@ class C {
["hello"]() {
debugger;
}
get ["goodbye"]() {
return 0;
}
}

View File

@@ -3,5 +3,8 @@
class C {
["hello"]() {
debugger;
}
}
get ["goodbye"]() {
return 0;
}
}

View File

@@ -3,5 +3,8 @@
var v = {
["hello"]() {
debugger;
}
},
get ["goodbye"]() {
return 0;
}
}

View File

@@ -3,5 +3,8 @@
var v = {
["hello"]() {
debugger;
}
},
get ["goodbye"]() {
return 0;
}
}