refactor(es/minifier): Merge cond_init with reassigned (#6850)

**Description:**

And optimize the following situation
```js
export function genElement(el, state) {
    if ('slot' === el.tag) return el1 = el, genChildren(el1);
    if (el.component) {
        var el1
        return 999;
    }
}
```
which rarely happens in hand written JS, but is often generated by swc merge variable pass.
This commit is contained in:
Austaras 2023-01-26 09:17:33 +08:00 committed by GitHub
parent 1bf9b3777e
commit 55225cb994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 51 additions and 60 deletions

View File

@ -77,7 +77,7 @@ where
return;
}
if usage.cond_init || usage.used_above_decl {
if usage.used_above_decl {
log_abort!("inline: [x] It's cond init or used before decl",);
return;
}
@ -188,7 +188,7 @@ where
.vars
.get(&id.to_id())
.filter(|a| {
!a.reassigned() && a.declared && !a.cond_init && {
!a.reassigned() && a.declared && {
// Function declarations are hoisted
//
// As we copy expressions, this can cause a problem.
@ -360,10 +360,7 @@ where
Expr::Ident(id) if !id.eq_ignore_span(ident) => {
if let Some(init_usage) = self.data.vars.get(&id.to_id()) {
if init_usage.reassigned()
|| !init_usage.declared
|| init_usage.cond_init
{
if init_usage.reassigned() || !init_usage.declared {
return;
}
}

View File

@ -64,9 +64,6 @@ pub(crate) struct VarUsageInfo {
/// The number of direct reference to this identifier.
pub(crate) ref_count: u32,
/// `true` if a variable is conditionally initialized.
pub(crate) cond_init: bool,
/// `false` if it's only used.
pub(crate) declared: bool,
pub(crate) declared_count: u32,
@ -86,9 +83,8 @@ pub(crate) struct VarUsageInfo {
/// - Update is counted as usage, but assign is not
pub(crate) usage_count: u32,
/// The variable itself is modified.
reassigned_with_assignment: bool,
reassigned_with_var_decl: bool,
/// The variable itself is assigned after reference.
reassigned: bool,
/// The variable itself or a property of it is modified.
pub(crate) mutated: bool,
@ -140,7 +136,6 @@ impl Default for VarUsageInfo {
Self {
inline_prevented: Default::default(),
ref_count: Default::default(),
cond_init: Default::default(),
declared: Default::default(),
declared_count: Default::default(),
declared_as_fn_param: Default::default(),
@ -149,8 +144,7 @@ impl Default for VarUsageInfo {
assign_count: Default::default(),
mutation_by_call_count: Default::default(),
usage_count: Default::default(),
reassigned_with_assignment: Default::default(),
reassigned_with_var_decl: Default::default(),
reassigned: Default::default(),
mutated: Default::default(),
has_property_access: Default::default(),
has_property_mutation: Default::default(),
@ -186,8 +180,7 @@ impl VarUsageInfo {
}
pub(crate) fn reassigned(&self) -> bool {
self.reassigned_with_assignment
|| self.reassigned_with_var_decl
self.reassigned
|| (u32::from(self.var_initialized)
+ u32::from(self.declared_as_catch_param)
+ u32::from(self.declared_as_fn_param)
@ -241,25 +234,27 @@ impl Storage for ProgramData {
Entry::Occupied(mut e) => {
e.get_mut().inline_prevented |= var_info.inline_prevented;
e.get_mut().cond_init |= if !inited && e.get().var_initialized {
true
} else {
var_info.cond_init
};
if var_info.var_initialized {
if e.get().var_initialized || e.get().ref_count > 0 {
e.get_mut().assign_count += 1;
e.get_mut().reassigned_with_assignment = true;
e.get_mut().reassigned = true;
} else {
// If it is referred outside child scope, it will
// be marked as var_initialized false
e.get_mut().var_initialized = true;
}
} else {
// If it is inited in some other child scope, but referenced in
// current child scope
if !inited && e.get().var_initialized && var_info.ref_count > 0 {
e.get_mut().reassigned = true
}
}
e.get_mut().ref_count += var_info.ref_count;
e.get_mut().reassigned_with_assignment |= var_info.reassigned_with_assignment;
e.get_mut().reassigned_with_var_decl |= var_info.reassigned_with_var_decl;
e.get_mut().reassigned |= var_info.reassigned;
e.get_mut().mutated |= var_info.mutated;
e.get_mut().has_property_access |= var_info.has_property_access;
@ -359,7 +354,7 @@ impl Storage for ProgramData {
}
v.mutated = true;
v.reassigned_with_var_decl = true;
v.reassigned = true;
v.assign_count += 1;
}
@ -458,8 +453,8 @@ impl VarDataLike for VarUsageInfo {
self.mutated = true;
}
fn mark_reassigned_with_assign(&mut self) {
self.reassigned_with_assignment = true;
fn mark_reassigned(&mut self) {
self.reassigned = true;
}
fn add_infects_to(&mut self, other: Access) {
@ -625,11 +620,10 @@ impl ProgramData {
if is_first {
e.ref_count += 1;
if !inited && e.var_initialized {
e.cond_init = true;
if !is_modify {
e.var_initialized = false;
e.assign_count += 1;
e.reassigned_with_assignment = true
e.reassigned = true
}
}
}
@ -656,7 +650,7 @@ impl ProgramData {
e.assign_count -= 1;
e.var_initialized = true;
} else {
e.reassigned_with_assignment = true
e.reassigned = true
}
}

View File

@ -26853,8 +26853,8 @@
mousemove: function(e) {
var x = e.offsetX, y = e.offsetY, localCursorPoint = this.group.transformCoordToLocal(x, y);
if (!function(controller, e, localCursorPoint) {
if (!(!controller._brushType || (controller1 = controller, x = e.offsetX, y = e.offsetY, zr = controller1._zr, x < 0 || x > zr.getWidth() || y < 0 || y > zr.getHeight()))) {
var controller1, x, y, zr, zr1 = controller._zr, covers = controller._covers, currPanel = getPanelByPoint(controller, e, localCursorPoint);
if (!(!controller._brushType || (x = e.offsetX, y = e.offsetY, zr = controller._zr, x < 0 || x > zr.getWidth() || y < 0 || y > zr.getHeight()))) {
var x, y, zr, zr1 = controller._zr, covers = controller._covers, currPanel = getPanelByPoint(controller, e, localCursorPoint);
if (!controller._dragging) for(var i = 0; i < covers.length; i++){
var brushOption = covers[i].__brushOption;
if (currPanel && (!0 === currPanel || brushOption.panelId === currPanel.panelId) && coverRenderers[brushOption.brushType].contain(covers[i], localCursorPoint[0], localCursorPoint[1])) return;
@ -36191,10 +36191,10 @@
'parallel' === seriesModel.subType ? (coordSys = seriesModel.coordinateSystem, hasBrushExists = hasBrushExists || coordSys.hasAxisBrushed(), linkOthers(seriesIndex) && coordSys.eachActiveState(seriesModel.getData(), function(activeState, dataIndex) {
'active' === activeState && (selectedDataIndexForLink[dataIndex] = 1);
})) : function(seriesModel, seriesIndex, rangeInfoList) {
if (!(!seriesModel.brushSelector || (brushModel1 = brushModel, seriesIndex1 = seriesIndex, null != (seriesIndices = brushModel1.option.seriesIndex) && 'all' !== seriesIndices && (isArray(seriesIndices) ? 0 > indexOf(seriesIndices, seriesIndex1) : seriesIndex1 !== seriesIndices))) && (each(areas, function(area) {
if (!(!seriesModel.brushSelector || null != (seriesIndices = brushModel.option.seriesIndex) && 'all' !== seriesIndices && (isArray(seriesIndices) ? 0 > indexOf(seriesIndices, seriesIndex) : seriesIndex !== seriesIndices)) && (each(areas, function(area) {
brushModel.brushTargetManager.controlSeries(area, seriesModel, ecModel) && rangeInfoList.push(area), hasBrushExists = hasBrushExists || brushed(rangeInfoList);
}), linkOthers(seriesIndex) && brushed(rangeInfoList))) {
var brushModel1, seriesIndex1, seriesIndices, data_1 = seriesModel.getData();
var seriesIndices, data_1 = seriesModel.getData();
data_1.each(function(dataIndex) {
checkInRange(seriesModel, rangeInfoList, data_1, dataIndex) && (selectedDataIndexForLink[dataIndex] = 1);
});
@ -40856,8 +40856,8 @@
return subOption = exprOption.not, errMsg = '', errMsg = makePrintable('"not" condition should only be `not: {}`.', 'Illegal condition:', exprOption), isObject(val = subOption) && !isArrayLike(val) || throwError(errMsg), (cond = new NotConditionInternal()).child = parseOption(subOption, getters), cond.child || throwError(errMsg), cond;
}
return function(exprOption, getters) {
for(var valueGetterParam = getters.prepareGetValue(exprOption), subCondList = [], exprKeys = keys(exprOption), parserName = exprOption.parser, valueParser = parserName ? (type = parserName, valueParserMap.get(type)) : null, i = 0; i < exprKeys.length; i++){
var type, keyRaw = exprKeys[i];
for(var valueGetterParam = getters.prepareGetValue(exprOption), subCondList = [], exprKeys = keys(exprOption), parserName = exprOption.parser, valueParser = parserName ? valueParserMap.get(parserName) : null, i = 0; i < exprKeys.length; i++){
var keyRaw = exprKeys[i];
if (!('parser' === keyRaw || getters.valueGetterAttrMap.get(keyRaw))) {
var op = hasOwn(RELATIONAL_EXPRESSION_OP_ALIAS_MAP, keyRaw) ? RELATIONAL_EXPRESSION_OP_ALIAS_MAP[keyRaw] : keyRaw, condValueRaw = exprOption[keyRaw], condValueParsed = valueParser ? valueParser(condValueRaw) : condValueRaw, evaluator = ('eq' === op || 'ne' === op ? new FilterEqualityComparator('eq' === op, condValueParsed) : hasOwn(ORDER_COMPARISON_OP_MAP, op) ? new FilterOrderComparator(op, condValueParsed) : null) || 'reg' === op && new RegExpEvaluator(condValueParsed);
evaluator || throwError(makePrintable('Illegal relational operation: "' + keyRaw + '" in condition:', exprOption)), subCondList.push(evaluator);

View File

@ -627,9 +627,9 @@
if (!isObject(value)) return value;
var isArr = isArray(value);
if (isArr) {
if (length = (array = value).length, result1 = new array.constructor(length), length && 'string' == typeof array[0] && hasOwnProperty.call(array, 'index') && (result1.index = array.index, result1.input = array.input), result = result1, !isDeep) return copyArray(value, result);
if (length = value.length, result1 = new value.constructor(length), length && 'string' == typeof value[0] && hasOwnProperty.call(value, 'index') && (result1.index = value.index, result1.input = value.input), result = result1, !isDeep) return copyArray(value, result);
} else {
var array, length, result1, object1, object2, object3, tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
var length, result1, object1, object2, object3, tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
if (isBuffer(value)) return cloneBuffer(value, isDeep);
if (tag == objectTag || tag == argsTag || isFunc && !object) {
if (result = isFlat || isFunc ? {} : initCloneObject(value), !isDeep) return isFlat ? (object1 = (object3 = result) && copyObject(value, keysIn(value), object3), copyObject(value, getSymbolsIn(value), object1)) : (object2 = baseAssign(result, value), copyObject(value, getSymbols(value), object2));

View File

@ -2626,14 +2626,14 @@
var id = "__transition-" + this._uid + "-";
child.key = null == child.key ? child.isComment ? id + 'comment' : id + child.tag : isPrimitive(child.key) ? 0 === String(child.key).indexOf(id) ? child.key : id + child.key : child.key;
var data = (child.data || (child.data = {})).transition = extractTransitionData(this), oldRawChild = this._vnode, oldChild = getRealChild(oldRawChild);
if (child.data.directives && child.data.directives.some(isVShowDirective) && (child.data.show = !0), oldChild && oldChild.data && (child1 = child, (oldChild1 = oldChild).key !== child1.key || oldChild1.tag !== child1.tag) && !isAsyncPlaceholder(oldChild) && !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)) {
if (child.data.directives && child.data.directives.some(isVShowDirective) && (child.data.show = !0), oldChild && oldChild.data && (oldChild.key !== child.key || oldChild.tag !== child.tag) && !isAsyncPlaceholder(oldChild) && !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)) {
var oldData = oldChild.data.transition = extend({}, data);
if ('out-in' === mode) return this._leaving = !0, mergeVNodeHook(oldData, 'afterLeave', function() {
this$1._leaving = !1, this$1.$forceUpdate();
}), placeholder(h, rawChild);
if ('in-out' === mode) {
if (isAsyncPlaceholder(child)) return oldRawChild;
var child1, oldChild1, delayedLeave, performLeave = function() {
var delayedLeave, performLeave = function() {
delayedLeave();
};
mergeVNodeHook(data, 'afterEnter', performLeave), mergeVNodeHook(data, 'enterCancelled', performLeave), mergeVNodeHook(oldData, 'delayLeave', function(leave) {
@ -3092,17 +3092,17 @@
if (el.for && !el.forProcessed) return genFor(el, state);
if (el.if && !el.ifProcessed) return genIf(el, state);
if ('template' === el.tag && !el.slotTarget && !state.pre) return genChildren(el, state) || 'void 0';
if ('slot' === el.tag) return el1 = el, state1 = state, res = "_t(" + (el1.slotName || '"default"') + ((children = genChildren(el1, state1)) ? "," + children : ''), attrs = el1.attrs || el1.dynamicAttrs ? genProps((el1.attrs || []).concat(el1.dynamicAttrs || []).map(function(attr) {
if ('slot' === el.tag) return res = "_t(" + (el.slotName || '"default"') + ((children = genChildren(el, state)) ? "," + children : ''), attrs = el.attrs || el.dynamicAttrs ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function(attr) {
return {
name: camelize(attr.name),
value: attr.value,
dynamic: attr.dynamic
};
})) : null, bind$$1 = el1.attrsMap['v-bind'], (attrs || bind$$1) && !children && (res += ",null"), attrs && (res += "," + attrs), bind$$1 && (res += (attrs ? '' : ',null') + "," + bind$$1), res + ')';
if (el.component) componentName = el.component, el2 = el, state2 = state, children1 = el2.inlineTemplate ? null : genChildren(el2, state2, !0), code = "_c(" + componentName + "," + genData$2(el2, state2) + (children1 ? "," + children1 : '') + ")";
})) : null, bind$$1 = el.attrsMap['v-bind'], (attrs || bind$$1) && !children && (res += ",null"), attrs && (res += "," + attrs), bind$$1 && (res += (attrs ? '' : ',null') + "," + bind$$1), res + ')';
if (el.component) componentName = el.component, children1 = el.inlineTemplate ? null : genChildren(el, state, !0), code = "_c(" + componentName + "," + genData$2(el, state) + (children1 ? "," + children1 : '') + ")";
else {
(!el.plain || el.pre && state.maybeComponent(el)) && (data = genData$2(el, state));
var el1, state1, children, res, attrs, bind$$1, code, componentName, el2, state2, children1, data, children2 = el.inlineTemplate ? null : genChildren(el, state, !0);
var children, res, attrs, bind$$1, code, componentName, children1, data, children2 = el.inlineTemplate ? null : genChildren(el, state, !0);
code = "_c('" + el.tag + "'" + (data ? "," + data : '') + (children2 ? "," + children2 : '') + ")";
}
for(var i = 0; i < state.transforms.length; i++)code = state.transforms[i](el, code);

View File

@ -961,12 +961,12 @@
view.mouseDown.delayedSelectionSync = !0, view.domObserver.setCurSelection();
return;
}
if (view.domObserver.disconnectSelection(), view.cursorWrapper) domSel = (view1 = view).root.getSelection(), range = document.createRange(), (img = "IMG" == (node = view1.cursorWrapper.dom).nodeName) ? range.setEnd(node.parentNode, domIndex(node) + 1) : range.setEnd(node, 0), range.collapse(!1), domSel.removeAllRanges(), domSel.addRange(range), !img && !view1.state.selection.visible && result.ie && result.ie_version <= 11 && (node.disabled = !0, node.disabled = !1);
if (view.domObserver.disconnectSelection(), view.cursorWrapper) domSel = view.root.getSelection(), range = document.createRange(), (img = "IMG" == (node = view.cursorWrapper.dom).nodeName) ? range.setEnd(node.parentNode, domIndex(node) + 1) : range.setEnd(node, 0), range.collapse(!1), domSel.removeAllRanges(), domSel.addRange(range), !img && !view.state.selection.visible && result.ie && result.ie_version <= 11 && (node.disabled = !0, node.disabled = !1);
else {
var view1, domSel, range, node, img, view2, doc, domSel1, node1, offset, resetEditableFrom, resetEditableTo, anchor = sel.anchor, head = sel.head;
!brokenSelectBetweenUneditable || sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection || (sel.$from.parent.inlineContent || (resetEditableFrom = temporarilyEditableNear(view, sel.from)), sel.empty || sel.$from.parent.inlineContent || (resetEditableTo = temporarilyEditableNear(view, sel.to))), view.docView.setSelection(anchor, head, view.root, force), brokenSelectBetweenUneditable && (resetEditableFrom && resetEditable(resetEditableFrom), resetEditableTo && resetEditable(resetEditableTo)), sel.visible ? view.dom.classList.remove("ProseMirror-hideselection") : (view.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && ((doc = (view2 = view).dom.ownerDocument).removeEventListener("selectionchange", view2.hideSelectionGuard), node1 = (domSel1 = view2.root.getSelection()).anchorNode, offset = domSel1.anchorOffset, doc.addEventListener("selectionchange", view2.hideSelectionGuard = function() {
(domSel1.anchorNode != node1 || domSel1.anchorOffset != offset) && (doc.removeEventListener("selectionchange", view2.hideSelectionGuard), setTimeout(function() {
(!editorOwnsSelection(view2) || view2.state.selection.visible) && view2.dom.classList.remove("ProseMirror-hideselection");
var domSel, range, node, img, view1, doc, domSel1, node1, offset, resetEditableFrom, resetEditableTo, anchor = sel.anchor, head = sel.head;
!brokenSelectBetweenUneditable || sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection || (sel.$from.parent.inlineContent || (resetEditableFrom = temporarilyEditableNear(view, sel.from)), sel.empty || sel.$from.parent.inlineContent || (resetEditableTo = temporarilyEditableNear(view, sel.to))), view.docView.setSelection(anchor, head, view.root, force), brokenSelectBetweenUneditable && (resetEditableFrom && resetEditable(resetEditableFrom), resetEditableTo && resetEditable(resetEditableTo)), sel.visible ? view.dom.classList.remove("ProseMirror-hideselection") : (view.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && ((doc = (view1 = view).dom.ownerDocument).removeEventListener("selectionchange", view1.hideSelectionGuard), node1 = (domSel1 = view1.root.getSelection()).anchorNode, offset = domSel1.anchorOffset, doc.addEventListener("selectionchange", view1.hideSelectionGuard = function() {
(domSel1.anchorNode != node1 || domSel1.anchorOffset != offset) && (doc.removeEventListener("selectionchange", view1.hideSelectionGuard), setTimeout(function() {
(!editorOwnsSelection(view1) || view1.state.selection.visible) && view1.dom.classList.remove("ProseMirror-hideselection");
}, 20));
})));
}

View File

@ -4745,11 +4745,11 @@
var e = 31 - nc(c), f = 1 << e;
b[e] = 0, d[e] = -1, a[e] = -1, c &= ~f;
}
}(a, f), a === P && (X = P = null, Y = 0), 0 == (2064 & c.subtreeFlags) && 0 == (2064 & c.flags) || tk || (tk = !0, a1 = gc, b1 = function() {
}(a, f), a === P && (X = P = null, Y = 0), 0 == (2064 & c.subtreeFlags) && 0 == (2064 & c.flags) || tk || (tk = !0, $b(gc, function() {
return Gk(), null;
}, $b(a1, b1)), f = 0 != (15990 & c.flags), 0 != (15990 & c.subtreeFlags) || f) {
})), f = 0 != (15990 & c.flags), 0 != (15990 & c.subtreeFlags) || f) {
f = mk.transition, mk.transition = null;
var a1, b1, a2, b2, g = C;
var a1, b1, g = C;
C = 1;
var h = W;
W |= 4, lk.current = null, function(a, b) {
@ -4857,7 +4857,7 @@
});
for("function" == typeof c.focus && c.focus(), c = 0; c < b.length; c++)(a = b[c]).element.scrollLeft = a.left, a.element.scrollTop = a.top;
}
}(Cf), cd = !!Bf, Cf = Bf = null, a.current = c, a2 = c, b2 = a, T = a2, function gk(a, b, c) {
}(Cf), cd = !!Bf, Cf = Bf = null, a.current = c, a1 = c, b1 = a, T = a1, function gk(a, b, c) {
for(var d = 0 != (1 & a.mode); null !== T;){
var e = T, f = e.child;
if (22 === e.tag && d) {
@ -4873,7 +4873,7 @@
ik(a, b, c);
} else 0 != (8772 & e.subtreeFlags) && null !== f ? (f.return = e, T = f) : ik(a, b, c);
}
}(a2, b2, e), cc(), W = h, C = g, mk.transition = f;
}(a1, b1, e), cc(), W = h, C = g, mk.transition = f;
} else a.current = c;
if (tk && (tk = !1, uk = a, vk = e), 0 === (f = a.pendingLanes) && (Oi = null), function(a) {
if (kc && "function" == typeof kc.onCommitFiberRoot) try {

View File

@ -6772,7 +6772,7 @@
}
var currentHostContext = getHostContext();
if (popHydrationState(workInProgress)) {
if (fiber = workInProgress, hostContext2 = currentHostContext, instance = fiber.stateNode, type1 = fiber.type, props = fiber.memoizedProps, rootContainerInstance1 = 0, hostContext = hostContext2, hostInst = fiber, (node = instance)[internalInstanceKey] = hostInst, node1 = instance, props1 = props, node1[internalPropsKey] = props1, updatePayload = function(domElement, tag, rawProps, parentNamespace, rootContainerElement) {
if (instance = (fiber = workInProgress).stateNode, type1 = fiber.type, props = fiber.memoizedProps, rootContainerInstance1 = 0, hostContext = currentHostContext, hostInst = fiber, (node = instance)[internalInstanceKey] = hostInst, node1 = instance, props1 = props, node1[internalPropsKey] = props1, updatePayload = function(domElement, tag, rawProps, parentNamespace, rootContainerElement) {
switch(suppressHydrationWarning = !0 === rawProps[SUPPRESS_HYDRATION_WARNING], isCustomComponentTag = isCustomComponent(tag, rawProps), validatePropertiesInDevelopment(tag, rawProps), tag){
case "dialog":
listenToNonDelegatedEvent("cancel", domElement), listenToNonDelegatedEvent("close", domElement);
@ -6906,7 +6906,7 @@
return updatePayload;
}(instance, type1, props, hostContext.namespace), fiber.updateQueue = updatePayload, null !== updatePayload) markUpdate(workInProgress);
} else {
var instance, type1, props, rootContainerInstance1, hostContext, hostInst, node, node1, props1, type2, props2, rootContainerInstance2, hostContext1, internalInstanceHandle, domElement, hostInst1, node2, node3, props3, fiber, rootContainerInstance3, hostContext2, updatePayload, instance1 = (type2 = type, props2 = newProps, rootContainerInstance2 = rootContainerInstance, hostContext1 = currentHostContext, internalInstanceHandle = workInProgress, validateDOMNesting(type2, null, hostContext1.ancestorInfo), ("string" == typeof props2.children || "number" == typeof props2.children) && validateDOMNesting(null, "" + props2.children, updatedAncestorInfo(hostContext1.ancestorInfo, type2)), domElement = function(type, props, rootContainerElement, parentNamespace) {
var instance, type1, props, rootContainerInstance1, hostContext, hostInst, node, node1, props1, type2, props2, rootContainerInstance2, hostContext1, internalInstanceHandle, domElement, hostInst1, node2, node3, props3, fiber, updatePayload, instance1 = (type2 = type, props2 = newProps, rootContainerInstance2 = rootContainerInstance, hostContext1 = currentHostContext, internalInstanceHandle = workInProgress, validateDOMNesting(type2, null, hostContext1.ancestorInfo), ("string" == typeof props2.children || "number" == typeof props2.children) && validateDOMNesting(null, "" + props2.children, updatedAncestorInfo(hostContext1.ancestorInfo, type2)), domElement = function(type, props, rootContainerElement, parentNamespace) {
var isCustomComponentTag, domElement, ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement), namespaceURI = parentNamespace;
if (namespaceURI === HTML_NAMESPACE$1 && (namespaceURI = getIntrinsicNamespace(type)), namespaceURI === HTML_NAMESPACE$1) {
if ((isCustomComponentTag = isCustomComponent(type, props)) || type === type.toLowerCase() || error("<%s /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.", type), "script" === type) {

View File

@ -120,7 +120,7 @@ where
}
if in_left_of_for_loop {
v.mark_reassigned_with_assign();
v.mark_reassigned();
v.mark_mutated();
}
} else {
@ -299,7 +299,7 @@ where
fn visit_block_stmt(&mut self, n: &BlockStmt) {
self.with_child(n.span.ctxt, ScopeKind::Block, |child| {
n.visit_children_with(child);
})
});
}
#[cfg_attr(feature = "debug", tracing::instrument(skip(self, n)))]

View File

@ -64,7 +64,7 @@ pub trait VarDataLike: Sized {
fn add_accessed_property(&mut self, name: JsWord);
fn mark_mutated(&mut self);
fn mark_reassigned_with_assign(&mut self);
fn mark_reassigned(&mut self);
fn add_infects_to(&mut self, other: Access);