-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More tests, only use computed name emit when all names are visible
- Loading branch information
Showing
45 changed files
with
829 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
tests/baselines/reference/declarationEmitComputedNamesInaccessible.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
//// [tests/cases/compiler/declarationEmitComputedNamesInaccessible.ts] //// | ||
|
||
//// [declarationEmitComputedNamesInaccessible.ts] | ||
export function f1() { | ||
const localClassFieldName = Math.random() > 0.5 ? "g1" : "g2"; | ||
const localOtherField = localClassFieldName === "g1" ? "g2" : "g1"; | ||
const localStaticField = Math.random() > 0.5 ? "s1" : "s2"; | ||
return class ParameterizedHolder { | ||
[localClassFieldName]() { | ||
return "value"; | ||
} | ||
[localOtherField]() { | ||
return 42; | ||
} | ||
static [localStaticField]() { | ||
return { static: true }; | ||
} | ||
static [localStaticField]() { | ||
return { static: "sometimes" }; | ||
} | ||
} | ||
} | ||
|
||
//// [declarationEmitComputedNamesInaccessible.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.f1 = f1; | ||
function f1() { | ||
var localClassFieldName = Math.random() > 0.5 ? "g1" : "g2"; | ||
var localOtherField = localClassFieldName === "g1" ? "g2" : "g1"; | ||
var localStaticField = Math.random() > 0.5 ? "s1" : "s2"; | ||
return /** @class */ (function () { | ||
function ParameterizedHolder() { | ||
} | ||
ParameterizedHolder.prototype[localClassFieldName] = function () { | ||
return "value"; | ||
}; | ||
ParameterizedHolder.prototype[localOtherField] = function () { | ||
return 42; | ||
}; | ||
ParameterizedHolder[localStaticField] = function () { | ||
return { static: true }; | ||
}; | ||
ParameterizedHolder[localStaticField] = function () { | ||
return { static: "sometimes" }; | ||
}; | ||
return ParameterizedHolder; | ||
}()); | ||
} | ||
|
||
|
||
//// [declarationEmitComputedNamesInaccessible.d.ts] | ||
export declare function f1(): { | ||
new (): { | ||
[x: string]: (() => string) | (() => number); | ||
}; | ||
[x: string]: { | ||
[x: string]: (() => string) | (() => number); | ||
} | (() => { | ||
static: boolean; | ||
}) | (() => { | ||
static: string; | ||
}); | ||
}; |
53 changes: 53 additions & 0 deletions
53
tests/baselines/reference/declarationEmitComputedNamesInaccessible.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//// [tests/cases/compiler/declarationEmitComputedNamesInaccessible.ts] //// | ||
|
||
=== declarationEmitComputedNamesInaccessible.ts === | ||
export function f1() { | ||
>f1 : Symbol(f1, Decl(declarationEmitComputedNamesInaccessible.ts, 0, 0)) | ||
|
||
const localClassFieldName = Math.random() > 0.5 ? "g1" : "g2"; | ||
>localClassFieldName : Symbol(localClassFieldName, Decl(declarationEmitComputedNamesInaccessible.ts, 1, 9)) | ||
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) | ||
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) | ||
|
||
const localOtherField = localClassFieldName === "g1" ? "g2" : "g1"; | ||
>localOtherField : Symbol(localOtherField, Decl(declarationEmitComputedNamesInaccessible.ts, 2, 9)) | ||
>localClassFieldName : Symbol(localClassFieldName, Decl(declarationEmitComputedNamesInaccessible.ts, 1, 9)) | ||
|
||
const localStaticField = Math.random() > 0.5 ? "s1" : "s2"; | ||
>localStaticField : Symbol(localStaticField, Decl(declarationEmitComputedNamesInaccessible.ts, 3, 9)) | ||
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) | ||
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) | ||
|
||
return class ParameterizedHolder { | ||
>ParameterizedHolder : Symbol(ParameterizedHolder, Decl(declarationEmitComputedNamesInaccessible.ts, 4, 10)) | ||
|
||
[localClassFieldName]() { | ||
>[localClassFieldName] : Symbol(ParameterizedHolder[localClassFieldName], Decl(declarationEmitComputedNamesInaccessible.ts, 4, 38)) | ||
>localClassFieldName : Symbol(localClassFieldName, Decl(declarationEmitComputedNamesInaccessible.ts, 1, 9)) | ||
|
||
return "value"; | ||
} | ||
[localOtherField]() { | ||
>[localOtherField] : Symbol(ParameterizedHolder[localOtherField], Decl(declarationEmitComputedNamesInaccessible.ts, 7, 9)) | ||
>localOtherField : Symbol(localOtherField, Decl(declarationEmitComputedNamesInaccessible.ts, 2, 9)) | ||
|
||
return 42; | ||
} | ||
static [localStaticField]() { | ||
>[localStaticField] : Symbol(ParameterizedHolder[localStaticField], Decl(declarationEmitComputedNamesInaccessible.ts, 10, 9)) | ||
>localStaticField : Symbol(localStaticField, Decl(declarationEmitComputedNamesInaccessible.ts, 3, 9)) | ||
|
||
return { static: true }; | ||
>static : Symbol(static, Decl(declarationEmitComputedNamesInaccessible.ts, 12, 20)) | ||
} | ||
static [localStaticField]() { | ||
>[localStaticField] : Symbol(ParameterizedHolder[localStaticField], Decl(declarationEmitComputedNamesInaccessible.ts, 13, 9)) | ||
>localStaticField : Symbol(localStaticField, Decl(declarationEmitComputedNamesInaccessible.ts, 3, 9)) | ||
|
||
return { static: "sometimes" }; | ||
>static : Symbol(static, Decl(declarationEmitComputedNamesInaccessible.ts, 15, 20)) | ||
} | ||
} | ||
} |
Oops, something went wrong.