Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
278 changed files
with
22,323 additions
and
10,197 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
//// [ambientAccessors.ts] | ||
// ok to use accessors in ambient class in ES3 |
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 @@ | ||
//// [ambientAccessors.ts] |
34 changes: 34 additions & 0 deletions
34
crates/swc/tests/tsc-references/controlFlowComputedPropertyNames.1.normal.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,34 @@ | ||
//// [controlFlowComputedPropertyNames.ts] | ||
function f1(obj, key) { | ||
if (typeof obj[key] === "string") { | ||
obj[key].toUpperCase(); | ||
} | ||
} | ||
function f2(obj, key) { | ||
if (obj[key] !== undefined) { | ||
obj[key].toUpperCase(); | ||
} | ||
var key2 = key + key; | ||
if (obj[key2] !== undefined) { | ||
obj[key2].toUpperCase(); | ||
} | ||
var key3 = key + key; | ||
if (obj[key3] !== undefined) { | ||
obj[key3].toUpperCase(); | ||
} | ||
} | ||
function f3(obj, key) { | ||
if (obj[key] !== undefined) { | ||
if (typeof obj[key] === "string") { | ||
obj[key].toUpperCase(); | ||
} | ||
if (typeof obj[key] === "number") { | ||
obj[key].toFixed(); | ||
} | ||
} | ||
} | ||
function f4(obj, key) { | ||
if (obj[key]) { | ||
obj[key].toUpperCase(); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
crates/swc/tests/tsc-references/controlFlowComputedPropertyNames.2.minified.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 @@ | ||
//// [controlFlowComputedPropertyNames.ts] |
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
23 changes: 13 additions & 10 deletions
23
crates/swc/tests/tsc-references/decoratorOnClassMethod11.2.minified.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 |
---|---|---|
@@ -1,13 +1,16 @@ | ||
//// [decoratorOnClassMethod11.ts] | ||
var M, C; | ||
var M; | ||
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; | ||
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; | ||
M || (M = {}), C = function() { | ||
function C() { | ||
_class_call_check(this, C); | ||
} | ||
var _proto = C.prototype; | ||
return _proto.decorator = function(target, key) {}, _proto.method = function() {}, C; | ||
}(), _ts_decorate([ | ||
_this.decorator | ||
], C.prototype, "method", null); | ||
!function(M) { | ||
var C = function() { | ||
function C() { | ||
_class_call_check(this, C); | ||
} | ||
var _proto = C.prototype; | ||
return _proto.decorator = function(target, key) {}, _proto.method = function() {}, C; | ||
}(); | ||
_ts_decorate([ | ||
this.decorator | ||
], C.prototype, "method", null); | ||
}(M || (M = {})); |
43 changes: 31 additions & 12 deletions
43
crates/swc/tests/tsc-references/decoratorOnClassMethod12.1.normal.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 |
---|---|---|
@@ -1,13 +1,32 @@ | ||
//// [decoratorOnClassMethod12.ts] | ||
//! | ||
//! x Expected ident | ||
//! ,-[3:1] | ||
//! 3 | decorator(target: Object, key: string): void { } | ||
//! 4 | } | ||
//! 5 | class C extends S { | ||
//! 6 | @super.decorator | ||
//! : ^^^^^ | ||
//! 7 | method() { } | ||
//! 8 | } | ||
//! 9 | } | ||
//! `---- | ||
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; | ||
import { _ as _inherits } from "@swc/helpers/_/_inherits"; | ||
import { _ as _create_super } from "@swc/helpers/_/_create_super"; | ||
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; | ||
var M; | ||
(function(M) { | ||
var S = /*#__PURE__*/ function() { | ||
"use strict"; | ||
function S() { | ||
_class_call_check(this, S); | ||
} | ||
var _proto = S.prototype; | ||
_proto.decorator = function decorator(target, key) {}; | ||
return S; | ||
}(); | ||
var C = /*#__PURE__*/ function(S) { | ||
"use strict"; | ||
_inherits(C, S); | ||
var _super = _create_super(C); | ||
function C() { | ||
_class_call_check(this, C); | ||
return _super.apply(this, arguments); | ||
} | ||
var _proto = C.prototype; | ||
_proto.method = function method() {}; | ||
return C; | ||
}(S); | ||
_ts_decorate([ | ||
super.decorator | ||
], C.prototype, "method", null); | ||
})(M || (M = {})); |
32 changes: 20 additions & 12 deletions
32
crates/swc/tests/tsc-references/decoratorOnClassMethod12.2.minified.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 |
---|---|---|
@@ -1,13 +1,21 @@ | ||
//// [decoratorOnClassMethod12.ts] | ||
//! | ||
//! x Expected ident | ||
//! ,-[3:1] | ||
//! 3 | decorator(target: Object, key: string): void { } | ||
//! 4 | } | ||
//! 5 | class C extends S { | ||
//! 6 | @super.decorator | ||
//! : ^^^^^ | ||
//! 7 | method() { } | ||
//! 8 | } | ||
//! 9 | } | ||
//! `---- | ||
var M, C; | ||
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; | ||
import { _ as _inherits } from "@swc/helpers/_/_inherits"; | ||
import { _ as _create_super } from "@swc/helpers/_/_create_super"; | ||
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; | ||
M || (M = {}), C = function(S) { | ||
_inherits(C, S); | ||
var _super = _create_super(C); | ||
function C() { | ||
return _class_call_check(this, C), _super.apply(this, arguments); | ||
} | ||
return C.prototype.method = function() {}, C; | ||
}(function() { | ||
function S() { | ||
_class_call_check(this, S); | ||
} | ||
return S.prototype.decorator = function(target, key) {}, S; | ||
}()), _ts_decorate([ | ||
super.decorator | ||
], C.prototype, "method", null); |
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,5 @@ | ||
//// [errorIsolation.js] | ||
var async = { | ||
doSomething: function(_) {} | ||
}; | ||
async.doSomething(/***/ function() {}); |
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,4 @@ | ||
//// [errorIsolation.js] | ||
({ | ||
doSomething: function(_) {} | ||
}).doSomething(function() {}); |
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
12 changes: 12 additions & 0 deletions
12
crates/swc/tests/tsc-references/esDecorators-decoratorExpression.1.1.normal.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,12 @@ | ||
//// [esDecorators-decoratorExpression.1.ts] | ||
//! | ||
//! x Expression expected | ||
//! ,-[1:1] | ||
//! 1 | | ||
//! 2 | declare let x: any; | ||
//! 3 | | ||
//! 4 | { @x().y class C {} } | ||
//! : ^ | ||
//! 5 | | ||
//! 6 | { @new x class C {} } | ||
//! `---- |
12 changes: 12 additions & 0 deletions
12
crates/swc/tests/tsc-references/esDecorators-decoratorExpression.1.2.minified.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,12 @@ | ||
//// [esDecorators-decoratorExpression.1.ts] | ||
//! | ||
//! x Expression expected | ||
//! ,-[1:1] | ||
//! 1 | | ||
//! 2 | declare let x: any; | ||
//! 3 | | ||
//! 4 | { @x().y class C {} } | ||
//! : ^ | ||
//! 5 | | ||
//! 6 | { @new x class C {} } | ||
//! `---- |
12 changes: 12 additions & 0 deletions
12
crates/swc/tests/tsc-references/esDecorators-decoratorExpression.2.1.normal.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,12 @@ | ||
//// [esDecorators-decoratorExpression.2.ts] | ||
//! | ||
//! x Expression expected | ||
//! ,-[3:1] | ||
//! 3 | declare let g: <T>(...args: any) => any; | ||
//! 4 | declare let h: () => <T>(...args: any) => any; | ||
//! 5 | | ||
//! 6 | { @x! class C {} } | ||
//! : ^ | ||
//! 7 | | ||
//! 8 | { @x.y! class C {} } | ||
//! `---- |
12 changes: 12 additions & 0 deletions
12
crates/swc/tests/tsc-references/esDecorators-decoratorExpression.2.2.minified.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,12 @@ | ||
//// [esDecorators-decoratorExpression.2.ts] | ||
//! | ||
//! x Expression expected | ||
//! ,-[3:1] | ||
//! 3 | declare let g: <T>(...args: any) => any; | ||
//! 4 | declare let h: () => <T>(...args: any) => any; | ||
//! 5 | | ||
//! 6 | { @x! class C {} } | ||
//! : ^ | ||
//! 7 | | ||
//! 8 | { @x.y! class C {} } | ||
//! `---- |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//// [importTag1.ts] | ||
//// [/types.ts] | ||
export { }; | ||
//// [/foo.js] | ||
/** | ||
* @import { Foo } from "./types" | ||
*/ /** | ||
* @param { Foo } foo | ||
*/ function f(foo) {} |
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,4 @@ | ||
//// [importTag1.ts] | ||
//// [/types.ts] | ||
export { }; | ||
//// [/foo.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,5 @@ | ||
//// [importTag10.ts] | ||
//// [/foo.js] | ||
/** | ||
* @import | ||
*/ |
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,2 @@ | ||
//// [importTag10.ts] | ||
//// [/foo.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,5 @@ | ||
//// [importTag11.ts] | ||
//// [/foo.js] | ||
/** | ||
* @import foo | ||
*/ |
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,2 @@ | ||
//// [importTag11.ts] | ||
//// [/foo.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,5 @@ | ||
//// [importTag12.ts] | ||
//// [/foo.js] | ||
/** | ||
* @import foo from | ||
*/ |
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,2 @@ | ||
//// [importTag12.ts] | ||
//// [/foo.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,5 @@ | ||
//// [importTag13.ts] | ||
//// [/types.ts] | ||
export { }; | ||
//// [/foo.js] | ||
/** @import x = require("types") */ |
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,4 @@ | ||
//// [importTag13.ts] | ||
//// [/types.ts] | ||
export { }; | ||
//// [/foo.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,3 @@ | ||
//// [importTag14.ts] | ||
//// [/foo.js] | ||
/** @import * as f from "./foo" with */ |
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,2 @@ | ||
//// [importTag14.ts] | ||
//// [/foo.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,5 @@ | ||
//// [importTag15.ts] | ||
//// [0.ts] | ||
export { }; | ||
//// [1.js] | ||
/** @import { I } from './0' with { type: "json" } */ /** @import * as foo from './0' with { type: "json" } */ /** @param {I} a */ function f(a) {} |
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,4 @@ | ||
//// [importTag15.ts] | ||
//// [0.ts] | ||
export { }; | ||
//// [1.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,8 @@ | ||
//// [importTag16.ts] | ||
//// [a.ts] | ||
export { }; | ||
//// [b.js] | ||
/** @import Foo, { I } from "./a" */ /** | ||
* @param {Foo} a | ||
* @param {I} b | ||
*/ export function foo(a, b) {} |
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,5 @@ | ||
//// [importTag16.ts] | ||
//// [a.ts] | ||
export { }; | ||
//// [b.js] | ||
export function foo(a, b) {} |
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,9 @@ | ||
//// [importTag2.ts] | ||
//// [/types.ts] | ||
export { }; | ||
//// [/foo.js] | ||
/** | ||
* @import * as types from "./types" | ||
*/ /** | ||
* @param { types.Foo } foo | ||
*/ export function f(foo) {} |
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,5 @@ | ||
//// [importTag2.ts] | ||
//// [/types.ts] | ||
export { }; | ||
//// [/foo.js] | ||
export function f(foo) {} |
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,9 @@ | ||
//// [importTag3.ts] | ||
//// [/types.ts] | ||
export { }; | ||
//// [/foo.js] | ||
/** | ||
* @import Foo from "./types" | ||
*/ /** | ||
* @param { Foo } foo | ||
*/ export function f(foo) {} |
Oops, something went wrong.