mirror of
https://github.com/swc-project/swc.git
synced 2024-12-28 16:13:34 +03:00
feat(es/minfiier): Compute more with sequential inliner (#6169)
This commit is contained in:
parent
51132f0636
commit
743a1aab4f
@ -1,5 +1,5 @@
|
||||
//// [compoundAdditionAssignmentLHSCanBeAssigned.ts]
|
||||
var E, a, b, x1, x2, x3, x4, x6;
|
||||
var E;
|
||||
!function(E) {
|
||||
E[E.a = 0] = "a", E[E.b = 1] = "b";
|
||||
}(E || (E = {})), x1 += a, x1 += b, x1 += !0, x1 += 0, x1 += "", x1 += E.a, x1 += {}, x1 += null, x1 += void 0, x2 += a, x2 += b, x2 += !0, x2 += 0, x2 += "", x2 += E.a, x2 += {}, x2 += null, x2 += void 0, x3 += a, x3 += 0, x3 += E.a, x3 += null, x3 += void 0, x4 += a, x4 += 0, x4 += E.a, x4 += null, x4 += void 0, x6 += a, x6 += "";
|
||||
}(E || (E = {})), E.a, E.a, E.a, E.a;
|
||||
|
@ -1,5 +1,5 @@
|
||||
//// [compoundAdditionAssignmentWithInvalidOperands.ts]
|
||||
var E, a, x1, x2, x3, x4, x5;
|
||||
var E;
|
||||
!function(E) {
|
||||
E[E.a = 0] = "a", E[E.b = 1] = "b";
|
||||
}(E || (E = {})), x1 += a, x1 += !0, x1 += 0, x1 += E.a, x1 += {}, x1 += null, x1 += void 0, x2 += a, x2 += !0, x2 += 0, x2 += E.a, x2 += {}, x2 += null, x2 += void 0, x3 += a, x3 += !0, x3 += 0, x3 += E.a, x3 += {}, x3 += null, x3 += void 0, x4 += a, x4 += !0, x4 += {}, x5 += a, x5 += !0, x5 += {};
|
||||
}(E || (E = {})), E.a, E.a, E.a;
|
||||
|
@ -1,5 +1,5 @@
|
||||
//// [compoundArithmeticAssignmentLHSCanBeAssigned.ts]
|
||||
var E, a, b, c, x1, x2, x3;
|
||||
var E;
|
||||
!function(E) {
|
||||
E[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c";
|
||||
}(E || (E = {})), x1 *= a, x1 *= b, x1 *= c, x1 *= null, x1 *= void 0, x2 *= a, x2 *= b, x2 *= c, x2 *= null, x2 *= void 0, x3 *= a, x3 *= b, x3 *= c, x3 *= null, x3 *= void 0;
|
||||
}(E || (E = {}));
|
||||
|
@ -1,5 +1,5 @@
|
||||
//// [compoundArithmeticAssignmentWithInvalidOperands.ts]
|
||||
var E, a, b, x1, x2, x3, x4, x5, x6;
|
||||
var E;
|
||||
!function(E) {
|
||||
E[E.a = 0] = "a", E[E.b = 1] = "b";
|
||||
}(E || (E = {})), x1 *= a, x1 *= b, x1 *= !0, x1 *= 0, x1 *= "", x1 *= E.a, x1 *= {}, x1 *= null, x1 *= void 0, x2 *= a, x2 *= b, x2 *= !0, x2 *= 0, x2 *= "", x2 *= E.a, x2 *= {}, x2 *= null, x2 *= void 0, x3 *= a, x3 *= b, x3 *= !0, x3 *= 0, x3 *= "", x3 *= E.a, x3 *= {}, x3 *= null, x3 *= void 0, x4 *= a, x4 *= b, x4 *= !0, x4 *= 0, x4 *= "", x4 *= E.a, x4 *= {}, x4 *= null, x4 *= void 0, x5 *= b, x5 *= !0, x5 *= "", x5 *= {}, x6 *= b, x6 *= !0, x6 *= "", x6 *= {};
|
||||
}(E || (E = {})), E.a, E.a, E.a, E.a;
|
||||
|
@ -1,4 +1,4 @@
|
||||
//// [destructuringControlFlow.ts]
|
||||
(0, [
|
||||
[
|
||||
"foo"
|
||||
][1]).toUpperCase();
|
||||
][1].toUpperCase();
|
||||
|
@ -1,3 +1,3 @@
|
||||
//// [symbolType12.ts]
|
||||
var s = Symbol.for("assign"), str = "";
|
||||
s *= s, s *= 0, s /= s, s /= 0, s %= s, s %= 0, s += s, s += 0, s += "", str += s, s -= s, s -= 0, s <<= s, s <<= 0, s >>= s, s >>= 0, s >>>= s, s >>>= 0, s &= s, s &= 0, s ^= s, s ^= 0, s |= s, s |= 0, str += s || str;
|
||||
s *= 0, s /= s, s /= 0, s %= s, s %= 0, str += s = s + 0 + "", s -= s, s -= 0, s <<= s, s <<= 0, s >>= s, s >>= 0, s >>>= s, s >>>= 0, s &= s, s &= 0, s ^= s, s ^= 0, s |= s, s |= 0, str += s || str;
|
||||
|
@ -1,7 +1,9 @@
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::{util::take::Take, EqIgnoreSpan, Spanned};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_optimization::simplify::expr_simplifier;
|
||||
use swc_ecma_utils::{class_has_side_effect, find_pat_ids, ExprExt};
|
||||
use swc_ecma_visit::VisitMutWith;
|
||||
|
||||
use super::Optimizer;
|
||||
use crate::{
|
||||
@ -680,6 +682,30 @@ where
|
||||
|
||||
/// Actually inlines variables.
|
||||
pub(super) fn inline(&mut self, e: &mut Expr) {
|
||||
if let Expr::Member(me) = e {
|
||||
if let MemberProp::Computed(ref mut prop) = me.prop {
|
||||
if let Expr::Lit(Lit::Num(..)) = &*prop.expr {
|
||||
if let Expr::Ident(obj) = &*me.obj {
|
||||
let new = self.vars.lits_for_array_access.get(&obj.to_id());
|
||||
|
||||
if let Some(new) = new {
|
||||
report_change!("inline: Inlined array access");
|
||||
self.changed = true;
|
||||
|
||||
me.obj = new.clone();
|
||||
// TODO(kdy1): Optimize performance by skipping visiting of children
|
||||
// nodes.
|
||||
e.visit_mut_with(&mut expr_simplifier(
|
||||
self.marks.unresolved_mark,
|
||||
Default::default(),
|
||||
));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Expr::Ident(i) = e {
|
||||
let id = i.to_id();
|
||||
if let Some(value) = self
|
||||
|
@ -1665,6 +1665,20 @@ where
|
||||
};
|
||||
|
||||
if !self.is_skippable_for_seq(Some(a), &Expr::Ident(b_left.clone())) {
|
||||
// Let's be safe
|
||||
if IdentUsageFinder::find(&b_left.to_id(), &b_assign.right) {
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
// As we are not *skipping* lhs, we can inline here
|
||||
if let Some(a_id) = a.id() {
|
||||
if a_id == b_left.to_id() {
|
||||
if self.replace_seq_assignment(a, b)? {
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
@ -2202,7 +2216,7 @@ where
|
||||
}
|
||||
|
||||
macro_rules! take_a {
|
||||
($force_drop:expr) => {
|
||||
($force_drop:expr, $drop_op:expr) => {
|
||||
match a {
|
||||
Mergable::Var(a) => {
|
||||
if self.options.unused {
|
||||
@ -2224,15 +2238,17 @@ where
|
||||
.unwrap_or_else(|| undefined(DUMMY_SP))
|
||||
}
|
||||
Mergable::Expr(a) => {
|
||||
if can_remove {
|
||||
if can_remove || $force_drop {
|
||||
if let Expr::Assign(e) = a {
|
||||
report_change!(
|
||||
"sequences: Dropping assignment as we are going to drop the \
|
||||
variable declaration. ({})",
|
||||
left_id
|
||||
);
|
||||
if e.op == op!("=") || $drop_op {
|
||||
report_change!(
|
||||
"sequences: Dropping assignment as we are going to drop \
|
||||
the variable declaration. ({})",
|
||||
left_id
|
||||
);
|
||||
|
||||
**a = *e.right.take();
|
||||
**a = *e.right.take();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2256,7 +2272,10 @@ where
|
||||
Expr::Assign(b @ AssignExpr { op: op!("="), .. }) => {
|
||||
if let Some(b_left) = b.left.as_ident() {
|
||||
if b_left.to_id() == left_id.to_id() {
|
||||
let mut a_expr = take_a!(true);
|
||||
report_change!("sequences: Merged assignment into another assignment");
|
||||
self.changed = true;
|
||||
|
||||
let mut a_expr = take_a!(true, false);
|
||||
let a_expr = self.ignore_return_value(&mut a_expr);
|
||||
|
||||
if let Some(a) = a_expr {
|
||||
@ -2271,19 +2290,35 @@ where
|
||||
}
|
||||
Expr::Assign(b) => {
|
||||
if let Some(b_left) = b.left.as_ident() {
|
||||
if b_left.to_id() == left_id.to_id() {
|
||||
if let Some(bin_op) = b.op.to_update() {
|
||||
b.op = op!("=");
|
||||
let a_op = match a {
|
||||
Mergable::Var(_) => Some(op!("=")),
|
||||
Mergable::Expr(Expr::Assign(AssignExpr { op: a_op, .. })) => Some(*a_op),
|
||||
Mergable::FnDecl(_) => Some(op!("=")),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
let to = take_a!(true);
|
||||
if let Some(a_op) = a_op {
|
||||
if can_drop_op_for(a_op, b.op) {
|
||||
if b_left.to_id() == left_id.to_id() {
|
||||
if let Some(bin_op) = b.op.to_update() {
|
||||
report_change!(
|
||||
"sequences: Merged assignment into another (op) assignment"
|
||||
);
|
||||
self.changed = true;
|
||||
|
||||
b.right = Box::new(Expr::Bin(BinExpr {
|
||||
span: DUMMY_SP,
|
||||
op: bin_op,
|
||||
left: to,
|
||||
right: b.right.take(),
|
||||
}));
|
||||
return Ok(true);
|
||||
b.op = op!("=");
|
||||
|
||||
let to = take_a!(true, true);
|
||||
|
||||
b.right = Box::new(Expr::Bin(BinExpr {
|
||||
span: DUMMY_SP,
|
||||
op: bin_op,
|
||||
left: to,
|
||||
right: b.right.take(),
|
||||
}));
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2319,7 +2354,7 @@ where
|
||||
left_id.span.ctxt
|
||||
);
|
||||
|
||||
let to = take_a!(false);
|
||||
let to = take_a!(false, false);
|
||||
|
||||
replace_id_with_expr(b, left_id.to_id(), to);
|
||||
|
||||
@ -2449,3 +2484,16 @@ pub(crate) fn is_trivial_lit(e: &Expr) -> bool {
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// This assumes `a.left.to_id() == b.left.to_id()`
|
||||
fn can_drop_op_for(a: AssignOp, b: AssignOp) -> bool {
|
||||
if a == op!("=") {
|
||||
return true;
|
||||
}
|
||||
|
||||
if a == b {
|
||||
return matches!(a, op!("+=") | op!("*="));
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
@ -5298,7 +5298,7 @@
|
||||
var width = data[i++], height = data[i++];
|
||||
if (x1 = x0 + width, y1 = y0 + height, isStroke) {
|
||||
if (containStroke(x0, y0, x1, y0, lineWidth, x, y) || containStroke(x1, y0, x1, y1, lineWidth, x, y) || containStroke(x1, y1, x0, y1, lineWidth, x, y) || containStroke(x0, y1, x0, y0, lineWidth, x, y)) return !0;
|
||||
} else w += windingLine(x1, y0, x1, y1, x, y), w += windingLine(x0, y1, x0, y0, x, y);
|
||||
} else w = windingLine(x1, y0, x1, y1, x, y) + windingLine(x0, y1, x0, y0, x, y);
|
||||
break;
|
||||
case CMD$1.Z:
|
||||
if (isStroke) {
|
||||
@ -12349,7 +12349,7 @@
|
||||
function decodePolygon(coordinate, encodeOffsets, encodeScale) {
|
||||
for(var result = [], prevX = encodeOffsets[0], prevY = encodeOffsets[1], i = 0; i < coordinate.length; i += 2){
|
||||
var x = coordinate.charCodeAt(i) - 64, y = coordinate.charCodeAt(i + 1) - 64;
|
||||
x = x >> 1 ^ -(1 & x), y = y >> 1 ^ -(1 & y), x += prevX, y += prevY, prevX = x, prevY = y, result.push([
|
||||
y = y >> 1 ^ -(1 & y), x = (x >> 1 ^ -(1 & x)) + prevX, y += prevY, prevX = x, prevY = y, result.push([
|
||||
x / encodeScale,
|
||||
y / encodeScale
|
||||
]);
|
||||
@ -15423,17 +15423,17 @@
|
||||
case 'half-year':
|
||||
case 'quarter':
|
||||
case 'month':
|
||||
approxInterval1 = approxInterval, interval = (approxInterval1 /= 2592000000) > 6 ? 6 : approxInterval1 > 3 ? 3 : approxInterval1 > 2 ? 2 : 1, getterName = monthGetterName(isUTC), setterName = monthSetterName(isUTC);
|
||||
interval = (approxInterval1 = approxInterval / 2592000000) > 6 ? 6 : approxInterval1 > 3 ? 3 : approxInterval1 > 2 ? 2 : 1, getterName = monthGetterName(isUTC), setterName = monthSetterName(isUTC);
|
||||
break;
|
||||
case 'week':
|
||||
case 'half-week':
|
||||
case 'day':
|
||||
approxInterval2 = approxInterval, interval = (approxInterval2 /= 86400000) > 16 ? 16 : approxInterval2 > 7.5 ? 7 : approxInterval2 > 3.5 ? 4 : approxInterval2 > 1.5 ? 2 : 1, getterName = dateGetterName(isUTC), setterName = dateSetterName(isUTC);
|
||||
interval = (approxInterval2 = approxInterval / 86400000) > 16 ? 16 : approxInterval2 > 7.5 ? 7 : approxInterval2 > 3.5 ? 4 : approxInterval2 > 1.5 ? 2 : 1, getterName = dateGetterName(isUTC), setterName = dateSetterName(isUTC);
|
||||
break;
|
||||
case 'half-day':
|
||||
case 'quarter-day':
|
||||
case 'hour':
|
||||
approxInterval3 = approxInterval, interval = (approxInterval3 /= 3600000) > 12 ? 12 : approxInterval3 > 6 ? 6 : approxInterval3 > 3.5 ? 4 : approxInterval3 > 2 ? 2 : 1, getterName = hoursGetterName(isUTC), setterName = hoursSetterName(isUTC);
|
||||
interval = (approxInterval3 = approxInterval / 3600000) > 12 ? 12 : approxInterval3 > 6 ? 6 : approxInterval3 > 3.5 ? 4 : approxInterval3 > 2 ? 2 : 1, getterName = hoursGetterName(isUTC), setterName = hoursSetterName(isUTC);
|
||||
break;
|
||||
case 'minute':
|
||||
interval = getMinutesAndSecondsInterval(approxInterval, !0), getterName = minutesGetterName(isUTC), setterName = minutesSetterName(isUTC);
|
||||
@ -34777,7 +34777,7 @@
|
||||
var blockMetaList = result1.meta, buttonContainer = document.createElement('div');
|
||||
buttonContainer.style.cssText = 'position:absolute;bottom:0;left:0;right:0;';
|
||||
var buttonStyle = "float:right;margin-right:20px;border:none;cursor:pointer;padding:2px 5px;font-size:12px;border-radius:3px", closeButton = document.createElement('div'), refreshButton = document.createElement('div');
|
||||
buttonStyle += ';background-color:' + model.get('buttonColor'), buttonStyle += ';color:' + model.get('buttonTextColor');
|
||||
buttonStyle = ';background-color:' + model.get('buttonColor') + ';color:' + model.get('buttonTextColor');
|
||||
var self1 = this;
|
||||
function close() {
|
||||
container.removeChild(root), self1._dom = null;
|
||||
|
@ -799,7 +799,7 @@
|
||||
getParsingFlags(config).invalidFormat = !0, config._d = new Date(NaN);
|
||||
return;
|
||||
}
|
||||
for(i = 0; i < config._f.length; i++)currentScore = 0, validFormatFound = !1, tempConfig = copyConfig({}, config), null != config._useUTC && (tempConfig._useUTC = config._useUTC), tempConfig._f = config._f[i], configFromStringAndFormat(tempConfig), isValid(tempConfig) && (validFormatFound = !0), currentScore += getParsingFlags(tempConfig).charsLeftOver, currentScore += 10 * getParsingFlags(tempConfig).unusedTokens.length, getParsingFlags(tempConfig).score = currentScore, bestFormatIsValid ? currentScore < scoreToBeat && (scoreToBeat = currentScore, bestMoment = tempConfig) : (null == scoreToBeat || currentScore < scoreToBeat || validFormatFound) && (scoreToBeat = currentScore, bestMoment = tempConfig, validFormatFound && (bestFormatIsValid = !0));
|
||||
for(i = 0; i < config._f.length; i++)currentScore = 0, validFormatFound = !1, tempConfig = copyConfig({}, config), null != config._useUTC && (tempConfig._useUTC = config._useUTC), tempConfig._f = config._f[i], configFromStringAndFormat(tempConfig), isValid(tempConfig) && (validFormatFound = !0), currentScore = getParsingFlags(tempConfig).charsLeftOver + 10 * getParsingFlags(tempConfig).unusedTokens.length, getParsingFlags(tempConfig).score = currentScore, bestFormatIsValid ? currentScore < scoreToBeat && (scoreToBeat = currentScore, bestMoment = tempConfig) : (null == scoreToBeat || currentScore < scoreToBeat || validFormatFound) && (scoreToBeat = currentScore, bestMoment = tempConfig, validFormatFound && (bestFormatIsValid = !0));
|
||||
extend(config, bestMoment || tempConfig);
|
||||
}(config) : format ? configFromStringAndFormat(config) : isUndefined(input = (config1 = config)._i) ? config1._d = new Date(hooks.now()) : isDate(input) ? config1._d = new Date(input.valueOf()) : 'string' == typeof input ? function(config) {
|
||||
var matched = aspNetJsonRegex.exec(config._i);
|
||||
|
@ -1912,8 +1912,8 @@
|
||||
base && base.PROPS && (props = props.concat(base.PROPS));
|
||||
for(var code = "return function AST_" + type + "(props){ if (props) { ", i = props.length; --i >= 0;)code += "this." + props[i] + " = props." + props[i] + ";";
|
||||
const proto = base && Object.create(base.prototype);
|
||||
(proto && proto.initialize || methods && methods.initialize) && (code += "this.initialize();"), code += "}", code += "this.flags = 0;";
|
||||
var ctor = Function(code += "}")();
|
||||
(proto && proto.initialize || methods && methods.initialize) && (code += "this.initialize();");
|
||||
var ctor = Function(code = "}this.flags = 0;}")();
|
||||
if (proto && (ctor.prototype = proto, ctor.BASE = base), base && base.SUBCLASSES.push(ctor), ctor.prototype.CTOR = ctor, ctor.prototype.constructor = ctor, ctor.PROPS = props || null, ctor.SELF_PROPS = self_props, ctor.SUBCLASSES = [], type && (ctor.prototype.TYPE = ctor.TYPE = type), methods) for(i in methods)HOP(methods, i) && ("$" === i[0] ? ctor[i.substr(1)] = methods[i] : ctor.prototype[i] = methods[i]);
|
||||
return ctor.DEFMETHOD = function(name, method) {
|
||||
this.prototype[name] = method;
|
||||
|
@ -6035,7 +6035,7 @@
|
||||
if (number != number) return "NaN";
|
||||
if (number <= -1000000000000000000000 || number >= 1e21) return String(number);
|
||||
if (number < 0 && (sign = "-", number = -number), number > 1e-21) {
|
||||
if (z = (e = log(number * pow(2, 69, 1)) - 69) < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1), z *= 0x10000000000000, (e = 52 - e) > 0) {
|
||||
if (z = ((e = log(number * pow(2, 69, 1)) - 69) < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1)) * 0x10000000000000, (e = 52 - e) > 0) {
|
||||
for(multiply(data, 0, z), j = fractDigits; j >= 7;)multiply(data, 1e7, 0), j -= 7;
|
||||
for(multiply(data, pow(10, j, 1), 0), j = e - 1; j >= 23;)divide(data, 8388608), j -= 23;
|
||||
divide(data, 1 << j), multiply(data, 1, 1), divide(data, 2), result = dataToString(data);
|
||||
@ -16028,7 +16028,7 @@
|
||||
}, _proto.componentWillReceiveProps = function(nextProps) {
|
||||
if (this.props.value !== nextProps.value) {
|
||||
var changedBits, oldValue = this.props.value, newValue = nextProps.value;
|
||||
(oldValue === newValue ? 0 !== oldValue || 1 / oldValue == 1 / newValue : oldValue != oldValue && newValue != newValue) ? changedBits = 0 : (changedBits = "function" == typeof calculateChangedBits ? calculateChangedBits(oldValue, newValue) : 1073741823, 0 != (changedBits |= 0) && this.emitter.set(nextProps.value, changedBits));
|
||||
(oldValue === newValue ? 0 !== oldValue || 1 / oldValue == 1 / newValue : oldValue != oldValue && newValue != newValue) ? changedBits = 0 : 0 != (changedBits = ("function" == typeof calculateChangedBits ? calculateChangedBits(oldValue, newValue) : 1073741823) | 0) && this.emitter.set(nextProps.value, changedBits);
|
||||
}
|
||||
}, _proto.render = function() {
|
||||
return this.props.children;
|
||||
|
@ -1287,7 +1287,7 @@
|
||||
d = !0;
|
||||
}
|
||||
d || (b1 = "", xa(c, function(c, d) {
|
||||
b1 += d, b1 += ":", b1 += c, b1 += "\r\n";
|
||||
b1 = d + ":" + c + "\r\n";
|
||||
}), c = b1, "string" == typeof a ? null != c && encodeURIComponent(String(c)) : R(a, b, c));
|
||||
}
|
||||
function Hd(a, b, c) {
|
||||
|
@ -838,7 +838,7 @@
|
||||
const e = t;
|
||||
if (null === e.A) {
|
||||
let t1 = e.path.canonicalString();
|
||||
null !== e.collectionGroup && (t1 += "|cg:" + e.collectionGroup), t1 += "|f:", t1 += e.filters.map((t)=>t.field.canonicalString() + t.op.toString() + xt(t.value)).join(","), t1 += "|ob:", t1 += e.orderBy.map((t)=>t.field.canonicalString() + t.dir).join(","), At(e.limit) || (t1 += "|l:", t1 += e.limit), e.startAt && (t1 += "|lb:", t1 += ce(e.startAt)), e.endAt && (t1 += "|ub:", t1 += ce(e.endAt)), e.A = t1;
|
||||
null !== e.collectionGroup && (t1 += "|cg:" + e.collectionGroup), t1 = "|f:" + e.filters.map((t)=>t.field.canonicalString() + t.op.toString() + xt(t.value)).join(",") + "|ob:" + e.orderBy.map((t)=>t.field.canonicalString() + t.dir).join(","), At(e.limit) || (t1 = "|l:" + e.limit), e.startAt && (t1 = "|lb:" + ce(e.startAt)), e.endAt && (t1 = "|ub:" + ce(e.endAt)), e.A = t1;
|
||||
}
|
||||
return e.A;
|
||||
}
|
||||
|
@ -799,7 +799,7 @@
|
||||
getParsingFlags(config).invalidFormat = !0, config._d = new Date(NaN);
|
||||
return;
|
||||
}
|
||||
for(i = 0; i < config._f.length; i++)currentScore = 0, validFormatFound = !1, tempConfig = copyConfig({}, config), null != config._useUTC && (tempConfig._useUTC = config._useUTC), tempConfig._f = config._f[i], configFromStringAndFormat(tempConfig), isValid(tempConfig) && (validFormatFound = !0), currentScore += getParsingFlags(tempConfig).charsLeftOver, currentScore += 10 * getParsingFlags(tempConfig).unusedTokens.length, getParsingFlags(tempConfig).score = currentScore, bestFormatIsValid ? currentScore < scoreToBeat && (scoreToBeat = currentScore, bestMoment = tempConfig) : (null == scoreToBeat || currentScore < scoreToBeat || validFormatFound) && (scoreToBeat = currentScore, bestMoment = tempConfig, validFormatFound && (bestFormatIsValid = !0));
|
||||
for(i = 0; i < config._f.length; i++)currentScore = 0, validFormatFound = !1, tempConfig = copyConfig({}, config), null != config._useUTC && (tempConfig._useUTC = config._useUTC), tempConfig._f = config._f[i], configFromStringAndFormat(tempConfig), isValid(tempConfig) && (validFormatFound = !0), currentScore = getParsingFlags(tempConfig).charsLeftOver + 10 * getParsingFlags(tempConfig).unusedTokens.length, getParsingFlags(tempConfig).score = currentScore, bestFormatIsValid ? currentScore < scoreToBeat && (scoreToBeat = currentScore, bestMoment = tempConfig) : (null == scoreToBeat || currentScore < scoreToBeat || validFormatFound) && (scoreToBeat = currentScore, bestMoment = tempConfig, validFormatFound && (bestFormatIsValid = !0));
|
||||
extend(config, bestMoment || tempConfig);
|
||||
}(config) : format ? configFromStringAndFormat(config) : isUndefined(input = (config1 = config)._i) ? config1._d = new Date(hooks.now()) : isDate(input) ? config1._d = new Date(input.valueOf()) : "string" == typeof input ? function(config) {
|
||||
var matched = aspNetJsonRegex.exec(config._i);
|
||||
|
@ -35,8 +35,7 @@
|
||||
var i = t - s.startTime;
|
||||
s.remaining = s.duration - i, s.useEasing ? s.countDown ? s.frameVal = s.startVal - s.easingFn(i, 0, s.startVal - s.endVal, s.duration) : s.frameVal = s.easingFn(i, s.startVal, s.endVal - s.startVal, s.duration) : s.countDown ? s.frameVal = s.startVal - (s.startVal - s.endVal) * (i / s.duration) : s.frameVal = s.startVal + (s.endVal - s.startVal) * (i / s.duration), s.countDown ? s.frameVal = s.frameVal < s.endVal ? s.endVal : s.frameVal : s.frameVal = s.frameVal > s.endVal ? s.endVal : s.frameVal, s.frameVal = Number(s.frameVal.toFixed(s.options.decimalPlaces)), s.printValue(s.frameVal), i < s.duration ? s.rAF = requestAnimationFrame(s.count) : null !== s.finalEndVal ? s.update(s.finalEndVal) : s.callback && s.callback();
|
||||
}, this.formatNumber = function(t) {
|
||||
i = Math.abs(t).toFixed(s.options.decimalPlaces);
|
||||
var i, a, n, e, o = (i += "").split(".");
|
||||
var a, n, e, o = (Math.abs(t).toFixed(s.options.decimalPlaces) + "").split(".");
|
||||
if (a = o[0], n = o.length > 1 ? s.options.decimal + o[1] : "", s.options.useGrouping) {
|
||||
e = "";
|
||||
for(var l = 0, h = a.length; l < h; ++l)0 !== l && l % 3 == 0 && (e = s.options.separator + e), e = a[h - l - 1] + e;
|
||||
|
@ -1,6 +1,5 @@
|
||||
export function formatNumber(t) {
|
||||
i = Math.abs(t).toFixed(s.options.decimalPlaces);
|
||||
var i, a, n, e, o = (i += "").split(".");
|
||||
var a, n, e, o = (Math.abs(t).toFixed(s.options.decimalPlaces) + "").split(".");
|
||||
if (a = o[0], n = o.length > 1 ? s.options.decimal + o[1] : "", s.options.useGrouping) {
|
||||
e = "";
|
||||
for(var l = 0, h = a.length; l < h; ++l)0 !== l && l % 3 == 0 && (e = s.options.separator + e), e = a[h - l - 1] + e;
|
||||
|
@ -8766,7 +8766,7 @@
|
||||
},
|
||||
calculateTrackBaseMediaDecodeTime: function(track, keepOriginalTimestamps) {
|
||||
var baseMediaDecodeTime, minSegmentDts = track.minSegmentDts;
|
||||
return keepOriginalTimestamps || (minSegmentDts -= track.timelineStartInfo.dts), baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime, baseMediaDecodeTime += minSegmentDts, baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime), "audio" === track.type && (baseMediaDecodeTime *= track.samplerate / ONE_SECOND_IN_TS$3, baseMediaDecodeTime = Math.floor(baseMediaDecodeTime)), baseMediaDecodeTime;
|
||||
return keepOriginalTimestamps || (minSegmentDts -= track.timelineStartInfo.dts), baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime + minSegmentDts), "audio" === track.type && (baseMediaDecodeTime *= track.samplerate / ONE_SECOND_IN_TS$3, baseMediaDecodeTime = Math.floor(baseMediaDecodeTime)), baseMediaDecodeTime;
|
||||
},
|
||||
collectDtsInfo: function(track, data) {
|
||||
"number" == typeof data.pts && (void 0 === track.timelineStartInfo.pts && (track.timelineStartInfo.pts = data.pts), void 0 === track.minSegmentPts ? track.minSegmentPts = data.pts : track.minSegmentPts = Math.min(track.minSegmentPts, data.pts), void 0 === track.maxSegmentPts ? track.maxSegmentPts = data.pts : track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts)), "number" == typeof data.dts && (void 0 === track.timelineStartInfo.dts && (track.timelineStartInfo.dts = data.dts), void 0 === track.minSegmentDts ? track.minSegmentDts = data.dts : track.minSegmentDts = Math.min(track.minSegmentDts, data.dts), void 0 === track.maxSegmentDts ? track.maxSegmentDts = data.dts : track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts));
|
||||
@ -9204,7 +9204,7 @@
|
||||
]), (0x10 & data) == 0x10 && (this.column_ = ((0xe & data) >> 1) * 4), this.isColorPAC(char1) && (0xe & char1) == 0xe && this.addFormatting(packet.pts, [
|
||||
"i"
|
||||
]);
|
||||
} else this.isNormalChar(char0) && (0x00 === char1 && (char1 = null), text = getCharFromCode(char0), text += getCharFromCode(char1), this[this.mode_](packet.pts, text), this.column_ += text.length);
|
||||
} else this.isNormalChar(char0) && (0x00 === char1 && (char1 = null), text = getCharFromCode(char0) + getCharFromCode(char1), this[this.mode_](packet.pts, text), this.column_ += text.length);
|
||||
}
|
||||
};
|
||||
};
|
||||
@ -9357,14 +9357,14 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (buffer.push(chunk), bufferSize += chunk.data.byteLength, 1 === buffer.length && (tagSize = parseSyncSafeInteger$1(chunk.data.subarray(6, 10)), tagSize += 10), !(bufferSize < tagSize)) {
|
||||
if (buffer.push(chunk), bufferSize += chunk.data.byteLength, 1 === buffer.length && (tagSize = parseSyncSafeInteger$1(chunk.data.subarray(6, 10)) + 10), !(bufferSize < tagSize)) {
|
||||
for(i = 0, tag = {
|
||||
data: new Uint8Array(tagSize),
|
||||
frames: [],
|
||||
pts: buffer[0].pts,
|
||||
dts: buffer[0].dts
|
||||
}; i < tagSize;)tag.data.set(buffer[0].data.subarray(0, tagSize - i), i), i += buffer[0].data.byteLength, bufferSize -= buffer[0].data.byteLength, buffer.shift();
|
||||
frameStart = 10, 0x40 & tag.data[5] && (frameStart += 4, frameStart += parseSyncSafeInteger$1(tag.data.subarray(10, 14)), tagSize -= parseSyncSafeInteger$1(tag.data.subarray(16, 20)));
|
||||
frameStart = 10, 0x40 & tag.data[5] && (frameStart = 4 + parseSyncSafeInteger$1(tag.data.subarray(10, 14)), tagSize -= parseSyncSafeInteger$1(tag.data.subarray(16, 20)));
|
||||
do {
|
||||
if ((frameSize = parseSyncSafeInteger$1(tag.data.subarray(frameStart + 4, frameStart + 8))) < 1) {
|
||||
this.trigger("log", {
|
||||
@ -9380,7 +9380,7 @@
|
||||
var d = frame.data, size = (0x01 & d[3]) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2;
|
||||
size *= 4, size += 0x03 & d[7], frame.timeStamp = size, void 0 === tag.pts && void 0 === tag.dts && (tag.pts = frame.timeStamp, tag.dts = frame.timeStamp), this.trigger("timestamp", frame);
|
||||
}
|
||||
tag.frames.push(frame), frameStart += 10, frameStart += frameSize;
|
||||
tag.frames.push(frame), frameStart = 10 + frameSize;
|
||||
}while (frameStart < tagSize)
|
||||
this.trigger("data", tag);
|
||||
}
|
||||
@ -9920,7 +9920,7 @@
|
||||
},
|
||||
parseAacTimestamp: function(packet) {
|
||||
var frameStart, frameSize, frame;
|
||||
frameStart = 10, 0x40 & packet[5] && (frameStart += 4, frameStart += parseSyncSafeInteger(packet.subarray(10, 14)));
|
||||
frameStart = 10, 0x40 & packet[5] && (frameStart = 4 + parseSyncSafeInteger(packet.subarray(10, 14)));
|
||||
do {
|
||||
if ((frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8))) < 1) break;
|
||||
if ("PRIV" === String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3])) {
|
||||
@ -9933,7 +9933,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
frameStart += 10, frameStart += frameSize;
|
||||
frameStart = 10 + frameSize;
|
||||
}while (frameStart < packet.byteLength)
|
||||
return null;
|
||||
}
|
||||
@ -10244,8 +10244,7 @@
|
||||
return ("00" + value.toString(16)).slice(-2);
|
||||
}
|
||||
}, parseType_1 = function(buffer) {
|
||||
var result = "";
|
||||
return result += String.fromCharCode(buffer[0]), result += String.fromCharCode(buffer[1]), result += String.fromCharCode(buffer[2]), result += String.fromCharCode(buffer[3]);
|
||||
return String.fromCharCode(buffer[0]) + String.fromCharCode(buffer[1]) + String.fromCharCode(buffer[2]) + String.fromCharCode(buffer[3]);
|
||||
}, toUnsigned$2 = bin.toUnsigned, findBox_1 = function findBox(data, path) {
|
||||
var i, size, type, end, subresults, results = [];
|
||||
if (!path.length) return null;
|
||||
|
@ -4557,7 +4557,7 @@
|
||||
], size = "width";
|
||||
}
|
||||
var size, step = boxPosition.lineHeight, position = step * Math.round(linePos), maxPosition = containerBox[size] + step, initialAxis = axis[0];
|
||||
Math.abs(position) > maxPosition && (position = position < 0 ? -1 : 1, position *= Math.ceil(maxPosition / step) * step), linePos < 0 && (position += "" === cue.vertical ? containerBox.height : containerBox.width, axis = axis.reverse()), boxPosition.move(initialAxis, position);
|
||||
Math.abs(position) > maxPosition && (position = (position < 0 ? -1 : 1) * (Math.ceil(maxPosition / step) * step)), linePos < 0 && (position += "" === cue.vertical ? containerBox.height : containerBox.width, axis = axis.reverse()), boxPosition.move(initialAxis, position);
|
||||
} else {
|
||||
var calculatedPercentage = boxPosition.lineHeight / containerBox.height * 100;
|
||||
switch(cue.lineAlign){
|
||||
|
@ -826,7 +826,7 @@
|
||||
selectionStart = range.start.row < row - 1 ? 0 : selectionStart, selectionEnd += prevLine.length + 1, line = prevLine + "\n" + line;
|
||||
} else if (range.end.row != row) {
|
||||
var nextLine = host.session.getLine(row + 1);
|
||||
selectionEnd = range.end.row > row + 1 ? nextLine.length : selectionEnd, selectionEnd += line.length + 1, line = line + "\n" + nextLine;
|
||||
selectionEnd = (range.end.row > row + 1 ? nextLine.length : selectionEnd) + (line.length + 1), line = line + "\n" + nextLine;
|
||||
} else isMobile && row > 0 && (line = "\n" + line, selectionEnd += 1, selectionStart += 1);
|
||||
line.length > 400 && (selectionStart < 400 && selectionEnd < 400 ? line = line.slice(0, 400) : (line = "\n", selectionStart == selectionEnd ? selectionStart = selectionEnd = 0 : (selectionStart = 0, selectionEnd = 1)));
|
||||
}
|
||||
@ -9025,7 +9025,7 @@
|
||||
function stringifyDelta(d) {
|
||||
if (Array.isArray(d = d || this)) return d.map(stringifyDelta).join("\n");
|
||||
var type = "";
|
||||
return d.action ? (type = "insert" == d.action ? "+" : "-", type += "[" + d.lines + "]") : d.value && (type = Array.isArray(d.value) ? d.value.map(stringifyRange).join("\n") : stringifyRange(d.value)), d.start && (type += stringifyRange(d)), (d.id || d.rev) && (type += "\t(" + (d.id || d.rev) + ")"), type;
|
||||
return d.action ? type = ("insert" == d.action ? "+" : "-") + "[" + d.lines + "]" : d.value && (type = Array.isArray(d.value) ? d.value.map(stringifyRange).join("\n") : stringifyRange(d.value)), d.start && (type += stringifyRange(d)), (d.id || d.rev) && (type += "\t(" + (d.id || d.rev) + ")"), type;
|
||||
}
|
||||
function stringifyRange(r) {
|
||||
return r.start.row + ":" + r.start.column + "=>" + r.end.row + ":" + r.end.column;
|
||||
|
@ -9241,12 +9241,12 @@
|
||||
var n = r(7507);
|
||||
e.exports = function(e, t, r) {
|
||||
var i, o, a, u;
|
||||
return e = function(e) {
|
||||
return "#" + n(e = function(e) {
|
||||
var t, r;
|
||||
for(e = (r = e = (t = e) > 1e7 ? 1e7 : t) < -10000000 ? -10000000 : r; e < 0;)e += 360;
|
||||
for(; e > 359;)e -= 360;
|
||||
return e;
|
||||
}(e), t = (o = (i = t) > 100 ? 100 : i) < 0 ? 0 : o, r = (u = (a = r) > 100 ? 100 : a) < 0 ? 0 : u, "#" + n(e, t /= 100, r /= 100).map(function(e) {
|
||||
}(e), t = ((o = (i = t) > 100 ? 100 : i) < 0 ? 0 : o) / 100, r = ((u = (a = r) > 100 ? 100 : a) < 0 ? 0 : u) / 100).map(function(e) {
|
||||
return (256 + e).toString(16).substr(-2);
|
||||
}).join("");
|
||||
};
|
||||
@ -15868,7 +15868,7 @@
|
||||
i += "".concat(t[0], " and ").concat(t[1], " arguments");
|
||||
break;
|
||||
default:
|
||||
i += t.slice(0, o - 1).join(", "), i += ", and ".concat(t[o - 1], " arguments");
|
||||
i = t.slice(0, o - 1).join(", ") + ", and ".concat(t[o - 1], " arguments");
|
||||
}
|
||||
return "".concat(i, " must be specified");
|
||||
}, TypeError), e.exports.codes = l;
|
||||
|
@ -2637,7 +2637,7 @@
|
||||
else if ('timeZone' !== prop || util_isUndefined(matchString)) matchString = 'month' !== prop || parseOptions.isIslamic || 'en' !== parseOptions.culture && 'en-GB' !== parseOptions.culture && 'en-US' !== parseOptions.culture ? matchString : matchString[0].toUpperCase() + matchString.substring(1).toLowerCase(), retOptions[prop] = parseOptions[prop][matchString];
|
||||
else {
|
||||
var pos = curObject.pos, val = void 0, tmatch = matches[pos + 1], flag = !util_isUndefined(tmatch);
|
||||
curObject.hourOnly ? val = 60 * this.getZoneValue(flag, tmatch, matches[pos + 4], num) : (val = 60 * this.getZoneValue(flag, tmatch, matches[pos + 7], num), val += this.getZoneValue(flag, matches[pos + 4], matches[pos + 10], num)), util_isNullOrUndefined(val) || (retOptions[prop] = val);
|
||||
util_isNullOrUndefined(val = curObject.hourOnly ? 60 * this.getZoneValue(flag, tmatch, matches[pos + 4], num) : 60 * this.getZoneValue(flag, tmatch, matches[pos + 7], num) + this.getZoneValue(flag, matches[pos + 4], matches[pos + 10], num)) || (retOptions[prop] = val);
|
||||
}
|
||||
}
|
||||
return parseOptions.hour12 && (retOptions.hour12 = !0), retOptions;
|
||||
@ -16092,7 +16092,7 @@
|
||||
svg.style.width = svg.style.height = radius + 'px';
|
||||
for(var startArc = 90, item = 0; item <= 7; item++){
|
||||
var start = defineArcPoints(0, 0, 24, startArc), circleEle = svg.querySelector('.' + CLS_SPINCIRCLE + '_' + item);
|
||||
circleEle.setAttribute('cx', start.x + ''), circleEle.setAttribute('cy', start.y + ''), startArc = startArc >= 360 ? 0 : startArc, startArc += 45;
|
||||
circleEle.setAttribute('cx', start.x + ''), circleEle.setAttribute('cy', start.y + ''), startArc = (startArc >= 360 ? 0 : startArc) + 45;
|
||||
}
|
||||
}(innerContainer, radius);
|
||||
break;
|
||||
@ -19185,7 +19185,7 @@
|
||||
}, Toolbar.prototype.itemWidthCal = function(items) {
|
||||
var style, _this = this, width = 0;
|
||||
return [].slice.call((0, ej2_base.td)('.' + CLS_ITEM, items)).forEach(function(el) {
|
||||
(0, ej2_base.pn)(el) && (style = window.getComputedStyle(el), width += _this.isVertical ? el.offsetHeight : el.offsetWidth, width += parseFloat(_this.isVertical ? style.marginTop : style.marginRight), width += parseFloat(_this.isVertical ? style.marginBottom : style.marginLeft));
|
||||
(0, ej2_base.pn)(el) && (style = window.getComputedStyle(el), width = (_this.isVertical ? el.offsetHeight : el.offsetWidth) + parseFloat(_this.isVertical ? style.marginTop : style.marginRight) + parseFloat(_this.isVertical ? style.marginBottom : style.marginLeft));
|
||||
}), width;
|
||||
}, Toolbar.prototype.getScrollCntEle = function(innerItem) {
|
||||
var trgClass = this.isVertical ? '.e-vscroll-content' : '.e-hscroll-content';
|
||||
@ -19368,7 +19368,7 @@
|
||||
}), rVal;
|
||||
}, i = len - 1; i >= 0; i--){
|
||||
var mrgn = void 0, compuStyle = window.getComputedStyle(inEle[i]);
|
||||
this.isVertical ? (mrgn = parseFloat(compuStyle.marginTop), mrgn += parseFloat(compuStyle.marginBottom)) : (mrgn = parseFloat(compuStyle.marginRight), mrgn += parseFloat(compuStyle.marginLeft));
|
||||
mrgn = this.isVertical ? parseFloat(compuStyle.marginTop) + parseFloat(compuStyle.marginBottom) : parseFloat(compuStyle.marginRight) + parseFloat(compuStyle.marginLeft);
|
||||
var fstEleCheck = inEle[i] === this.tbarEle[0];
|
||||
fstEleCheck && (this.tbarEleMrgn = mrgn), eleOffset = this.isVertical ? inEle[i].offsetHeight : inEle[i].offsetWidth;
|
||||
var eleWid_1 = fstEleCheck ? eleOffset + mrgn : eleOffset;
|
||||
@ -23519,7 +23519,7 @@
|
||||
});
|
||||
}, ToolbarRenderer.prototype.renderColorPickerDropDown = function(args, item, colorPicker, defaultColor) {
|
||||
var range, _this = this, proxy = this, css = classes.i7 + ' ' + classes.Fs + (this.parent.inlineMode ? ' ' + classes.ZV : '');
|
||||
css += ' ' + ('backgroundcolor' === item ? classes.Z8 : classes.UQ), css += ' ' + this.parent.cssClass;
|
||||
css = ' ' + ('backgroundcolor' === item ? classes.Z8 : classes.UQ) + ' ' + this.parent.cssClass;
|
||||
var content = proxy.parent.createElement('span', {
|
||||
className: classes.uN
|
||||
}), inlineEle = proxy.parent.createElement('span', {
|
||||
|
@ -636,7 +636,7 @@
|
||||
isNegNum && (num = -num), assert('number' == typeof num), assert(num < 0x4000000);
|
||||
for(var carry = 0, i = 0; i < this.length; i++){
|
||||
var w = (0 | this.words[i]) * num, lo = (0x3ffffff & w) + (0x3ffffff & carry);
|
||||
carry >>= 26, carry += w / 0x4000000 | 0, carry += lo >>> 26, this.words[i] = 0x3ffffff & lo;
|
||||
carry >>= 26, carry = (w / 0x4000000 | 0) + (lo >>> 26), this.words[i] = 0x3ffffff & lo;
|
||||
}
|
||||
return 0 !== carry && (this.words[i] = carry, this.length++), isNegNum ? this.ineg() : this;
|
||||
}, BN.prototype.muln = function(num) {
|
||||
@ -7909,7 +7909,7 @@
|
||||
assert('number' == typeof num), assert(num < 0x4000000);
|
||||
for(var carry = 0, i = 0; i < this.length; i++){
|
||||
var w = (0 | this.words[i]) * num, lo = (0x3ffffff & w) + (0x3ffffff & carry);
|
||||
carry >>= 26, carry += w / 0x4000000 | 0, carry += lo >>> 26, this.words[i] = 0x3ffffff & lo;
|
||||
carry >>= 26, carry = (w / 0x4000000 | 0) + (lo >>> 26), this.words[i] = 0x3ffffff & lo;
|
||||
}
|
||||
return 0 !== carry && (this.words[i] = carry, this.length++), this;
|
||||
}, BN.prototype.muln = function(num) {
|
||||
@ -13606,14 +13606,14 @@
|
||||
}
|
||||
function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
|
||||
var carry, lo = al;
|
||||
return carry = 0 + ((lo = lo + bl >>> 0) < al ? 1 : 0), carry += (lo = lo + cl >>> 0) < cl ? 1 : 0, ah + bh + ch + dh + (carry += (lo = lo + dl >>> 0) < dl ? 1 : 0) >>> 0;
|
||||
return ah + bh + ch + dh + (carry = 0 + ((lo = lo + bl >>> 0) < al ? 1 : 0) + ((lo = lo + cl >>> 0) < cl ? 1 : 0) + ((lo = lo + dl >>> 0) < dl ? 1 : 0)) >>> 0;
|
||||
}
|
||||
function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
|
||||
return al + bl + cl + dl >>> 0;
|
||||
}
|
||||
function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
|
||||
var carry, lo = al;
|
||||
return carry = 0 + ((lo = lo + bl >>> 0) < al ? 1 : 0), carry += (lo = lo + cl >>> 0) < cl ? 1 : 0, carry += (lo = lo + dl >>> 0) < dl ? 1 : 0, ah + bh + ch + dh + eh + (carry += (lo = lo + el >>> 0) < el ? 1 : 0) >>> 0;
|
||||
return ah + bh + ch + dh + eh + (carry = 0 + ((lo = lo + bl >>> 0) < al ? 1 : 0) + ((lo = lo + cl >>> 0) < cl ? 1 : 0) + ((lo = lo + dl >>> 0) < dl ? 1 : 0) + ((lo = lo + el >>> 0) < el ? 1 : 0)) >>> 0;
|
||||
}
|
||||
function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
|
||||
return al + bl + cl + dl + el >>> 0;
|
||||
@ -18960,7 +18960,7 @@
|
||||
let i = 0;
|
||||
for(; i < maximumValuesToStringify - 1; i++){
|
||||
const tmp = stringifyFnReplacer(i, value, stack, replacer, spacer, indentation);
|
||||
res += void 0 !== tmp ? tmp : 'null', res += join;
|
||||
res = (void 0 !== tmp ? tmp : 'null') + join;
|
||||
}
|
||||
const tmp1 = stringifyFnReplacer(i, value, stack, replacer, spacer, indentation);
|
||||
if (res += void 0 !== tmp1 ? tmp1 : 'null', value.length - 1 > maximumBreadth) {
|
||||
@ -19013,7 +19013,7 @@
|
||||
let i = 0;
|
||||
for(; i < maximumValuesToStringify - 1; i++){
|
||||
const tmp = stringifyArrayReplacer(i, value[i], stack, replacer, spacer, indentation);
|
||||
res += void 0 !== tmp ? tmp : 'null', res += join;
|
||||
res = (void 0 !== tmp ? tmp : 'null') + join;
|
||||
}
|
||||
const tmp1 = stringifyArrayReplacer(i, value[i], stack, replacer, spacer, indentation);
|
||||
if (res += void 0 !== tmp1 ? tmp1 : 'null', value.length - 1 > maximumBreadth) {
|
||||
@ -19063,7 +19063,7 @@
|
||||
let i = 0;
|
||||
for(; i < maximumValuesToStringify - 1; i++){
|
||||
const tmp = stringifyIndent(i, value[i], stack, spacer, indentation);
|
||||
res += void 0 !== tmp ? tmp : 'null', res += join;
|
||||
res = (void 0 !== tmp ? tmp : 'null') + join;
|
||||
}
|
||||
const tmp1 = stringifyIndent(i, value[i], stack, spacer, indentation);
|
||||
if (res += void 0 !== tmp1 ? tmp1 : 'null', value.length - 1 > maximumBreadth) {
|
||||
@ -19119,7 +19119,7 @@
|
||||
let i = 0;
|
||||
for(; i < maximumValuesToStringify - 1; i++){
|
||||
const tmp = stringifySimple(i, value[i], stack);
|
||||
res += void 0 !== tmp ? tmp : 'null', res += ',';
|
||||
res = (void 0 !== tmp ? tmp : 'null') + ',';
|
||||
}
|
||||
const tmp1 = stringifySimple(i, value[i], stack);
|
||||
if (res += void 0 !== tmp1 ? tmp1 : 'null', value.length - 1 > maximumBreadth) {
|
||||
|
@ -0,0 +1,4 @@
|
||||
var ref = [
|
||||
"foo"
|
||||
], key = ref[0], value = ref[1];
|
||||
value.toUpperCase();
|
@ -0,0 +1,3 @@
|
||||
[
|
||||
"foo"
|
||||
][1].toUpperCase();
|
@ -0,0 +1,8 @@
|
||||
var ref = [
|
||||
, {
|
||||
toUpperCase() {
|
||||
console.log(this)
|
||||
}
|
||||
}
|
||||
], key = ref[0], value = ref[1];
|
||||
value.toUpperCase();
|
@ -0,0 +1,9 @@
|
||||
var ref = [
|
||||
,
|
||||
{
|
||||
toUpperCase () {
|
||||
console.log(this);
|
||||
}
|
||||
}
|
||||
];
|
||||
(ref[0], ref[1]).toUpperCase();
|
5
crates/swc_ecma_minifier/tests/fixture/pr/config.json
Normal file
5
crates/swc_ecma_minifier/tests/fixture/pr/config.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"defaults": true,
|
||||
"toplevel": true,
|
||||
"passes": 0
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -6,4 +6,6 @@ var condString, exprAny1, exprBoolean1, exprNumber1, exprString1, exprIsObject1,
|
||||
"2",
|
||||
"3"
|
||||
];
|
||||
condString.toUpperCase, foo(), foo(), condString.toUpperCase, foo(), condString.toUpperCase;
|
||||
condString.toUpperCase, foo();
|
||||
foo(), condString.toUpperCase, foo();
|
||||
condString.toUpperCase;
|
||||
|
@ -1,9 +1,13 @@
|
||||
console.log((function () {
|
||||
var a = [
|
||||
94,
|
||||
173,
|
||||
190,
|
||||
239
|
||||
], b = 0;
|
||||
return b |= 94, b <<= 8, b |= 173, b <<= 8, b |= 190, b <<= 8, b |= 239;
|
||||
})().toString(16));
|
||||
function f() {
|
||||
var a = [94, 173, 190, 239];
|
||||
var b = 0;
|
||||
b |= a[0];
|
||||
b <<= 8;
|
||||
b |= a[1];
|
||||
b <<= 8;
|
||||
b |= a[2];
|
||||
b <<= 8;
|
||||
b |= a[3];
|
||||
return b;
|
||||
}
|
||||
console.log(f().toString(16));
|
@ -1,4 +1,9 @@
|
||||
console.log((function() {
|
||||
var b;
|
||||
return b = 94, b <<= 8, b |= 173, b <<= 8, b |= 190, b <<= 8, b |= 239;
|
||||
var b, a = [
|
||||
94,
|
||||
173,
|
||||
190,
|
||||
239
|
||||
];
|
||||
return b = 1588444911;
|
||||
})().toString(16));
|
||||
|
@ -1,9 +1,13 @@
|
||||
console.log((function () {
|
||||
var a = [
|
||||
94,
|
||||
173,
|
||||
190,
|
||||
239
|
||||
], b = 0;
|
||||
return b |= 94, b <<= 8, b |= 173, b <<= 8, b |= 190, b <<= 8, b |= 239;
|
||||
})().toString(16));
|
||||
function f() {
|
||||
var a = [94, 173, 190, 239];
|
||||
var b = 0;
|
||||
b |= a[0];
|
||||
b <<= 8;
|
||||
b |= a[1];
|
||||
b <<= 8;
|
||||
b |= a[2];
|
||||
b <<= 8;
|
||||
b |= a[3];
|
||||
return b;
|
||||
}
|
||||
console.log(f().toString(16));
|
@ -1,4 +1 @@
|
||||
console.log((function() {
|
||||
var b;
|
||||
return b = 94, b <<= 8, b |= 173, b <<= 8, b |= 190, b <<= 8, b |= 239;
|
||||
})().toString(16));
|
||||
console.log(1588444911..toString(16));
|
||||
|
@ -2781,7 +2781,7 @@
|
||||
dirty = !1;
|
||||
break traverseScopesLoop;
|
||||
}
|
||||
} else dirty = !0, lastDirtyWatch = watch, watch.last = watch.eq ? copy(value) : value, watch.fn(value, last === initWatchVal ? value : last, current), ttl < 5 && (watchLog[logIdx = 4 - ttl] || (watchLog[logIdx] = []), logMsg = isFunction(watch.exp) ? "fn: " + (watch.exp.name || watch.exp.toString()) : watch.exp, logMsg += "; newVal: " + toJson(value) + "; oldVal: " + toJson(last), watchLog[logIdx].push(logMsg));
|
||||
} else dirty = !0, lastDirtyWatch = watch, watch.last = watch.eq ? copy(value) : value, watch.fn(value, last === initWatchVal ? value : last, current), ttl < 5 && (watchLog[logIdx = 4 - ttl] || (watchLog[logIdx] = []), logMsg = (isFunction(watch.exp) ? "fn: " + (watch.exp.name || watch.exp.toString()) : watch.exp) + ("; newVal: " + toJson(value) + "; oldVal: ") + toJson(last), watchLog[logIdx].push(logMsg));
|
||||
}
|
||||
} catch (e1) {
|
||||
clearPhase(), $exceptionHandler(e1);
|
||||
|
@ -2121,7 +2121,7 @@
|
||||
},
|
||||
_create: function() {
|
||||
var listviewClasses = "";
|
||||
listviewClasses += this.options.inset ? " ui-listview-inset" : "", this.options.inset && (listviewClasses += this.options.corners ? " ui-corner-all" : "", listviewClasses += this.options.shadow ? " ui-shadow" : ""), this.element.addClass(" ui-listview" + listviewClasses), this.refresh(!0);
|
||||
listviewClasses += this.options.inset ? " ui-listview-inset" : "", this.options.inset && (listviewClasses = (this.options.corners ? " ui-corner-all" : "") + (this.options.shadow ? " ui-shadow" : "")), this.element.addClass(" ui-listview" + listviewClasses), this.refresh(!0);
|
||||
},
|
||||
_findFirstElementByTagName: function(ele, nextProp, lcName, ucName) {
|
||||
var dict = {};
|
||||
@ -4581,7 +4581,7 @@
|
||||
},
|
||||
_setupHeightStyle: function(heightStyle) {
|
||||
var maxHeight, parent = this.element.parent();
|
||||
"fill" === heightStyle ? (maxHeight = parent.height(), maxHeight -= this.element.outerHeight() - this.element.height(), this.element.siblings(":visible").each(function() {
|
||||
"fill" === heightStyle ? (maxHeight = parent.height() - (this.element.outerHeight() - this.element.height()), this.element.siblings(":visible").each(function() {
|
||||
var elem = $(this), position = elem.css("position");
|
||||
"absolute" !== position && "fixed" !== position && (maxHeight -= elem.outerHeight(!0));
|
||||
}), this.element.children().not(this.panels).each(function() {
|
||||
|
@ -6848,7 +6848,7 @@
|
||||
var styleValue = styles[styleName];
|
||||
if (null != styleValue) {
|
||||
var isCustomProperty = 0 === styleName.indexOf("--");
|
||||
serialized += delimiter + (isCustomProperty ? styleName : styleName.replace(uppercasePattern, "-$1").toLowerCase().replace(msPattern, "-ms-")) + ":", serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty), delimiter = ";";
|
||||
serialized = delimiter + (isCustomProperty ? styleName : styleName.replace(uppercasePattern, "-$1").toLowerCase().replace(msPattern, "-ms-")) + ":" + dangerousStyleValue(styleName, styleValue, isCustomProperty), delimiter = ";";
|
||||
}
|
||||
}
|
||||
return serialized || null;
|
||||
|
@ -1 +1 @@
|
||||
console.log("foo");
|
||||
console.log((0, "foo"));
|
||||
|
@ -1 +1,7 @@
|
||||
console.log(-1, -10);
|
||||
console.log((0, {
|
||||
a: -1,
|
||||
b: 5
|
||||
}).a, (0, {
|
||||
a: -10,
|
||||
b: 5
|
||||
}).a);
|
||||
|
@ -1 +1,7 @@
|
||||
console.log(-1, -10);
|
||||
console.log((0, {
|
||||
a: -1,
|
||||
b: 5
|
||||
}).a, (0, {
|
||||
a: -10,
|
||||
b: 5
|
||||
}).a);
|
||||
|
@ -1 +1,7 @@
|
||||
console.log(-1, -10);
|
||||
console.log((0, {
|
||||
a: -1,
|
||||
b: 5
|
||||
}).a, (0, {
|
||||
a: -10,
|
||||
b: 5
|
||||
}).a);
|
||||
|
@ -258,7 +258,10 @@ impl SimplifyExpr {
|
||||
}
|
||||
|
||||
if exprs.is_empty() {
|
||||
*expr = *val;
|
||||
*expr = Expr::Seq(SeqExpr {
|
||||
span: val.span(),
|
||||
exprs: vec![0.into(), val],
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -977,15 +977,15 @@ fn test_fold_comparison4() {
|
||||
|
||||
#[test]
|
||||
fn test_fold_get_elem1() {
|
||||
fold("x = [,10][0]", "x = void 0");
|
||||
fold("x = [10, 20][0]", "x = 10");
|
||||
fold("x = [10, 20][1]", "x = 20");
|
||||
fold("x = [,10][0]", "x = (0, void 0)");
|
||||
fold("x = [10, 20][0]", "x = (0, 10)");
|
||||
fold("x = [10, 20][1]", "x = (0, 20)");
|
||||
|
||||
// fold("x = [10, 20][-1]", "x = void 0;");
|
||||
// fold("x = [10, 20][2]", "x = void 0;");
|
||||
|
||||
fold("x = [foo(), 0][1]", "x = (foo(), 0);");
|
||||
fold("x = [0, foo()][1]", "x = foo()");
|
||||
fold("x = [0, foo()][1]", "x = (0, foo())");
|
||||
// fold("x = [0, foo()][0]", "x = (foo(), 0)");
|
||||
fold_same("for([1][0] in {});");
|
||||
}
|
||||
@ -1008,11 +1008,11 @@ fn test_fold_get_elem2_2() {
|
||||
|
||||
#[test]
|
||||
fn test_fold_array_lit_spread_get_elem() {
|
||||
fold("x = [...[0 ]][0]", "x = 0;");
|
||||
fold("x = [0, 1, ...[2, 3, 4]][3]", "x = 3;");
|
||||
fold("x = [...[0, 1], 2, ...[3, 4]][3]", "x = 3;");
|
||||
fold("x = [...[...[0, 1], 2, 3], 4][0]", "x = 0");
|
||||
fold("x = [...[...[0, 1], 2, 3], 4][3]", "x = 3");
|
||||
fold("x = [...[0 ]][0]", "x = (0, 0);");
|
||||
fold("x = [0, 1, ...[2, 3, 4]][3]", "x = (0, 3);");
|
||||
fold("x = [...[0, 1], 2, ...[3, 4]][3]", "x = (0, 3);");
|
||||
fold("x = [...[...[0, 1], 2, 3], 4][0]", "x = (0, 0)");
|
||||
fold("x = [...[...[0, 1], 2, 3], 4][3]", "x = (0, 3)");
|
||||
// fold("x = [...[]][100]", "x = void 0;");
|
||||
// fold("x = [...[0]][100]", "x = void 0;");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user