mirror of
https://github.com/swc-project/swc.git
synced 2024-11-27 13:38:33 +03:00
fix(es/transform/optimization): Prevent inlining of vars used as RHS in logical expressions (#3907)
This commit is contained in:
parent
a64473dc34
commit
782a874696
@ -339,6 +339,15 @@ impl VisitMut for Inlining<'_> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Expr::Bin(b) = node {
|
||||
match b.op {
|
||||
BinaryOp::LogicalAnd | BinaryOp::LogicalOr => {
|
||||
self.visit_with_child(ScopeKind::Cond, &mut b.right);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_mut_fn_decl(&mut self, node: &mut FnDecl) {
|
||||
|
@ -0,0 +1,10 @@
|
||||
/** @license React v17.0.2
|
||||
* react-jsx-runtime.profiling.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
'use strict';require("object-assign");var f=require("react"),g=60103;exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h("react.element");exports.Fragment=h("react.fragment")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};
|
||||
function q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=""+k);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q;
|
@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
require("object-assign");
|
||||
var f = require("react"), g = 60103;
|
||||
exports.Fragment = 60107;
|
||||
if ("function" === typeof Symbol && Symbol.for) {
|
||||
var h = Symbol.for;
|
||||
g = h("react.element");
|
||||
exports.Fragment = h("react.fragment");
|
||||
}
|
||||
var m = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = Object.prototype.hasOwnProperty, p = {
|
||||
key: !0,
|
||||
ref: !0,
|
||||
__self: !0,
|
||||
__source: !0
|
||||
};
|
||||
function q(c, a, k) {
|
||||
var b, d = {}, e = null, l = null;
|
||||
void 0 !== k && (e = "" + k);
|
||||
void 0 !== a.key && (e = "" + a.key);
|
||||
void 0 !== a.ref && (l = a.ref);
|
||||
for(b in a)n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
||||
if (c && c.defaultProps) for(b in a = c.defaultProps, a)void 0 === d[b] && (d[b] = a[b]);
|
||||
return {
|
||||
$$typeof: g,
|
||||
type: c,
|
||||
key: e,
|
||||
ref: l,
|
||||
props: d,
|
||||
_owner: m.current
|
||||
};
|
||||
}
|
||||
exports.jsx = q;
|
||||
exports.jsxs = q;
|
Loading…
Reference in New Issue
Block a user