mirror of
https://github.com/swc-project/swc.git
synced 2024-11-27 13:38:33 +03:00
fix(es/compat/es2015): Fix span handling of arrow
and classes
(#3921)
This commit is contained in:
parent
531812c28a
commit
12b8606c99
@ -1,5 +1,5 @@
|
||||
function Component() {
|
||||
return(/*#__PURE__*/ React.createElement("div", {
|
||||
return /*#__PURE__*/ React.createElement("div", {
|
||||
name: "A B"
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ function App() {
|
||||
}, _callee);
|
||||
}))();
|
||||
}, []);
|
||||
return(/*#__PURE__*/ _jsxs(ConfigProvider, {
|
||||
return /*#__PURE__*/ _jsxs(ConfigProvider, {
|
||||
locale: zhCN,
|
||||
children: [
|
||||
"state: ",
|
||||
@ -36,6 +36,6 @@ function App() {
|
||||
children: "Antd"
|
||||
})
|
||||
]
|
||||
}));
|
||||
});
|
||||
}
|
||||
render(/*#__PURE__*/ _jsx(App, {}), document.getElementById('root'));
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
export var HelloWorld = function() {
|
||||
return(/*#__PURE__*/ React.createElement("div", {
|
||||
return /*#__PURE__*/ React.createElement("div", {
|
||||
title: "您好SWC"
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ var swcHelpers = require("@swc/helpers");
|
||||
var _regeneratorRuntime = swcHelpers.interopRequireDefault(require("regenerator-runtime"));
|
||||
var _react = swcHelpers.interopRequireDefault(require("react"));
|
||||
function Foo() {
|
||||
return(/*#__PURE__*/ _react.default.createElement("div", {
|
||||
return /*#__PURE__*/ _react.default.createElement("div", {
|
||||
onClick: swcHelpers.asyncToGenerator(_regeneratorRuntime.default.mark(function _callee(e) {
|
||||
return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
|
||||
while(1)switch(_ctx.prev = _ctx.next){
|
||||
@ -20,6 +20,6 @@ function Foo() {
|
||||
}
|
||||
}, _callee);
|
||||
}))
|
||||
}));
|
||||
});
|
||||
}
|
||||
Foo.displayName = "Foo";
|
||||
|
@ -6,7 +6,7 @@ exports.default = Foo;
|
||||
var swcHelpers = require("@swc/helpers");
|
||||
var _react = swcHelpers.interopRequireDefault(require("react"));
|
||||
function Foo() {
|
||||
return(/*#__PURE__*/ _react.default.createElement("div", {
|
||||
return /*#__PURE__*/ _react.default.createElement("div", {
|
||||
onClick: function() {
|
||||
var _ref = swcHelpers.asyncToGenerator(function*(e) {
|
||||
yield doSomething();
|
||||
@ -15,6 +15,6 @@ function Foo() {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
}()
|
||||
}));
|
||||
});
|
||||
}
|
||||
Foo.displayName = "Foo";
|
||||
|
@ -6,10 +6,10 @@ exports.default = Foo;
|
||||
var swcHelpers = require("@swc/helpers");
|
||||
var _react = swcHelpers.interopRequireDefault(require("react"));
|
||||
function Foo() {
|
||||
return(/*#__PURE__*/ _react.default.createElement("div", {
|
||||
return /*#__PURE__*/ _react.default.createElement("div", {
|
||||
onClick: swcHelpers.asyncToGenerator(function*(e) {
|
||||
yield doSomething();
|
||||
})
|
||||
}));
|
||||
});
|
||||
}
|
||||
Foo.displayName = "Foo";
|
||||
|
@ -6,10 +6,10 @@ exports.default = Foo;
|
||||
var swcHelpers = require("@swc/helpers");
|
||||
var _react = swcHelpers.interopRequireDefault(require("react"));
|
||||
function Foo() {
|
||||
return(/*#__PURE__*/ _react.default.createElement("div", {
|
||||
return /*#__PURE__*/ _react.default.createElement("div", {
|
||||
onClick: swcHelpers.asyncToGenerator(function*(e) {
|
||||
yield doSomething();
|
||||
})
|
||||
}));
|
||||
});
|
||||
}
|
||||
Foo.displayName = "Foo";
|
||||
|
@ -6,10 +6,10 @@ exports.default = Foo;
|
||||
var swcHelpers = require("@swc/helpers");
|
||||
var _react = swcHelpers.interopRequireDefault(require("react"));
|
||||
function Foo() {
|
||||
return(/*#__PURE__*/ _react.default.createElement("div", {
|
||||
return /*#__PURE__*/ _react.default.createElement("div", {
|
||||
onClick: async (e)=>{
|
||||
await doSomething();
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
Foo.displayName = "Foo";
|
||||
|
@ -1,3 +1,3 @@
|
||||
var A = function() {
|
||||
return(/*#__PURE__*/ React.createElement("div", null));
|
||||
return /*#__PURE__*/ React.createElement("div", null);
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ class ReusablePayments extends PureComponent {
|
||||
if (!stripePaymentSources.length) {
|
||||
return null;
|
||||
}
|
||||
return(/*#__PURE__*/ React.createElement(DeletePaymentSourceComponent, {
|
||||
return /*#__PURE__*/ React.createElement(DeletePaymentSourceComponent, {
|
||||
onCompleted: (param)=>{
|
||||
var deletePaymentSource = param.deletePaymentSource;
|
||||
if (deletePaymentSource.success) {
|
||||
@ -53,7 +53,7 @@ class ReusablePayments extends PureComponent {
|
||||
className: styles.selectionList
|
||||
}, stripePaymentSources.map((payment)=>{
|
||||
var cardIcon = "brand" in payment.paymentEntity ? payment.paymentEntity.brand === "Visa" ? /*#__PURE__*/ React.createElement(Visa, null) : payment.paymentEntity.brand === "MasterCard" ? /*#__PURE__*/ React.createElement(MasterCard, null) : payment.paymentEntity.brand === "American Express" ? /*#__PURE__*/ React.createElement(AmericanExpress, null) : payment.paymentEntity.brand === "Discover" ? /*#__PURE__*/ React.createElement(Discover, null) : null : null;
|
||||
return(/*#__PURE__*/ React.createElement("div", {
|
||||
return /*#__PURE__*/ React.createElement("div", {
|
||||
key: payment.id,
|
||||
className: classNames(styles.creditCard, {
|
||||
[styles.creditCardChecked]: selectedReusablePayment === payment
|
||||
@ -80,9 +80,9 @@ class ReusablePayments extends PureComponent {
|
||||
variant: "secondary-link",
|
||||
type: "button",
|
||||
size: "xsmall"
|
||||
}, "Remove")))));
|
||||
}, "Remove"))));
|
||||
}))
|
||||
));
|
||||
);
|
||||
}
|
||||
constructor(...args){
|
||||
super(...args);
|
||||
|
@ -1,5 +1,5 @@
|
||||
function test() {
|
||||
return(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(A, {
|
||||
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(A, {
|
||||
b: "\\"
|
||||
})));
|
||||
}));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
function test() {
|
||||
return(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(A, {
|
||||
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(A, {
|
||||
b: "\\"
|
||||
})));
|
||||
}));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
function test() {
|
||||
return(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(A, {
|
||||
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(A, {
|
||||
b: "\\x21"
|
||||
})));
|
||||
}));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
function test() {
|
||||
return(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(A, {
|
||||
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(A, {
|
||||
b: "\\ "
|
||||
})));
|
||||
}));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
function test() {
|
||||
return(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(A, {
|
||||
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(A, {
|
||||
b: "\\u54e6"
|
||||
})));
|
||||
}));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
function test() {
|
||||
return(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(A, {
|
||||
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(A, {
|
||||
b: "\\'"
|
||||
})));
|
||||
}));
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
var Component = function() {
|
||||
return(/*#__PURE__*/ React.createElement("pre", null, "| | |"));
|
||||
return /*#__PURE__*/ React.createElement("pre", null, "| | |");
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
var A;
|
||||
(function(A1) {
|
||||
var Foo = A1.Foo = function() {
|
||||
return(/*#__PURE__*/ React.createElement("div", null));
|
||||
return /*#__PURE__*/ React.createElement("div", null);
|
||||
};
|
||||
})(A || (A = {}));
|
||||
|
@ -235,10 +235,10 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) {
|
||||
locales: renderOpts.locales,
|
||||
defaultLocale: renderOpts.defaultLocale,
|
||||
AppTree: (props)=>{
|
||||
return(/*#__PURE__*/ React.createElement(AppContainer, null, /*#__PURE__*/ React.createElement(App, swcHelpers.extends({}, props, {
|
||||
return /*#__PURE__*/ React.createElement(AppContainer, null, /*#__PURE__*/ React.createElement(App, swcHelpers.extends({}, props, {
|
||||
Component: Component,
|
||||
router: router
|
||||
}))));
|
||||
})));
|
||||
},
|
||||
defaultGetInitialProps: async (docCtx)=>{
|
||||
const enhanceApp = (AppComp)=>{
|
||||
|
@ -1,3 +1,3 @@
|
||||
export var App = function() {
|
||||
return(/*#__PURE__*/ testPragma("div", null, /*#__PURE__*/ testPragma(Foo, null)));
|
||||
return /*#__PURE__*/ testPragma("div", null, /*#__PURE__*/ testPragma(Foo, null));
|
||||
};
|
||||
|
@ -3,5 +3,5 @@ function Bar() {
|
||||
var ref = swcHelpers.slicedToArray(useState(0), 2), foo = ref[0], setFoo = ref[1];
|
||||
// @refresh reset
|
||||
React.useEffect(function() {});
|
||||
return(/*#__PURE__*/ React.createElement("h1", null, foo, " "));
|
||||
return /*#__PURE__*/ React.createElement("h1", null, foo, " ");
|
||||
}
|
||||
|
@ -3,5 +3,5 @@ function Bar() {
|
||||
React.useEffect(()=>{
|
||||
// @refresh reset
|
||||
});
|
||||
return(/*#__PURE__*/ React.createElement("h1", null, foo, " "));
|
||||
return /*#__PURE__*/ React.createElement("h1", null, foo, " ");
|
||||
}
|
||||
|
@ -8,5 +8,5 @@ var _react = swcHelpers.interopRequireDefault(require("react"));
|
||||
var _reactI18N = require("@shopify/react-i18n");
|
||||
function App() {
|
||||
var ref = swcHelpers.slicedToArray((0, _reactI18N).useI18n(), 1), i18n = ref[0];
|
||||
return(/*#__PURE__*/ _react.default.createElement("h1", null, i18n.translate("foo")));
|
||||
return /*#__PURE__*/ _react.default.createElement("h1", null, i18n.translate("foo"));
|
||||
}
|
||||
|
@ -8,5 +8,5 @@ var _react = swcHelpers.interopRequireDefault(require("react"));
|
||||
var _reactI18N = require("@shopify/react-i18n");
|
||||
function App() {
|
||||
var ref = swcHelpers.slicedToArray((0, _reactI18N).useI18n(), 1), i18n = ref[0];
|
||||
return(/*#__PURE__*/ _react.default.createElement("h1", null, i18n.translate("foo")));
|
||||
return /*#__PURE__*/ _react.default.createElement("h1", null, i18n.translate("foo"));
|
||||
}
|
||||
|
@ -8,5 +8,5 @@ var _react = swcHelpers.interopRequireDefault(require("react"));
|
||||
var _reactI18N = require("@shopify/react-i18n");
|
||||
function App() {
|
||||
var ref = swcHelpers.slicedToArray((0, _reactI18N).useI18n(), 1), i18n = ref[0];
|
||||
return(/*#__PURE__*/ _react.default.createElement("h1", null, i18n.translate("foo")));
|
||||
return /*#__PURE__*/ _react.default.createElement("h1", null, i18n.translate("foo"));
|
||||
}
|
||||
|
@ -3,5 +3,5 @@ import React from "react";
|
||||
import { useI18n } from "@shopify/react-i18n";
|
||||
export function App() {
|
||||
var ref = swcHelpers.slicedToArray(useI18n(), 1), i18n = ref[0];
|
||||
return(/*#__PURE__*/ React.createElement("h1", null, i18n.translate("foo")));
|
||||
return /*#__PURE__*/ React.createElement("h1", null, i18n.translate("foo"));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
export default function StaticPage(param) {
|
||||
var data = param.data;
|
||||
return(/*#__PURE__*/ React.createElement("div", null, data.foo));
|
||||
return /*#__PURE__*/ React.createElement("div", null, data.foo);
|
||||
};
|
||||
export function getStaticProps() {
|
||||
return _getStaticProps.apply(this, arguments);
|
||||
|
@ -254,7 +254,7 @@ fn issue_406() {
|
||||
let s = file("tests/projects/issue-406/input.js").unwrap();
|
||||
println!("{}", s);
|
||||
|
||||
assert!(s.contains("return true"));
|
||||
assert!(s.contains("return("));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -291,7 +291,7 @@ fn issue_414() {
|
||||
fn issue_415() {
|
||||
let s = file("tests/projects/issue-415/input.js").unwrap();
|
||||
|
||||
assert!(s.replace(' ', "").contains("return(/*#__PURE__*/"));
|
||||
assert!(s.replace(' ', "").contains("return/*#__PURE__*/"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// all expected to be errors
|
||||
var clodule1 = function clodule1() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, clodule1);
|
||||
|
@ -27,6 +27,7 @@ var X;
|
||||
//var cl: { x: number; y: number; }
|
||||
var cl = new X.Y.Point(1, 1);
|
||||
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
|
||||
// @filename: simple.ts
|
||||
var A = function A() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -26,6 +26,7 @@ var X;
|
||||
//var cl: { x: number; y: number; }
|
||||
var cl = new X.Y.Point(1, 1);
|
||||
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
|
||||
// @filename: simple.ts
|
||||
var A = function A() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var _iterator = Symbol.iterator;
|
||||
var StringIterator = //@target: ES5
|
||||
//@target: ES5
|
||||
// In ES3/5, you cannot for...of over an arbitrary iterable.
|
||||
/*#__PURE__*/ function() {
|
||||
var StringIterator = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function StringIterator() {
|
||||
swcHelpers.classCallCheck(this, StringIterator);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var _iterator = Symbol.iterator;
|
||||
var C = //@target: ES5
|
||||
/*#__PURE__*/ function() {
|
||||
//@target: ES5
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var C = // @target: es6
|
||||
/*#__PURE__*/ function() {
|
||||
// @target: es6
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var C = // @target: es6
|
||||
/*#__PURE__*/ function() {
|
||||
// @target: es6
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var _foo = foo;
|
||||
var C = // @target: es6
|
||||
/*#__PURE__*/ function() {
|
||||
// @target: es6
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var C = // @target: es6
|
||||
/*#__PURE__*/ function() {
|
||||
// @target: es6
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -25,6 +25,7 @@ var X;
|
||||
(function(A1) {
|
||||
var Instance = A1.Instance = new A();
|
||||
})(A || (A = {}));
|
||||
// duplicate identifier
|
||||
var A = function A() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var C = // @target: es6
|
||||
/*#__PURE__*/ function() {
|
||||
// @target: es6
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var A = // @target: es2015,esnext
|
||||
// @target: es2015,esnext
|
||||
// @useDefineForClassFields: true
|
||||
/*#__PURE__*/ function() {
|
||||
var A = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function A() {
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var C = // @target: ES3
|
||||
// @target: ES3
|
||||
// error to use accessors in ES3 mode
|
||||
/*#__PURE__*/ function() {
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var C = // @target: ES5
|
||||
/*#__PURE__*/ function() {
|
||||
// @target: ES5
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var C = // @target: ES5
|
||||
/*#__PURE__*/ function() {
|
||||
// @target: ES5
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var C = // accessors are not contextually typed
|
||||
/*#__PURE__*/ function() {
|
||||
// accessors are not contextually typed
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var A = // @target: esnext
|
||||
// @target: esnext
|
||||
// @useDefineForClassFields: true
|
||||
/*#__PURE__*/ function() {
|
||||
var A = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function A() {
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -1,4 +1,6 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// @target: esnext
|
||||
// @useDefineForClassFields: true
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,4 +1,6 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// @target: esnext
|
||||
// @useDefineForClassFields: false
|
||||
var A = function A() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -1,4 +1,6 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// @target: esnext
|
||||
// @useDefineForClassFields: true
|
||||
var A = function A() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -1,10 +1,12 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// subtype checks use the apparent type of the target type
|
||||
// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S:
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
};
|
||||
var Derived = // is String (S) a subtype of U extends String (T)? Would only be true if we used the apparent type of U (T)
|
||||
/*#__PURE__*/ function(Base) {
|
||||
// is String (S) a subtype of U extends String (T)? Would only be true if we used the apparent type of U (T)
|
||||
var Derived = /*#__PURE__*/ function(Base) {
|
||||
"use strict";
|
||||
swcHelpers.inherits(Derived, Base);
|
||||
var _super = swcHelpers.createSuper(Derived);
|
||||
@ -18,8 +20,8 @@ var Base2 = function Base2() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base2);
|
||||
};
|
||||
var Derived2 = // is U extends String (S) a subtype of String (T)? Apparent type of U is String so it succeeds
|
||||
/*#__PURE__*/ function(Base2) {
|
||||
// is U extends String (S) a subtype of String (T)? Apparent type of U is String so it succeeds
|
||||
var Derived2 = /*#__PURE__*/ function(Base2) {
|
||||
"use strict";
|
||||
swcHelpers.inherits(Derived2, Base2);
|
||||
var _super = swcHelpers.createSuper(Derived2);
|
||||
|
@ -1,10 +1,12 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// subtype checks use the apparent type of the target type
|
||||
// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S:
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
};
|
||||
var Derived = // is String (S) a subtype of U extends String (T)? Would only be true if we used the apparent type of U (T)
|
||||
/*#__PURE__*/ function(Base) {
|
||||
// is String (S) a subtype of U extends String (T)? Would only be true if we used the apparent type of U (T)
|
||||
var Derived = /*#__PURE__*/ function(Base) {
|
||||
"use strict";
|
||||
swcHelpers.inherits(Derived, Base);
|
||||
var _super = swcHelpers.createSuper(Derived);
|
||||
|
@ -84,6 +84,7 @@ var context2 = [
|
||||
c: 0
|
||||
}
|
||||
];
|
||||
// Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[]
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -55,9 +55,9 @@ var p9 = function(param) {
|
||||
var p10 = function(param) {
|
||||
var _param = swcHelpers.slicedToArray(param, 1), ref = _param[0], value = ref.value, done = ref.done;
|
||||
};
|
||||
var MyClass = // Arrow function used in class member initializer
|
||||
// Arrow function used in class member initializer
|
||||
// Arrow function used in class member function
|
||||
/*#__PURE__*/ function() {
|
||||
var MyClass = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function MyClass() {
|
||||
var _this = this;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var C = // @useDefineForClassFields: true
|
||||
// @useDefineForClassFields: true
|
||||
// @target: esnext
|
||||
/*#__PURE__*/ function() {
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C(foo) {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// these are all permitted with the current rules, since we do not do contextual signature instantiation
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// checking assignment compat for function types. No errors in this file
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// checking assignment compatibility relations for function types. All valid
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// checking assignment compatibility relations for function types. All of these are valid.
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// checking assignment compat for function types. All valid
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// checking assignment compatibility relations for function types. All valid.
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,4 +1,6 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M
|
||||
// additional optional properties do not cause errors
|
||||
var S = function S() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, S);
|
||||
|
@ -1,4 +1,6 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M
|
||||
// additional optional properties do not cause errors
|
||||
var S = function S() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, S);
|
||||
|
@ -2,6 +2,7 @@ import * as swcHelpers from "@swc/helpers";
|
||||
// members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M
|
||||
var TargetIsPublic;
|
||||
(function(TargetIsPublic) {
|
||||
// targets
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
@ -9,6 +10,7 @@ var TargetIsPublic;
|
||||
var a;
|
||||
var b;
|
||||
var i;
|
||||
// sources
|
||||
var D = function D() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, D);
|
||||
@ -42,6 +44,7 @@ var TargetIsPublic;
|
||||
e = e;
|
||||
})(TargetIsPublic || (TargetIsPublic = {}));
|
||||
(function(TargetIsPublic) {
|
||||
// targets
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
@ -49,6 +52,7 @@ var TargetIsPublic;
|
||||
var a;
|
||||
var b;
|
||||
var i;
|
||||
// sources
|
||||
var D = function D() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, D);
|
||||
|
@ -1,4 +1,6 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M
|
||||
// numeric named properties work correctly, no errors expected
|
||||
var S = function S() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, S);
|
||||
|
@ -1,4 +1,6 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// M is optional and S contains no property with the same name as M
|
||||
// N is optional and T contains no property with the same name as N
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// Derived member is not optional but base member is, should be ok
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,5 +1,9 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
// @target: es5
|
||||
// @lib: esnext, dom
|
||||
// @downlevelIteration: true
|
||||
// https://github.com/Microsoft/TypeScript/issues/24722
|
||||
var A = function A() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var C = // @target: es2017
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
/*#__PURE__*/ function() {
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var C = // @target: ES5
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
/*#__PURE__*/ function() {
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var C = // @target: ES6
|
||||
// @target: ES6
|
||||
// @noEmitHelpers: true
|
||||
/*#__PURE__*/ function() {
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var C = // @target: es2017
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
/*#__PURE__*/ function() {
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var C = // @target: ES5
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
/*#__PURE__*/ function() {
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var C = // @target: ES6
|
||||
// @target: ES6
|
||||
// @noEmitHelpers: true
|
||||
/*#__PURE__*/ function() {
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,6 +1,10 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var _B;
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
// https://github.com/Microsoft/TypeScript/issues/20744
|
||||
var A = function A() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var C = // @target: ES5
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
/*#__PURE__*/ function() {
|
||||
var C = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var A = // @target: es6
|
||||
/*#__PURE__*/ function() {
|
||||
// @target: es6
|
||||
var A = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function A() {
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var A = // @target: es2017
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
/*#__PURE__*/ function() {
|
||||
var A = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function A() {
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var A = // @target: ES5
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
/*#__PURE__*/ function() {
|
||||
var A = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function A() {
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var A = // @target: ES6
|
||||
// @target: ES6
|
||||
// @lib: esnext
|
||||
// @noEmitHelpers: true
|
||||
/*#__PURE__*/ function() {
|
||||
var A = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function A() {
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -9,7 +9,7 @@ function _func() {
|
||||
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
||||
while(1)switch(_ctx.prev = _ctx.next){
|
||||
case 0:
|
||||
_ctx.t0 = /*#__PURE__*/ function(_superClass) {
|
||||
_ctx.t0 = function(_superClass) {
|
||||
"use strict";
|
||||
swcHelpers.inherits(D, _superClass);
|
||||
var _super = swcHelpers.createSuper(D);
|
||||
@ -23,7 +23,7 @@ function _func() {
|
||||
return p;
|
||||
case 3:
|
||||
_ctx.t1 = _ctx.sent;
|
||||
D = (0, _ctx.t0)(_ctx.t1);
|
||||
D = /*#__PURE__*/ (0, _ctx.t0)(_ctx.t1);
|
||||
case 5:
|
||||
case "end":
|
||||
return _ctx.stop();
|
||||
|
@ -9,7 +9,7 @@ function _func() {
|
||||
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
||||
while(1)switch(_ctx.prev = _ctx.next){
|
||||
case 0:
|
||||
_ctx.t0 = /*#__PURE__*/ function(_superClass) {
|
||||
_ctx.t0 = function(_superClass) {
|
||||
"use strict";
|
||||
swcHelpers.inherits(D, _superClass);
|
||||
var _super = swcHelpers.createSuper(D);
|
||||
@ -23,7 +23,7 @@ function _func() {
|
||||
return p;
|
||||
case 3:
|
||||
_ctx.t1 = _ctx.sent;
|
||||
D = (0, _ctx.t0)(_ctx.t1);
|
||||
D = /*#__PURE__*/ (0, _ctx.t0)(_ctx.t1);
|
||||
case 5:
|
||||
case "end":
|
||||
return _ctx.stop();
|
||||
|
@ -9,7 +9,7 @@ function _func() {
|
||||
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
||||
while(1)switch(_ctx.prev = _ctx.next){
|
||||
case 0:
|
||||
_ctx.t0 = /*#__PURE__*/ function(_superClass) {
|
||||
_ctx.t0 = function(_superClass) {
|
||||
"use strict";
|
||||
swcHelpers.inherits(D, _superClass);
|
||||
var _super = swcHelpers.createSuper(D);
|
||||
@ -23,7 +23,7 @@ function _func() {
|
||||
return p;
|
||||
case 3:
|
||||
_ctx.t1 = _ctx.sent;
|
||||
D = (0, _ctx.t0)(_ctx.t1);
|
||||
D = /*#__PURE__*/ (0, _ctx.t0)(_ctx.t1);
|
||||
case 5:
|
||||
case "end":
|
||||
return _ctx.stop();
|
||||
|
@ -1,4 +1,6 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist)
|
||||
// these are errors
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var Base = // @target: *,-es3
|
||||
// @target: *,-es3
|
||||
// @strict: true
|
||||
// @noTypesAndSymbols: true
|
||||
// GH#34952
|
||||
/*#__PURE__*/ function() {
|
||||
var Base = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function Base() {
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// checking subtype relations for function types as it relates to contextual signature instantiation
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// checking subtype relations for function types as it relates to contextual signature instantiation
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,4 +1,6 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// checking subtype relations for function types as it relates to contextual signature instantiation
|
||||
// same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,4 +1,7 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// checking subtype relations for function types as it relates to contextual signature instantiation
|
||||
// same as subtypingWithCallSignatures4 but using class type parameters instead of generic signatures
|
||||
// all are errors
|
||||
var Base = function Base() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Base);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var X = // @strict: true
|
||||
// @strict: true
|
||||
// From #4260
|
||||
/*#__PURE__*/ function() {
|
||||
var X = /*#__PURE__*/ function() {
|
||||
"use strict";
|
||||
function X() {
|
||||
swcHelpers.classCallCheck(this, X);
|
||||
@ -26,6 +26,7 @@ xUnknown.f() // error, unknown still expects an argument
|
||||
;
|
||||
xNever.f() // error, never still expects an argument
|
||||
;
|
||||
// Promise has previously been updated to work without arguments, but to show this fixes the issue too.
|
||||
var MyPromise = function MyPromise(executor) {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, MyPromise);
|
||||
|
@ -11,7 +11,11 @@ import * as swcHelpers from "@swc/helpers";
|
||||
/** @type {Id<string>} I actually wanted to write `const "120"` */ var one_twenty = function(s) {
|
||||
return "120";
|
||||
};
|
||||
var SharedClass = function SharedClass() {
|
||||
/** @template S
|
||||
* @callback SharedId
|
||||
* @param {S} ego
|
||||
* @return {S}
|
||||
*/ var SharedClass = function SharedClass() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, SharedClass);
|
||||
/** @type {SharedId<S>} */ this.id;
|
||||
|
@ -3,6 +3,7 @@ import * as swcHelpers from "@swc/helpers";
|
||||
import * as types from './b';
|
||||
// @Filename: /d.ts
|
||||
import types from './c';
|
||||
// @Filename: /a.ts
|
||||
var A = function A() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -1,6 +1,7 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
// @Filename: /d.ts
|
||||
import { D } from './c';
|
||||
// @Filename: /a.ts
|
||||
var A = function A() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
|
@ -1,6 +1,6 @@
|
||||
class Button {
|
||||
render() {
|
||||
return(/*#__PURE__*/ React.createElement("div", null, "My Button"));
|
||||
return /*#__PURE__*/ React.createElement("div", null, "My Button");
|
||||
}
|
||||
}
|
||||
// OK
|
||||
|
@ -6,14 +6,14 @@ var Button = /*#__PURE__*/ function() {
|
||||
}
|
||||
var _proto = Button.prototype;
|
||||
_proto.render = function render() {
|
||||
return(/*#__PURE__*/ React.createElement("div", null, "My Button"));
|
||||
return /*#__PURE__*/ React.createElement("div", null, "My Button");
|
||||
};
|
||||
return Button;
|
||||
}();
|
||||
// OK
|
||||
var k1 = /*#__PURE__*/ React.createElement("div", null, " ", /*#__PURE__*/ React.createElement("h2", null, " Hello "), " ", /*#__PURE__*/ React.createElement("h1", null, " world "));
|
||||
var k2 = /*#__PURE__*/ React.createElement("div", null, " ", /*#__PURE__*/ React.createElement("h2", null, " Hello "), " ", function(user) {
|
||||
/*#__PURE__*/ return React.createElement("h2", null, user.name);
|
||||
return /*#__PURE__*/ React.createElement("h2", null, user.name);
|
||||
});
|
||||
var k3 = /*#__PURE__*/ React.createElement("div", null, " ", 1, " ", "That is a number", " ");
|
||||
var k4 = /*#__PURE__*/ React.createElement(Button, null, " ", /*#__PURE__*/ React.createElement("h2", null, " Hello "), " ");
|
||||
|
@ -1,6 +1,6 @@
|
||||
class Button {
|
||||
render() {
|
||||
return(/*#__PURE__*/ React.createElement("div", null, "My Button"));
|
||||
return /*#__PURE__*/ React.createElement("div", null, "My Button");
|
||||
}
|
||||
}
|
||||
// OK
|
||||
|
@ -6,14 +6,14 @@ var Button = /*#__PURE__*/ function() {
|
||||
}
|
||||
var _proto = Button.prototype;
|
||||
_proto.render = function render() {
|
||||
return(/*#__PURE__*/ React.createElement("div", null, "My Button"));
|
||||
return /*#__PURE__*/ React.createElement("div", null, "My Button");
|
||||
};
|
||||
return Button;
|
||||
}();
|
||||
// OK
|
||||
var k1 = /*#__PURE__*/ React.createElement("div", null, " ", /*#__PURE__*/ React.createElement("h2", null, " Hello "), " ", /*#__PURE__*/ React.createElement("h1", null, " world "));
|
||||
var k2 = /*#__PURE__*/ React.createElement("div", null, " ", /*#__PURE__*/ React.createElement("h2", null, " Hello "), " ", function(user) {
|
||||
/*#__PURE__*/ return React.createElement("h2", null, user.name);
|
||||
return /*#__PURE__*/ React.createElement("h2", null, user.name);
|
||||
});
|
||||
var k3 = /*#__PURE__*/ React.createElement("div", null, " ", 1, " ", "That is a number", " ");
|
||||
var k4 = /*#__PURE__*/ React.createElement(Button, null, " ", /*#__PURE__*/ React.createElement("h2", null, " Hello "), " ");
|
||||
|
@ -9,15 +9,15 @@ class Button extends React.Component {
|
||||
render() {
|
||||
let condition;
|
||||
if (condition) {
|
||||
return(/*#__PURE__*/ React.createElement(InnerButton, swcHelpers.extends({}, this.props)));
|
||||
return /*#__PURE__*/ React.createElement(InnerButton, swcHelpers.extends({}, this.props));
|
||||
} else {
|
||||
return(/*#__PURE__*/ React.createElement(InnerButton, swcHelpers.extends({}, this.props), /*#__PURE__*/ React.createElement("div", null, "Hello World")));
|
||||
return /*#__PURE__*/ React.createElement(InnerButton, swcHelpers.extends({}, this.props), /*#__PURE__*/ React.createElement("div", null, "Hello World"));
|
||||
}
|
||||
}
|
||||
}
|
||||
class InnerButton extends React.Component {
|
||||
render() {
|
||||
return(/*#__PURE__*/ React.createElement("button", null, "Hello"));
|
||||
return /*#__PURE__*/ React.createElement("button", null, "Hello");
|
||||
}
|
||||
}
|
||||
export { };
|
||||
|
@ -17,9 +17,9 @@ var Button = /*#__PURE__*/ function(_Component) {
|
||||
_proto.render = function render() {
|
||||
var condition;
|
||||
if (condition) {
|
||||
return(/*#__PURE__*/ React.createElement(InnerButton, swcHelpers.extends({}, this.props)));
|
||||
return /*#__PURE__*/ React.createElement(InnerButton, swcHelpers.extends({}, this.props));
|
||||
} else {
|
||||
return(/*#__PURE__*/ React.createElement(InnerButton, swcHelpers.extends({}, this.props), /*#__PURE__*/ React.createElement("div", null, "Hello World")));
|
||||
return /*#__PURE__*/ React.createElement(InnerButton, swcHelpers.extends({}, this.props), /*#__PURE__*/ React.createElement("div", null, "Hello World"));
|
||||
}
|
||||
};
|
||||
return Button;
|
||||
@ -34,7 +34,7 @@ var InnerButton = /*#__PURE__*/ function(_Component) {
|
||||
}
|
||||
var _proto = InnerButton.prototype;
|
||||
_proto.render = function render() {
|
||||
return(/*#__PURE__*/ React.createElement("button", null, "Hello"));
|
||||
return /*#__PURE__*/ React.createElement("button", null, "Hello");
|
||||
};
|
||||
return InnerButton;
|
||||
}(React.Component);
|
||||
|
@ -9,14 +9,14 @@ const React = require('react');
|
||||
class Button extends React.Component {
|
||||
render() {
|
||||
// Error children are specified twice
|
||||
return(/*#__PURE__*/ React.createElement(InnerButton, swcHelpers.extends({}, this.props, {
|
||||
return /*#__PURE__*/ React.createElement(InnerButton, swcHelpers.extends({}, this.props, {
|
||||
children: "hi"
|
||||
}), /*#__PURE__*/ React.createElement("div", null, "Hello World")));
|
||||
}), /*#__PURE__*/ React.createElement("div", null, "Hello World"));
|
||||
}
|
||||
}
|
||||
class InnerButton extends React.Component {
|
||||
render() {
|
||||
return(/*#__PURE__*/ React.createElement("button", null, "Hello"));
|
||||
return /*#__PURE__*/ React.createElement("button", null, "Hello");
|
||||
}
|
||||
}
|
||||
export { };
|
||||
|
@ -17,9 +17,9 @@ var Button = /*#__PURE__*/ function(_Component) {
|
||||
var _proto = Button.prototype;
|
||||
_proto.render = function render() {
|
||||
// Error children are specified twice
|
||||
return(/*#__PURE__*/ React.createElement(InnerButton, swcHelpers.extends({}, this.props, {
|
||||
return /*#__PURE__*/ React.createElement(InnerButton, swcHelpers.extends({}, this.props, {
|
||||
children: "hi"
|
||||
}), /*#__PURE__*/ React.createElement("div", null, "Hello World")));
|
||||
}), /*#__PURE__*/ React.createElement("div", null, "Hello World"));
|
||||
};
|
||||
return Button;
|
||||
}(React.Component);
|
||||
@ -33,7 +33,7 @@ var InnerButton = /*#__PURE__*/ function(_Component) {
|
||||
}
|
||||
var _proto = InnerButton.prototype;
|
||||
_proto.render = function render() {
|
||||
return(/*#__PURE__*/ React.createElement("button", null, "Hello"));
|
||||
return /*#__PURE__*/ React.createElement("button", null, "Hello");
|
||||
};
|
||||
return InnerButton;
|
||||
}(React.Component);
|
||||
|
@ -6,14 +6,14 @@
|
||||
const React = require('react');
|
||||
class Button extends React.Component {
|
||||
render() {
|
||||
return(/*#__PURE__*/ React.createElement("div", null, "My Button"));
|
||||
return /*#__PURE__*/ React.createElement("div", null, "My Button");
|
||||
}
|
||||
}
|
||||
function AnotherButton(p) {
|
||||
return(/*#__PURE__*/ React.createElement("h1", null, "Just Another Button"));
|
||||
return /*#__PURE__*/ React.createElement("h1", null, "Just Another Button");
|
||||
}
|
||||
function Comp(p) {
|
||||
return(/*#__PURE__*/ React.createElement("div", null, p.b));
|
||||
return /*#__PURE__*/ React.createElement("div", null, p.b);
|
||||
}
|
||||
// OK
|
||||
let k1 = /*#__PURE__*/ React.createElement(Comp, {
|
||||
@ -29,7 +29,7 @@ let k3 = /*#__PURE__*/ React.createElement(Comp, {
|
||||
b: "hi"
|
||||
}, /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Button, null), /*#__PURE__*/ React.createElement(AnotherButton, null)));
|
||||
function SingleChildComp(p) {
|
||||
return(/*#__PURE__*/ React.createElement("div", null, p.b));
|
||||
return /*#__PURE__*/ React.createElement("div", null, p.b);
|
||||
}
|
||||
// OK
|
||||
let k4 = /*#__PURE__*/ React.createElement(SingleChildComp, {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user