Fix function name computation for literal values (#7435)

* Fix name computation for literal values

* Add more computed literal test cases

* Always return a string in getNameFromLiteralId

- Also concatenate quasis id for regex literal

* Add a test clarifying function name for template literals

* Remove useless else ifs
This commit is contained in:
Axel Nyffenegger
2018-04-10 03:00:55 +02:00
committed by Justin Ridgewell
parent 6a8c4ab433
commit bd98041321
4 changed files with 43 additions and 2 deletions

View File

@@ -0,0 +1,8 @@
const x = {
[null]: function () {},
[/regex/gi]: function () {},
[`y`]: function () {},
[`abc${y}def`]: function () {},
[0]: function () {},
[false]: function () {},
};

View File

@@ -0,0 +1,3 @@
{
"plugins": ["external-helpers", "transform-function-name"]
}

View File

@@ -0,0 +1,8 @@
const x = {
[null]: function _null() {},
[/regex/gi]: function _regex_gi() {},
[`y`]: function y() {},
[`abc${y}def`]: function abcdef() {},
[0]: function _() {},
[false]: function _false() {}
};