Skip to content

Commit

Permalink
fix(es): Ensure that #1681 is fixed (#1970)
Browse files Browse the repository at this point in the history
swc:
 - Ensure #1681 is fixed. (#1681)
  • Loading branch information
kdy1 authored Aug 2, 2021
1 parent be23e66 commit 6285f20
Show file tree
Hide file tree
Showing 27 changed files with 216 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2015/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jsc": {
"target": "es2015"
}
}
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2015/input/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
32 changes: 32 additions & 0 deletions tests/fixture/issue-1681/es2015/output/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function _taggedTemplateLiteral(strings, raw) {
if (!raw) {
raw = strings.slice(0);
}
return Object.freeze(Object.defineProperties(strings, {
raw: {
value: Object.freeze(raw)
}
}));
}
function _templateObject() {
var data = _taggedTemplateLiteral([
"a\nb\nc\n"
]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
function _templateObject1() {
var data = _taggedTemplateLiteral([
"a\nb\nc\n"
], [
"a\nb\nc\nc\n"
]);
_templateObject1 = function _templateObject1() {
return data;
};
return data;
}
console.log(String.raw(_templateObject()));
console.log(String.raw(_templateObject1()));
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2016/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jsc": {
"target": "es2016"
}
}
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2016/input/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2016/output/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2017/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jsc": {
"target": "es2017"
}
}
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2017/input/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2017/output/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2018/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jsc": {
"target": "es2018"
}
}
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2018/input/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2018/output/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2019/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jsc": {
"target": "es2019"
}
}
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2019/input/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2019/output/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2020/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jsc": {
"target": "es2020"
}
}
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2020/input/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2020/output/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2021/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jsc": {
"target": "es2021"
}
}
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2021/input/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es2021/output/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es3/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jsc": {
"target": "es3"
}
}
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es3/input/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
32 changes: 32 additions & 0 deletions tests/fixture/issue-1681/es3/output/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function _taggedTemplateLiteral(strings, raw) {
if (!raw) {
raw = strings.slice(0);
}
return Object.freeze(Object.defineProperties(strings, {
raw: {
value: Object.freeze(raw)
}
}));
}
function _templateObject() {
var data = _taggedTemplateLiteral([
"a\nb\nc\n"
]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
function _templateObject1() {
var data = _taggedTemplateLiteral([
"a\nb\nc\n"
], [
"a\\nb\\nc\\n"
]);
_templateObject1 = function _templateObject1() {
return data;
};
return data;
}
console.log(String.raw(_templateObject()));
console.log(String.raw(_templateObject1()));
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es5/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jsc": {
"target": "es5"
}
}
5 changes: 5 additions & 0 deletions tests/fixture/issue-1681/es5/input/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
32 changes: 32 additions & 0 deletions tests/fixture/issue-1681/es5/output/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function _taggedTemplateLiteral(strings, raw) {
if (!raw) {
raw = strings.slice(0);
}
return Object.freeze(Object.defineProperties(strings, {
raw: {
value: Object.freeze(raw)
}
}));
}
function _templateObject() {
var data = _taggedTemplateLiteral([
"a\nb\nc\n"
]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
function _templateObject1() {
var data = _taggedTemplateLiteral([
"a\nb\nc\n"
], [
"a\\nb\\nc\\n"
]);
_templateObject1 = function _templateObject1() {
return data;
};
return data;
}
console.log(String.raw(_templateObject()));
console.log(String.raw(_templateObject1()));

0 comments on commit 6285f20

Please sign in to comment.