mirror of
https://github.com/swc-project/swc.git
synced 2024-11-24 02:06:08 +03:00
feat(es/minifier): Improve handling of switches (#4260)
This commit is contained in:
parent
2033b788a1
commit
8cf3ddda6c
@ -11,7 +11,6 @@ const reducer = (op, args)=>{
|
||||
break;
|
||||
case "concat":
|
||||
console.log(args.firstArr.concat(args.secondArr));
|
||||
break;
|
||||
}
|
||||
};
|
||||
reducer("add", {
|
||||
|
@ -12,7 +12,6 @@ var reducer = function(op, args) {
|
||||
break;
|
||||
case "concat":
|
||||
console.log(args.firstArr.concat(args.secondArr));
|
||||
break;
|
||||
}
|
||||
};
|
||||
reducer("add", {
|
||||
|
@ -77,7 +77,6 @@ var TypeScript;
|
||||
context.skipNextFuncDeclForClass ? context.skipNextFuncDeclForClass = !1 : (context.scopeGetter = function() {
|
||||
return funcDecl.isConstructor && hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod) && ast.type && ast.type.enclosingType ? ast.type.enclosingType.constructorScope : funcDecl.scopeType ? funcDecl.scopeType.containedScope : funcDecl.type ? funcDecl.type.containedScope : null;
|
||||
}, context.scopeStartAST = ast);
|
||||
break;
|
||||
}
|
||||
walker.options.goChildren = !0;
|
||||
} else walker.options.goChildren = !1;
|
||||
|
@ -42,7 +42,6 @@ import * as swcHelpers from "@swc/helpers";
|
||||
context.skipNextFuncDeclForClass ? context.skipNextFuncDeclForClass = !1 : (context.scopeGetter = function() {
|
||||
return funcDecl.isConstructor && hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod) && ast.type && ast.type.enclosingType ? ast.type.enclosingType.constructorScope : funcDecl.scopeType ? funcDecl.scopeType.containedScope : funcDecl.type ? funcDecl.type.containedScope : null;
|
||||
}, context.scopeStartAST = ast);
|
||||
break;
|
||||
}
|
||||
walker.options.goChildren = !0;
|
||||
} else walker.options.goChildren = !1;
|
||||
|
@ -246,7 +246,6 @@ var Formatting;
|
||||
break;
|
||||
case AuthorTokenKind.atkLBrack:
|
||||
updateStartOffset = node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkArray;
|
||||
break;
|
||||
}
|
||||
updateStartOffset && ParseNodeExtensions.SetNodeSpan(node, token.Span.startPosition(), node.AuthorNode.Details.EndOffset);
|
||||
}
|
||||
|
@ -219,7 +219,6 @@ import * as swcHelpers from "@swc/helpers";
|
||||
break;
|
||||
case AuthorTokenKind.atkLBrack:
|
||||
updateStartOffset = node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkArray;
|
||||
break;
|
||||
}
|
||||
updateStartOffset && ParseNodeExtensions.SetNodeSpan(node, token.Span.startPosition(), node.AuthorNode.Details.EndOffset);
|
||||
}
|
||||
|
@ -5,5 +5,4 @@ switch(foo){
|
||||
break;
|
||||
default:
|
||||
foo = foo[0];
|
||||
break;
|
||||
}
|
||||
|
@ -5,5 +5,4 @@ switch(foo){
|
||||
break;
|
||||
default:
|
||||
foo = foo[0];
|
||||
break;
|
||||
}
|
||||
|
@ -0,0 +1,6 @@
|
||||
'';
|
||||
ONE: '';
|
||||
TWO: THREE: '';
|
||||
FOUR: '';
|
||||
'';
|
||||
SEVEN: '';
|
@ -0,0 +1,6 @@
|
||||
"";
|
||||
ONE: "";
|
||||
TWO: THREE: "";
|
||||
FOUR: "";
|
||||
"";
|
||||
SEVEN: "";
|
@ -5,4 +5,5 @@ var M;
|
||||
}
|
||||
M1.fn = fn;
|
||||
}(M || (M = {})), new class {
|
||||
}(), new Object();
|
||||
}(), new Object(), (x)=>''
|
||||
;
|
||||
|
@ -1,11 +1 @@
|
||||
var y;
|
||||
switch(y){
|
||||
case 'a':
|
||||
throw y;
|
||||
default:
|
||||
throw y;
|
||||
}
|
||||
for(;;)throw 0;
|
||||
for(;;)throw 0;
|
||||
for(var idx in {})throw idx;
|
||||
for(;;)throw null;
|
||||
throw void 0;
|
||||
|
@ -1,20 +1,3 @@
|
||||
var y;
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
switch(y){
|
||||
case "a":
|
||||
throw y;
|
||||
default:
|
||||
throw y;
|
||||
}
|
||||
for(;;)throw 0;
|
||||
for(;;)throw 0;
|
||||
for(var idx in {})throw idx;
|
||||
for(;;)throw null;
|
||||
var y, C = function() {
|
||||
"use strict";
|
||||
function C() {
|
||||
throw swcHelpers.classCallCheck(this, C), this;
|
||||
}
|
||||
return C.prototype.biz = function() {
|
||||
throw this.value;
|
||||
}, C;
|
||||
}();
|
||||
throw y;
|
||||
|
@ -1 +1 @@
|
||||
isString1(0, ""), isString1(0, ""), isString2("");
|
||||
isString1(0, ""), isString2(""), isString1(0, ""), isString2("");
|
||||
|
@ -1 +1 @@
|
||||
isString1(0, ""), isString1(0, ""), isString2("");
|
||||
isString1(0, ""), isString2(""), isString1(0, ""), isString2("");
|
||||
|
@ -345,6 +345,16 @@ pub struct SwitchCase {
|
||||
pub cons: Vec<Stmt>,
|
||||
}
|
||||
|
||||
impl Take for SwitchCase {
|
||||
fn dummy() -> Self {
|
||||
Self {
|
||||
span: DUMMY_SP,
|
||||
test: None,
|
||||
cons: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("CatchClause")]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
|
@ -3,14 +3,11 @@ use std::mem::swap;
|
||||
use swc_common::{util::take::Take, EqIgnoreSpan, Spanned, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::ExprRefExt;
|
||||
use swc_ecma_utils::{ident::IdentLike, ExprExt, ExprFactory, StmtLike};
|
||||
use swc_ecma_utils::{ident::IdentLike, ExprExt, ExprFactory, StmtExt, StmtLike};
|
||||
|
||||
use super::Optimizer;
|
||||
use crate::{
|
||||
compress::{
|
||||
optimize::Ctx,
|
||||
util::{always_terminates, negate_cost},
|
||||
},
|
||||
compress::{optimize::Ctx, util::negate_cost},
|
||||
mode::Mode,
|
||||
DISABLE_BUGGY_PASSES,
|
||||
};
|
||||
@ -701,7 +698,7 @@ where
|
||||
cons,
|
||||
alt: Some(..),
|
||||
..
|
||||
})) => always_terminates(cons),
|
||||
})) => cons.terminates(),
|
||||
_ => false,
|
||||
});
|
||||
if !need_work {
|
||||
@ -720,7 +717,7 @@ where
|
||||
cons,
|
||||
alt: Some(alt),
|
||||
..
|
||||
}) if always_terminates(&cons) => {
|
||||
}) if cons.terminates() => {
|
||||
new_stmts.push(T::from_stmt(Stmt::If(IfStmt {
|
||||
span,
|
||||
test,
|
||||
|
@ -1,15 +1,10 @@
|
||||
use swc_common::{util::take::Take, Spanned, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_utils::{prepend, undefined, StmtLike};
|
||||
use swc_ecma_utils::{prepend, undefined, StmtExt, StmtLike};
|
||||
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
|
||||
|
||||
use super::Optimizer;
|
||||
use crate::{
|
||||
compress::util::{always_terminates, is_pure_undefined},
|
||||
debug::dump,
|
||||
mode::Mode,
|
||||
util::ExprOptExt,
|
||||
};
|
||||
use crate::{compress::util::is_pure_undefined, debug::dump, mode::Mode, util::ExprOptExt};
|
||||
|
||||
/// Methods related to the option `if_return`. All methods are noop if
|
||||
/// `if_return` is false.
|
||||
@ -587,7 +582,7 @@ fn always_terminates_with_return_arg(s: &Stmt) -> bool {
|
||||
fn can_merge_as_if_return(s: &Stmt) -> bool {
|
||||
fn cost(s: &Stmt) -> Option<isize> {
|
||||
if let Stmt::Block(..) = s {
|
||||
if !always_terminates(s) {
|
||||
if !s.terminates() {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ use swc_common::{
|
||||
};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_utils::{
|
||||
ident::IdentLike, prepend_stmts, undefined, ExprExt, ExprFactory, Id, IsEmpty, ModuleItemLike,
|
||||
StmtLike, Type, Value,
|
||||
extract_var_ids, ident::IdentLike, prepend_stmts, undefined, ExprExt, ExprFactory, Id, IsEmpty,
|
||||
ModuleItemLike, StmtLike, Type, Value,
|
||||
};
|
||||
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith, VisitWith};
|
||||
use tracing::{debug, span, Level};
|
||||
@ -133,8 +133,6 @@ struct Ctx {
|
||||
/// `true` while handling `expr` of `!expr`
|
||||
in_bang_arg: bool,
|
||||
in_var_decl_of_for_in_or_of_loop: bool,
|
||||
/// `true` while handling inner statements of a labelled statement.
|
||||
stmt_labelled: bool,
|
||||
|
||||
dont_use_negated_iife: bool,
|
||||
|
||||
@ -1551,7 +1549,6 @@ where
|
||||
#[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
|
||||
fn visit_mut_block_stmt(&mut self, n: &mut BlockStmt) {
|
||||
let ctx = Ctx {
|
||||
stmt_labelled: false,
|
||||
top_level: false,
|
||||
in_block: true,
|
||||
scope: n.span.ctxt,
|
||||
@ -1957,13 +1954,7 @@ where
|
||||
|
||||
#[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
|
||||
fn visit_mut_function(&mut self, n: &mut Function) {
|
||||
{
|
||||
let ctx = Ctx {
|
||||
stmt_labelled: false,
|
||||
..self.ctx
|
||||
};
|
||||
n.decorators.visit_mut_with(&mut *self.with_ctx(ctx));
|
||||
}
|
||||
n.decorators.visit_mut_with(self);
|
||||
|
||||
let is_standalone = n.span.has_mark(self.marks.standalone);
|
||||
|
||||
@ -1978,7 +1969,6 @@ where
|
||||
{
|
||||
let ctx = Ctx {
|
||||
skip_standalone: self.ctx.skip_standalone || is_standalone,
|
||||
stmt_labelled: false,
|
||||
in_fn_like: true,
|
||||
scope: n.span.ctxt,
|
||||
can_inline_arguments: true,
|
||||
@ -2044,13 +2034,9 @@ where
|
||||
|
||||
#[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
|
||||
fn visit_mut_labeled_stmt(&mut self, n: &mut LabeledStmt) {
|
||||
let ctx = Ctx {
|
||||
stmt_labelled: true,
|
||||
..self.ctx
|
||||
};
|
||||
let old_label = self.label.take();
|
||||
self.label = Some(n.label.to_id());
|
||||
n.visit_mut_children_with(&mut *self.with_ctx(ctx));
|
||||
n.visit_mut_children_with(self);
|
||||
|
||||
if self.label.is_none() {
|
||||
report_change!("Removing label `{}`", n.label);
|
||||
@ -2511,6 +2497,77 @@ where
|
||||
if cfg!(debug_assertions) {
|
||||
stmts.visit_with(&mut AssertValid);
|
||||
}
|
||||
|
||||
if self.options.dead_code {
|
||||
// copy from [Remover]
|
||||
// TODO: make it better
|
||||
let orig_len = stmts.len();
|
||||
|
||||
let mut new_stmts = Vec::with_capacity(stmts.len());
|
||||
|
||||
let mut iter = stmts.take().into_iter();
|
||||
while let Some(stmt) = iter.next() {
|
||||
let stmt = match stmt {
|
||||
// Remove empty statements.
|
||||
Stmt::Empty(..) => continue,
|
||||
|
||||
// Control flow
|
||||
Stmt::Throw(..)
|
||||
| Stmt::Return { .. }
|
||||
| Stmt::Continue { .. }
|
||||
| Stmt::Break { .. } => {
|
||||
// Hoist function and `var` declarations above return.
|
||||
let mut decls = vec![];
|
||||
let mut hoisted_fns = vec![];
|
||||
for t in iter {
|
||||
match t.try_into_stmt() {
|
||||
Ok(Stmt::Decl(Decl::Fn(f))) => {
|
||||
hoisted_fns.push(Stmt::Decl(Decl::Fn(f)));
|
||||
}
|
||||
Ok(t) => {
|
||||
let ids =
|
||||
extract_var_ids(&t).into_iter().map(|i| VarDeclarator {
|
||||
span: i.span,
|
||||
name: i.into(),
|
||||
init: None,
|
||||
definite: false,
|
||||
});
|
||||
decls.extend(ids);
|
||||
}
|
||||
Err(item) => new_stmts.push(item),
|
||||
}
|
||||
}
|
||||
|
||||
if !decls.is_empty() {
|
||||
new_stmts.push(Stmt::Decl(Decl::Var(VarDecl {
|
||||
span: DUMMY_SP,
|
||||
kind: VarDeclKind::Var,
|
||||
decls,
|
||||
declare: false,
|
||||
})));
|
||||
}
|
||||
|
||||
new_stmts.push(stmt);
|
||||
new_stmts.extend(hoisted_fns);
|
||||
|
||||
*stmts = new_stmts;
|
||||
if stmts.len() != orig_len {
|
||||
self.changed = true;
|
||||
|
||||
report_change!("Dropping statements after a control keyword");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_ => stmt,
|
||||
};
|
||||
|
||||
new_stmts.push(stmt);
|
||||
}
|
||||
|
||||
*stmts = new_stmts;
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_mut_str(&mut self, s: &mut Str) {
|
||||
@ -2540,8 +2597,6 @@ where
|
||||
fn visit_mut_switch_stmt(&mut self, n: &mut SwitchStmt) {
|
||||
n.discriminant.visit_mut_with(self);
|
||||
|
||||
self.drop_unreachable_cases(n);
|
||||
|
||||
n.cases.visit_mut_with(self);
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
use std::mem::take;
|
||||
|
||||
use swc_common::{util::take::Take, EqIgnoreSpan, DUMMY_SP};
|
||||
use swc_common::{util::take::Take, EqIgnoreSpan, Spanned, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_utils::{ident::IdentLike, prepend, ExprExt, StmtExt, Type, Value::Known};
|
||||
use swc_ecma_utils::{prepend, ExprExt, ExprFactory, StmtExt};
|
||||
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
|
||||
|
||||
use super::Optimizer;
|
||||
use crate::{mode::Mode, util::ExprOptExt};
|
||||
use crate::{compress::util::is_primitive, mode::Mode};
|
||||
|
||||
/// Methods related to option `switches`.
|
||||
impl<M> Optimizer<'_, M>
|
||||
@ -16,171 +14,147 @@ where
|
||||
/// Handle switches in the case where we can know which branch will be
|
||||
/// taken.
|
||||
pub(super) fn optimize_const_switches(&mut self, s: &mut Stmt) {
|
||||
if !self.options.switches || self.ctx.stmt_labelled {
|
||||
if !self.options.switches || !self.options.dead_code {
|
||||
return;
|
||||
}
|
||||
|
||||
let (label, stmt) = match s {
|
||||
Stmt::Switch(s) => (None, s),
|
||||
Stmt::Labeled(l) => match &mut *l.body {
|
||||
Stmt::Switch(s) => (Some(l.label.clone()), s),
|
||||
_ => return,
|
||||
},
|
||||
let stmt = match s {
|
||||
Stmt::Switch(s) => s,
|
||||
_ => return,
|
||||
};
|
||||
|
||||
// TODO: evaluate
|
||||
fn tail_expr(e: &Expr) -> &Expr {
|
||||
match e {
|
||||
Expr::Seq(s) => s.exprs.last().unwrap(),
|
||||
_ => e,
|
||||
}
|
||||
}
|
||||
|
||||
let discriminant = &mut stmt.discriminant;
|
||||
if let Expr::Update(..) = &**discriminant {
|
||||
return;
|
||||
}
|
||||
|
||||
if stmt
|
||||
.cases
|
||||
.iter()
|
||||
.any(|case| matches!(case.test.as_deref(), Some(Expr::Update(..))))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
let matching_case = stmt.cases.iter_mut().position(|case| {
|
||||
case.test
|
||||
.as_ref()
|
||||
.map(|test| discriminant.value_mut().eq_ignore_span(test))
|
||||
.unwrap_or(false)
|
||||
});
|
||||
|
||||
if let Some(case_idx) = matching_case {
|
||||
let mut var_ids = vec![];
|
||||
let mut stmts = vec![];
|
||||
|
||||
let should_preserve_switch = stmt.cases.iter().skip(case_idx).any(|case| {
|
||||
let mut v = BreakFinder {
|
||||
found_unlabelled_break_for_stmt: false,
|
||||
};
|
||||
case.visit_with(&mut v);
|
||||
v.found_unlabelled_break_for_stmt
|
||||
});
|
||||
if should_preserve_switch {
|
||||
// Prevent infinite loop.
|
||||
if stmt.cases.len() == 1 {
|
||||
return;
|
||||
}
|
||||
|
||||
report_change!("switches: Removing unreachable cases from a constant switch");
|
||||
let tail = if let Some(e) = is_primitive(tail_expr(discriminant)) {
|
||||
e
|
||||
} else {
|
||||
report_change!("switches: Removing a constant switch");
|
||||
return;
|
||||
};
|
||||
|
||||
let mut var_ids = vec![];
|
||||
let mut cases = Vec::new();
|
||||
let mut exact = None;
|
||||
|
||||
for (idx, case) in stmt.cases.iter_mut().enumerate() {
|
||||
if let Some(test) = case.test.as_ref() {
|
||||
if let Some(e) = is_primitive(tail_expr(test)) {
|
||||
if e.eq_ignore_span(tail) {
|
||||
cases.push(case.take());
|
||||
exact = Some(idx);
|
||||
break;
|
||||
} else {
|
||||
var_ids.extend(case.cons.extract_var_ids())
|
||||
}
|
||||
} else {
|
||||
cases.push(case.take())
|
||||
}
|
||||
} else {
|
||||
cases.push(case.take())
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(exact) = exact {
|
||||
let exact_case = cases.last_mut().unwrap();
|
||||
let mut terminate = exact_case.cons.terminates();
|
||||
for case in stmt.cases[(exact + 1)..].iter_mut() {
|
||||
if terminate {
|
||||
var_ids.extend(case.cons.extract_var_ids())
|
||||
} else {
|
||||
terminate |= case.cons.terminates();
|
||||
exact_case.cons.extend(case.cons.take())
|
||||
}
|
||||
}
|
||||
// remove default if there's an exact match
|
||||
cases.retain(|case| case.test.is_some());
|
||||
|
||||
if cases.len() == 2 {
|
||||
let last = cases.last_mut().unwrap();
|
||||
|
||||
self.changed = true;
|
||||
let mut preserved = vec![];
|
||||
if !should_preserve_switch && !discriminant.is_lit() {
|
||||
preserved.push(Stmt::Expr(ExprStmt {
|
||||
span: stmt.span,
|
||||
expr: discriminant.take(),
|
||||
}));
|
||||
|
||||
if let Some(expr) = stmt.cases[case_idx].test.take() {
|
||||
preserved.push(Stmt::Expr(ExprStmt {
|
||||
span: stmt.cases[case_idx].span,
|
||||
expr,
|
||||
}));
|
||||
report_change!("switches: Turn exact match into default");
|
||||
// so that following pass could turn it into if else
|
||||
if let Some(test) = last.test.take() {
|
||||
prepend(&mut last.cons, test.into_stmt())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for case in &stmt.cases[..case_idx] {
|
||||
for cons in &case.cons {
|
||||
var_ids.extend(
|
||||
cons.extract_var_ids()
|
||||
if cases.len() == stmt.cases.len() {
|
||||
stmt.cases = cases;
|
||||
return;
|
||||
}
|
||||
|
||||
self.optimize_switch_cases(&mut cases);
|
||||
|
||||
let var_ids: Vec<VarDeclarator> = var_ids
|
||||
.into_iter()
|
||||
.map(|name| VarDeclarator {
|
||||
span: DUMMY_SP,
|
||||
name: Pat::Ident(name.into()),
|
||||
init: None,
|
||||
definite: Default::default(),
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
for case in stmt.cases.iter_mut().skip(case_idx) {
|
||||
let mut found_break = false;
|
||||
case.cons.retain(|stmt| match stmt {
|
||||
Stmt::Break(BreakStmt { label: None, .. }) => {
|
||||
found_break = true;
|
||||
false
|
||||
}
|
||||
self.changed = true;
|
||||
|
||||
// TODO: Search recursively.
|
||||
Stmt::Break(BreakStmt {
|
||||
label: Some(break_label),
|
||||
..
|
||||
}) => {
|
||||
if Some(break_label.to_id()) == label.as_ref().map(|label| label.to_id()) {
|
||||
found_break = true;
|
||||
false
|
||||
} else {
|
||||
!found_break
|
||||
}
|
||||
}
|
||||
_ => !found_break,
|
||||
});
|
||||
if cases.len() == 1
|
||||
&& (cases[0].test.is_none() || exact.is_some())
|
||||
&& !contains_nested_break(&cases[0])
|
||||
{
|
||||
report_change!("switches: Removing a constant switch");
|
||||
|
||||
for case_stmt in case.cons.take() {
|
||||
match case_stmt {
|
||||
Stmt::Decl(Decl::Var(v)) if v.decls.iter().all(|v| v.init.is_none()) => {
|
||||
var_ids.extend(v.decls)
|
||||
}
|
||||
_ => {
|
||||
stmts.push(case_stmt);
|
||||
}
|
||||
}
|
||||
}
|
||||
if found_break {
|
||||
break;
|
||||
}
|
||||
}
|
||||
let mut stmts = Vec::new();
|
||||
|
||||
if !var_ids.is_empty() {
|
||||
prepend(
|
||||
&mut stmts,
|
||||
stmts.push(Stmt::Decl(Decl::Var(VarDecl {
|
||||
span: DUMMY_SP,
|
||||
kind: VarDeclKind::Var,
|
||||
declare: Default::default(),
|
||||
decls: var_ids,
|
||||
})))
|
||||
}
|
||||
|
||||
stmts.push(discriminant.take().into_stmt());
|
||||
let mut last = cases.pop().unwrap();
|
||||
remove_last_break(&mut last.cons);
|
||||
|
||||
if let Some(test) = last.test {
|
||||
stmts.push(test.into_stmt());
|
||||
}
|
||||
|
||||
stmts.extend(last.cons);
|
||||
*s = Stmt::Block(BlockStmt {
|
||||
span: DUMMY_SP,
|
||||
stmts,
|
||||
})
|
||||
} else {
|
||||
report_change!("switches: Removing unreachable cases from a constant switch");
|
||||
|
||||
stmt.cases = cases;
|
||||
|
||||
if !var_ids.is_empty() {
|
||||
*s = Stmt::Block(BlockStmt {
|
||||
span: DUMMY_SP,
|
||||
stmts: vec![
|
||||
Stmt::Decl(Decl::Var(VarDecl {
|
||||
span: DUMMY_SP,
|
||||
kind: VarDeclKind::Var,
|
||||
declare: Default::default(),
|
||||
decls: take(&mut var_ids),
|
||||
decls: var_ids,
|
||||
})),
|
||||
)
|
||||
s.take(),
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
let inner = if should_preserve_switch {
|
||||
let mut cases = stmt.cases.take();
|
||||
let case = SwitchCase {
|
||||
span: cases[case_idx].span,
|
||||
test: cases[case_idx].test.take(),
|
||||
cons: stmts,
|
||||
};
|
||||
|
||||
Stmt::Switch(SwitchStmt {
|
||||
span: stmt.span,
|
||||
discriminant: stmt.discriminant.take(),
|
||||
cases: vec![case],
|
||||
})
|
||||
} else {
|
||||
preserved.extend(stmts);
|
||||
Stmt::Block(BlockStmt {
|
||||
span: DUMMY_SP,
|
||||
stmts: preserved,
|
||||
})
|
||||
};
|
||||
|
||||
*s = match label {
|
||||
Some(label) => Stmt::Labeled(LabeledStmt {
|
||||
span: DUMMY_SP,
|
||||
label,
|
||||
body: Box::new(inner),
|
||||
}),
|
||||
None => inner,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,183 +163,345 @@ where
|
||||
/// This method will
|
||||
///
|
||||
/// - drop the empty cases at the end.
|
||||
/// - drop break at last case
|
||||
/// - merge branch with default at the end
|
||||
pub(super) fn optimize_switch_cases(&mut self, cases: &mut Vec<SwitchCase>) {
|
||||
if !self.options.switches {
|
||||
if !self.options.switches || !self.options.dead_code || cases.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
// If default is not last, we can't remove empty cases.
|
||||
let has_default = cases.iter().any(|case| case.test.is_none());
|
||||
let all_ends_with_break = cases
|
||||
.iter()
|
||||
.all(|case| case.cons.is_empty() || case.cons.last().unwrap().is_break_stmt());
|
||||
let mut preserve_cases = false;
|
||||
if !all_ends_with_break && has_default {
|
||||
if let Some(last) = cases.last() {
|
||||
if last.test.is_some() {
|
||||
preserve_cases = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.merge_cases_with_same_cons(cases);
|
||||
|
||||
let last_non_empty = cases.iter().rposition(|case| {
|
||||
// We should preserve test cases if the test is not a literal.
|
||||
match case.test.as_deref() {
|
||||
Some(Expr::Lit(..)) | None => {}
|
||||
_ => return true,
|
||||
}
|
||||
// last case with no empty body
|
||||
let mut last = cases.len();
|
||||
|
||||
if case.cons.is_empty() {
|
||||
return false;
|
||||
}
|
||||
for (idx, case) in cases.iter_mut().enumerate().rev() {
|
||||
self.changed |= remove_last_break(&mut case.cons);
|
||||
|
||||
if case.cons.len() == 1 {
|
||||
if let Stmt::Break(BreakStmt { label: None, .. }) = case.cons[0] {
|
||||
return false;
|
||||
if !case.cons.is_empty() {
|
||||
last = idx + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
true
|
||||
let has_side_effect = cases.iter().skip(last).rposition(|case| {
|
||||
case.test
|
||||
.as_deref()
|
||||
.map(|test| test.may_have_side_effects())
|
||||
.unwrap_or(false)
|
||||
});
|
||||
|
||||
if !preserve_cases {
|
||||
if let Some(last_non_empty) = last_non_empty {
|
||||
if last_non_empty + 1 != cases.len() {
|
||||
if let Some(has_side_effect) = has_side_effect {
|
||||
last += has_side_effect + 1
|
||||
}
|
||||
|
||||
let default = cases.iter().position(|case| case.test.is_none());
|
||||
|
||||
// if default is before empty cases, we must ensure empty case is preserved
|
||||
if last < cases.len() && default.map(|idx| idx >= last).unwrap_or(true) {
|
||||
self.changed = true;
|
||||
report_change!("switches: Removing empty cases at the end");
|
||||
self.changed = true;
|
||||
cases.drain(last_non_empty + 1..);
|
||||
cases.drain(last..);
|
||||
}
|
||||
|
||||
if let Some(default) = default {
|
||||
let end = cases
|
||||
.iter()
|
||||
.skip(default)
|
||||
.position(|case| !case.cons.is_empty())
|
||||
.unwrap_or(0)
|
||||
+ default;
|
||||
|
||||
if end != cases.len() - 1 {
|
||||
return;
|
||||
}
|
||||
let start = cases.iter().enumerate().rposition(|(idx, case)| {
|
||||
case.test
|
||||
.as_deref()
|
||||
.map(|test| test.may_have_side_effects())
|
||||
.unwrap_or(false)
|
||||
|| (idx != end && !case.cons.is_empty())
|
||||
});
|
||||
|
||||
let start = start.map(|s| s + 1).unwrap_or(0);
|
||||
|
||||
if start <= default {
|
||||
if start < end {
|
||||
cases[start].cons = cases[end].cons.take();
|
||||
cases.drain((start + 1)..);
|
||||
cases[start].test = None;
|
||||
}
|
||||
} else {
|
||||
if start <= end {
|
||||
cases[start].cons = cases[end].cons.take();
|
||||
cases.drain(start..);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(last) = cases.last_mut() {
|
||||
if let Some(Stmt::Break(BreakStmt { label: None, .. })) = last.cons.last() {
|
||||
report_change!("switches: Removing `break` at the end");
|
||||
self.changed = true;
|
||||
last.cons.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// If a case ends with break but content is same with the consecutive case
|
||||
/// except the break statement, we merge them.
|
||||
/// If a case ends with break but content is same with the another case
|
||||
/// without break case order, except the break statement, we merge
|
||||
/// them.
|
||||
fn merge_cases_with_same_cons(&mut self, cases: &mut Vec<SwitchCase>) {
|
||||
let mut stop_pos_opt = cases
|
||||
.iter()
|
||||
.position(|case| matches!(case.test.as_deref(), Some(Expr::Update(..))));
|
||||
let mut i = 0;
|
||||
let len = cases.len();
|
||||
|
||||
let mut found = None;
|
||||
'l: for (li, l) in cases.iter().enumerate().rev() {
|
||||
if l.cons.is_empty() {
|
||||
// may some smarter person find a better solution
|
||||
while i < len {
|
||||
if cases[i].cons.is_empty() {
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
let mut block_start = i + 1;
|
||||
let mut cannot_cross_block = false;
|
||||
|
||||
for j in (i + 1)..len {
|
||||
cannot_cross_block |= cases[j]
|
||||
.test
|
||||
.as_deref()
|
||||
.map(|test| is_primitive(test).is_none())
|
||||
.unwrap_or(false)
|
||||
|| !(cases[j].cons.is_empty()
|
||||
|| cases[j].cons.terminates()
|
||||
|| j == cases.len() - 1);
|
||||
|
||||
if cases[j].cons.is_empty() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if let Some(stop_pos) = stop_pos_opt {
|
||||
if li == stop_pos {
|
||||
// Look for next stop position
|
||||
stop_pos_opt = cases
|
||||
.iter()
|
||||
.skip(li)
|
||||
.position(|case| matches!(case.test.as_deref(), Some(Expr::Update(..))))
|
||||
.map(|v| v + li);
|
||||
continue;
|
||||
}
|
||||
if cannot_cross_block && block_start != i + 1 {
|
||||
break;
|
||||
}
|
||||
|
||||
if let Some(l_last) = l.cons.last() {
|
||||
match l_last {
|
||||
Stmt::Break(BreakStmt { label: None, .. }) => {}
|
||||
_ => continue,
|
||||
}
|
||||
}
|
||||
block_start = j + 1;
|
||||
|
||||
for r in cases.iter().skip(li + 1) {
|
||||
if r.cons.is_empty() {
|
||||
continue;
|
||||
// first case with a body and don't cross non-primitive branch
|
||||
let found = if j != len - 1 {
|
||||
cases[i].cons.eq_ignore_span(&cases[j].cons)
|
||||
} else {
|
||||
if let Some(Stmt::Break(BreakStmt { label: None, .. })) = cases[i].cons.last() {
|
||||
cases[i].cons[..(cases[i].cons.len() - 1)].eq_ignore_span(&cases[j].cons)
|
||||
} else {
|
||||
cases[i].cons.eq_ignore_span(&cases[j].cons)
|
||||
}
|
||||
};
|
||||
|
||||
let mut r_cons_slice = r.cons.len();
|
||||
|
||||
if let Some(Stmt::Break(BreakStmt { label: None, .. })) = r.cons.last() {
|
||||
r_cons_slice -= 1;
|
||||
}
|
||||
|
||||
if l.cons[..l.cons.len() - 1].eq_ignore_span(&r.cons[..r_cons_slice]) {
|
||||
found = Some(li);
|
||||
break 'l;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(idx) = found {
|
||||
if found {
|
||||
self.changed = true;
|
||||
report_change!("switches: Merging cases with same cons");
|
||||
cases[idx].cons.clear();
|
||||
let mut len = 1;
|
||||
while len < j && cases[j - len].cons.is_empty() {
|
||||
len += 1;
|
||||
}
|
||||
cases[j].cons = cases[i].cons.take();
|
||||
cases[(i + 1)..=j].rotate_right(len);
|
||||
i += len;
|
||||
}
|
||||
}
|
||||
|
||||
/// Remove unreachable cases using discriminant.
|
||||
pub(super) fn drop_unreachable_cases(&mut self, s: &mut SwitchStmt) {
|
||||
if !self.options.switches {
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
/// Try turn switch into if and remove empty switch
|
||||
pub(super) fn optimize_switches(&mut self, s: &mut Stmt) {
|
||||
if !self.options.switches || !self.options.dead_code {
|
||||
return;
|
||||
}
|
||||
|
||||
let dt = s.discriminant.get_type();
|
||||
|
||||
if let Known(Type::Bool) = dt {
|
||||
let db = s.discriminant.as_pure_bool();
|
||||
|
||||
if let Known(db) = db {
|
||||
s.cases.retain(|case| match case.test.as_deref() {
|
||||
Some(test) => {
|
||||
let tb = test.as_pure_bool();
|
||||
!matches!(tb, Known(tb) if db != tb)
|
||||
if let Stmt::Switch(sw) = s {
|
||||
match &mut *sw.cases {
|
||||
[] => {
|
||||
self.changed = true;
|
||||
report_change!("switches: Removing empty switch");
|
||||
*s = Stmt::Expr(ExprStmt {
|
||||
span: sw.span,
|
||||
expr: sw.discriminant.take(),
|
||||
})
|
||||
}
|
||||
None => false,
|
||||
[case] => {
|
||||
if contains_nested_break(case) {
|
||||
return;
|
||||
}
|
||||
self.changed = true;
|
||||
report_change!("switches: Turn one case switch into if");
|
||||
remove_last_break(&mut case.cons);
|
||||
|
||||
let case = case.take();
|
||||
let discriminant = sw.discriminant.take();
|
||||
|
||||
if let Some(test) = case.test {
|
||||
let test = Box::new(Expr::Bin(BinExpr {
|
||||
left: discriminant,
|
||||
right: test,
|
||||
op: op!("==="),
|
||||
span: DUMMY_SP,
|
||||
}));
|
||||
|
||||
*s = Stmt::If(IfStmt {
|
||||
span: sw.span,
|
||||
test,
|
||||
cons: Box::new(Stmt::Block(BlockStmt {
|
||||
span: DUMMY_SP,
|
||||
stmts: case.cons,
|
||||
})),
|
||||
alt: None,
|
||||
})
|
||||
} else {
|
||||
// is default
|
||||
let mut stmts = vec![Stmt::Expr(ExprStmt {
|
||||
span: discriminant.span(),
|
||||
expr: discriminant,
|
||||
})];
|
||||
stmts.extend(case.cons);
|
||||
*s = Stmt::Block(BlockStmt {
|
||||
span: sw.span,
|
||||
stmts,
|
||||
})
|
||||
}
|
||||
}
|
||||
[first, second] if first.test.is_none() || second.test.is_none() => {
|
||||
if contains_nested_break(first) || contains_nested_break(second) {
|
||||
return;
|
||||
}
|
||||
self.changed = true;
|
||||
report_change!("switches: Turn two cases switch into if else");
|
||||
let terminate = first.cons.terminates();
|
||||
|
||||
pub(super) fn optimize_switches(&mut self, _s: &mut Stmt) {
|
||||
if !self.options.switches || self.ctx.stmt_labelled {}
|
||||
|
||||
//
|
||||
if terminate {
|
||||
remove_last_break(&mut first.cons);
|
||||
// they cannot both be default as that's syntax error
|
||||
let (def, case) = if first.test.is_none() {
|
||||
(first, second)
|
||||
} else {
|
||||
(second, first)
|
||||
};
|
||||
*s = Stmt::If(IfStmt {
|
||||
span: sw.span,
|
||||
test: Expr::Bin(BinExpr {
|
||||
span: DUMMY_SP,
|
||||
op: op!("==="),
|
||||
left: sw.discriminant.take(),
|
||||
right: case.test.take().unwrap(),
|
||||
})
|
||||
.into(),
|
||||
cons: Stmt::Block(BlockStmt {
|
||||
span: DUMMY_SP,
|
||||
stmts: case.cons.take(),
|
||||
})
|
||||
.into(),
|
||||
alt: Some(
|
||||
Stmt::Block(BlockStmt {
|
||||
span: DUMMY_SP,
|
||||
stmts: def.cons.take(),
|
||||
})
|
||||
.into(),
|
||||
),
|
||||
})
|
||||
} else {
|
||||
let mut stmts = vec![Stmt::If(IfStmt {
|
||||
span: DUMMY_SP,
|
||||
test: Expr::Bin(if first.test.is_none() {
|
||||
BinExpr {
|
||||
span: DUMMY_SP,
|
||||
op: op!("!=="),
|
||||
left: sw.discriminant.take(),
|
||||
right: second.test.take().unwrap(),
|
||||
}
|
||||
} else {
|
||||
BinExpr {
|
||||
span: DUMMY_SP,
|
||||
op: op!("==="),
|
||||
left: sw.discriminant.take(),
|
||||
right: first.test.take().unwrap(),
|
||||
}
|
||||
})
|
||||
.into(),
|
||||
cons: Stmt::Block(BlockStmt {
|
||||
span: DUMMY_SP,
|
||||
stmts: first.cons.take(),
|
||||
})
|
||||
.into(),
|
||||
alt: None,
|
||||
})];
|
||||
stmts.extend(second.cons.take());
|
||||
*s = Stmt::Block(BlockStmt {
|
||||
span: sw.span,
|
||||
stmts,
|
||||
})
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn remove_last_break(stmt: &mut Vec<Stmt>) -> bool {
|
||||
if let Some(Stmt::Break(BreakStmt { label: None, .. })) = stmt.last() {
|
||||
report_change!("switches: Removing `break` at the end");
|
||||
stmt.pop();
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fn contains_nested_break(case: &SwitchCase) -> bool {
|
||||
let mut v = BreakFinder {
|
||||
top_level: true,
|
||||
nested_unlabelled_break: false,
|
||||
};
|
||||
case.visit_with(&mut v);
|
||||
v.nested_unlabelled_break
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct BreakFinder {
|
||||
found_unlabelled_break_for_stmt: bool,
|
||||
top_level: bool,
|
||||
nested_unlabelled_break: bool,
|
||||
}
|
||||
|
||||
impl Visit for BreakFinder {
|
||||
noop_visit_type!();
|
||||
|
||||
fn visit_break_stmt(&mut self, s: &BreakStmt) {
|
||||
if s.label.is_none() {
|
||||
self.found_unlabelled_break_for_stmt = true;
|
||||
if !self.top_level && s.label.is_none() {
|
||||
self.nested_unlabelled_break = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// We don't care about breaks in a lop[
|
||||
fn visit_if_stmt(&mut self, i: &IfStmt) {
|
||||
if self.top_level {
|
||||
self.top_level = false;
|
||||
i.visit_children_with(self);
|
||||
self.top_level = true;
|
||||
} else {
|
||||
i.visit_children_with(self);
|
||||
}
|
||||
}
|
||||
|
||||
/// We don't care about breaks in a loop
|
||||
fn visit_for_stmt(&mut self, _: &ForStmt) {}
|
||||
|
||||
/// We don't care about breaks in a lop[
|
||||
/// We don't care about breaks in a loop
|
||||
fn visit_for_in_stmt(&mut self, _: &ForInStmt) {}
|
||||
|
||||
/// We don't care about breaks in a lop[
|
||||
/// We don't care about breaks in a loop
|
||||
fn visit_for_of_stmt(&mut self, _: &ForOfStmt) {}
|
||||
|
||||
/// We don't care about breaks in a lop[
|
||||
/// We don't care about breaks in a loop
|
||||
fn visit_do_while_stmt(&mut self, _: &DoWhileStmt) {}
|
||||
|
||||
/// We don't care about breaks in a lop[
|
||||
/// We don't care about breaks in a loop
|
||||
fn visit_while_stmt(&mut self, _: &WhileStmt) {}
|
||||
|
||||
fn visit_switch_stmt(&mut self, _: &SwitchStmt) {}
|
||||
|
||||
fn visit_function(&mut self, _: &Function) {}
|
||||
|
||||
fn visit_arrow_expr(&mut self, _: &ArrowExpr) {}
|
||||
|
||||
fn visit_class(&mut self, _: &Class) {}
|
||||
}
|
||||
|
@ -4,10 +4,7 @@ use swc_ecma_utils::{ExprExt, StmtExt, StmtLike, Value};
|
||||
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
|
||||
|
||||
use super::Pure;
|
||||
use crate::{
|
||||
compress::util::{always_terminates, is_fine_for_if_cons},
|
||||
util::ModuleItemExt,
|
||||
};
|
||||
use crate::{compress::util::is_fine_for_if_cons, util::ModuleItemExt};
|
||||
|
||||
/// Methods related to option `dead_code`.
|
||||
impl Pure<'_> {
|
||||
@ -204,7 +201,7 @@ impl Pure<'_> {
|
||||
.iter()
|
||||
.enumerate()
|
||||
.find(|(_, stmt)| match stmt.as_stmt() {
|
||||
Some(s) => always_terminates(s),
|
||||
Some(s) => s.terminates(),
|
||||
_ => false,
|
||||
});
|
||||
|
||||
|
@ -381,6 +381,18 @@ pub(crate) fn is_pure_undefined(e: &Expr) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn is_primitive(e: &Expr) -> Option<&Expr> {
|
||||
if is_pure_undefined(e) {
|
||||
Some(e)
|
||||
} else {
|
||||
match e {
|
||||
Expr::Lit(Lit::Regex(_)) => None,
|
||||
Expr::Lit(_) => Some(e),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn is_valid_identifier(s: &str, ascii_only: bool) -> bool {
|
||||
if ascii_only {
|
||||
if s.chars().any(|c| !c.is_ascii()) {
|
||||
@ -533,18 +545,6 @@ pub(crate) fn eval_as_number(e: &Expr) -> Option<f64> {
|
||||
None
|
||||
}
|
||||
|
||||
pub(crate) fn always_terminates(s: &Stmt) -> bool {
|
||||
match s {
|
||||
Stmt::Return(..) | Stmt::Throw(..) | Stmt::Break(..) | Stmt::Continue(..) => true,
|
||||
Stmt::If(IfStmt { cons, alt, .. }) => {
|
||||
always_terminates(cons) && alt.as_deref().map(always_terminates).unwrap_or(false)
|
||||
}
|
||||
Stmt::Block(s) => s.stmts.iter().any(always_terminates),
|
||||
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn is_ident_used_by<N>(id: Id, node: &N) -> bool
|
||||
where
|
||||
N: for<'aa> VisitWith<UsageFinder<'aa>>,
|
||||
|
@ -254,7 +254,7 @@ pub struct CompressOptions {
|
||||
#[serde(alias = "side_effects")]
|
||||
pub side_effects: bool,
|
||||
|
||||
#[serde(default)]
|
||||
#[serde(default = "true_by_default")]
|
||||
#[serde(alias = "switches")]
|
||||
pub switches: bool,
|
||||
|
||||
|
@ -370,8 +370,7 @@ impl TerserCompressorOptions {
|
||||
})
|
||||
.unwrap_or(if self.defaults { 3 } else { 0 }),
|
||||
side_effects: self.side_effects.unwrap_or(self.defaults),
|
||||
// TODO: Use self.defaults
|
||||
switches: self.switches.unwrap_or(false),
|
||||
switches: self.switches.unwrap_or(self.defaults),
|
||||
top_retain: self.top_retain.map(From::from).unwrap_or_default(),
|
||||
top_level: self.toplevel.map(From::from),
|
||||
typeofs: self.typeofs.unwrap_or(self.defaults),
|
||||
|
@ -1002,7 +1002,6 @@
|
||||
value: value,
|
||||
done: !1
|
||||
});
|
||||
break;
|
||||
}
|
||||
(front = front.next) ? resume(front.key, front.arg) : back = null;
|
||||
}
|
||||
@ -3478,13 +3477,7 @@
|
||||
if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
|
||||
switch(KIND){
|
||||
case KEYS:
|
||||
return function() {
|
||||
return new IteratorConstructor(this, KIND);
|
||||
};
|
||||
case VALUES:
|
||||
return function() {
|
||||
return new IteratorConstructor(this, KIND);
|
||||
};
|
||||
case ENTRIES:
|
||||
return function() {
|
||||
return new IteratorConstructor(this, KIND);
|
||||
@ -8906,7 +8899,6 @@
|
||||
break;
|
||||
case FRAGMENT:
|
||||
chr != EOF && (url.fragment += percentEncode(chr, fragmentPercentEncodeSet));
|
||||
break;
|
||||
}
|
||||
pointer++;
|
||||
}
|
||||
@ -12521,6 +12513,7 @@
|
||||
if (ie) return "compositionend" === a || !ae && ge(a, b) ? (a = nd(), md = ld = kd = null, ie = !1, a) : null;
|
||||
switch(a){
|
||||
case "paste":
|
||||
default:
|
||||
return null;
|
||||
case "keypress":
|
||||
if (!(b.ctrlKey || b.altKey || b.metaKey) || b.ctrlKey && b.altKey) {
|
||||
@ -12530,8 +12523,6 @@
|
||||
return null;
|
||||
case "compositionend":
|
||||
return de && "ko" !== b.locale ? null : b.data;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}(a12, c5)) && 0 < (d = oe(d, "onBeforeInput")).length && (e = new Ld("onBeforeInput", "beforeinput", null, c5, e), g.push({
|
||||
event: e,
|
||||
@ -13092,19 +13083,15 @@
|
||||
a: {
|
||||
for(l2 = f.key, k2 = d; null !== k2;){
|
||||
if (k2.key === l2) {
|
||||
switch(k2.tag){
|
||||
case 7:
|
||||
if (7 === k2.tag) {
|
||||
if (f.type === ua) {
|
||||
c6(a15, k2.sibling), (d = e5(k2, f.props.children)).return = a15, a15 = d;
|
||||
break a;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (k2.elementType === f.type) {
|
||||
} else if (k2.elementType === f.type) {
|
||||
c6(a15, k2.sibling), (d = e5(k2, f.props)).ref = Qg(a15, k2, f), d.return = a15, a15 = d;
|
||||
break a;
|
||||
}
|
||||
}
|
||||
c6(a15, k2);
|
||||
break;
|
||||
}
|
||||
@ -13245,8 +13232,6 @@
|
||||
return null !== (b = 1 !== b.nodeType || c.toLowerCase() !== b.nodeName.toLowerCase() ? null : b) && (a.stateNode = b, !0);
|
||||
case 6:
|
||||
return null !== (b = "" === a.pendingProps || 3 !== b.nodeType ? null : b) && (a.stateNode = b, !0);
|
||||
case 13:
|
||||
return !1;
|
||||
default:
|
||||
return !1;
|
||||
}
|
||||
@ -14010,6 +13995,7 @@
|
||||
case 14:
|
||||
return null;
|
||||
case 1:
|
||||
case 17:
|
||||
return Ff(b.type) && Gf(), null;
|
||||
case 3:
|
||||
return fh(), H(N), H(M), uh(), (d = b.stateNode).pendingContext && (d.context = d.pendingContext, d.pendingContext = null), (null === a || null === a.child) && (rh(b) ? b.flags |= 4 : d.hydrate || (b.flags |= 256)), Ci(b), null;
|
||||
@ -14169,8 +14155,6 @@
|
||||
return fh(), Ci(b), null === a && cf(b.stateNode.containerInfo), null;
|
||||
case 10:
|
||||
return rg(b), null;
|
||||
case 17:
|
||||
return Ff(b.type) && Gf(), null;
|
||||
case 19:
|
||||
if (H(P), null === (d = b.memoizedState)) return null;
|
||||
if (f = 0 != (64 & b.flags), null === (g = d.rendering)) {
|
||||
@ -14364,6 +14348,10 @@
|
||||
case 11:
|
||||
case 15:
|
||||
case 22:
|
||||
case 5:
|
||||
case 6:
|
||||
case 4:
|
||||
case 17:
|
||||
return;
|
||||
case 1:
|
||||
if (256 & b.flags && null !== a) {
|
||||
@ -14374,11 +14362,6 @@
|
||||
case 3:
|
||||
256 & b.flags && qf(b.stateNode.containerInfo);
|
||||
return;
|
||||
case 5:
|
||||
case 6:
|
||||
case 4:
|
||||
case 17:
|
||||
return;
|
||||
}
|
||||
throw Error(y(163));
|
||||
}
|
||||
@ -14413,8 +14396,6 @@
|
||||
if (null !== (b = c.updateQueue)) {
|
||||
if (a = null, null !== c.child) switch(c.child.tag){
|
||||
case 5:
|
||||
a = c.child.stateNode;
|
||||
break;
|
||||
case 1:
|
||||
a = c.child.stateNode;
|
||||
}
|
||||
@ -14425,14 +14406,8 @@
|
||||
a = c.stateNode, null === b && 4 & c.flags && mf(c.type, c.memoizedProps) && a.focus();
|
||||
return;
|
||||
case 6:
|
||||
return;
|
||||
case 4:
|
||||
return;
|
||||
case 12:
|
||||
return;
|
||||
case 13:
|
||||
null === c.memoizedState && null !== (c = c.alternate) && null !== (c = c.memoizedState) && null !== (c = c.dehydrated) && Cc(c);
|
||||
return;
|
||||
case 19:
|
||||
case 17:
|
||||
case 20:
|
||||
@ -14440,6 +14415,9 @@
|
||||
case 23:
|
||||
case 24:
|
||||
return;
|
||||
case 13:
|
||||
null === c.memoizedState && null !== (c = c.alternate) && null !== (c = c.memoizedState) && null !== (c = c.dehydrated) && Cc(c);
|
||||
return;
|
||||
}
|
||||
throw Error(y(163));
|
||||
}
|
||||
@ -14529,8 +14507,6 @@
|
||||
var d = !1;
|
||||
break;
|
||||
case 3:
|
||||
b = b.containerInfo, d = !0;
|
||||
break;
|
||||
case 4:
|
||||
b = b.containerInfo, d = !0;
|
||||
break;
|
||||
@ -14575,8 +14551,6 @@
|
||||
f = !1;
|
||||
break a;
|
||||
case 3:
|
||||
e = e.containerInfo, f = !0;
|
||||
break a;
|
||||
case 4:
|
||||
e = e.containerInfo, f = !0;
|
||||
break a;
|
||||
@ -14628,6 +14602,8 @@
|
||||
}
|
||||
return;
|
||||
case 1:
|
||||
case 12:
|
||||
case 17:
|
||||
return;
|
||||
case 5:
|
||||
if (null != (c = b.stateNode)) {
|
||||
@ -14660,16 +14636,12 @@
|
||||
case 3:
|
||||
(c = b.stateNode).hydrate && (c.hydrate = !1, Cc(c.containerInfo));
|
||||
return;
|
||||
case 12:
|
||||
return;
|
||||
case 13:
|
||||
null !== b.memoizedState && (jj = O(), aj(b.child, !0)), kj(b);
|
||||
return;
|
||||
case 19:
|
||||
kj(b);
|
||||
return;
|
||||
case 17:
|
||||
return;
|
||||
case 23:
|
||||
case 24:
|
||||
aj(b, null !== b.memoizedState);
|
||||
@ -14810,6 +14782,7 @@
|
||||
case 1:
|
||||
throw Error(y(345));
|
||||
case 2:
|
||||
case 5:
|
||||
Uj(a);
|
||||
break;
|
||||
case 3:
|
||||
@ -14836,9 +14809,6 @@
|
||||
}
|
||||
Uj(a);
|
||||
break;
|
||||
case 5:
|
||||
Uj(a);
|
||||
break;
|
||||
default:
|
||||
throw Error(y(329));
|
||||
}
|
||||
@ -14903,8 +14873,6 @@
|
||||
fh();
|
||||
break;
|
||||
case 13:
|
||||
H(P);
|
||||
break;
|
||||
case 19:
|
||||
H(P);
|
||||
break;
|
||||
@ -15187,14 +15155,7 @@
|
||||
var Q = Z.ref;
|
||||
if (null !== Q) {
|
||||
var L = Z.stateNode;
|
||||
switch(Z.tag){
|
||||
case 5:
|
||||
q = L;
|
||||
break;
|
||||
default:
|
||||
q = L;
|
||||
}
|
||||
"function" == typeof Q ? Q(q) : Q.current = q;
|
||||
Z.tag, q = L, "function" == typeof Q ? Q(q) : Q.current = q;
|
||||
}
|
||||
}
|
||||
Z = Z.nextEffect;
|
||||
@ -15422,13 +15383,7 @@
|
||||
}, null !== (d = void 0 === d ? null : d) && (b.callback = d), Ag(e, b), Jg(e, g, f), g;
|
||||
}
|
||||
function mk(a) {
|
||||
if (!(a = a.current).child) return null;
|
||||
switch(a.child.tag){
|
||||
case 5:
|
||||
return a.child.stateNode;
|
||||
default:
|
||||
return a.child.stateNode;
|
||||
}
|
||||
return (a = a.current).child ? (a.child.tag, a.child.stateNode) : null;
|
||||
}
|
||||
function nk(a, b) {
|
||||
if (null !== (a = a.memoizedState) && null !== a.dehydrated) {
|
||||
@ -15613,7 +15568,6 @@
|
||||
case 7:
|
||||
return fi(a23, b, b.pendingProps, c), b.child;
|
||||
case 8:
|
||||
return fi(a23, b, b.pendingProps.children, c), b.child;
|
||||
case 12:
|
||||
return fi(a23, b, b.pendingProps.children, c), b.child;
|
||||
case 10:
|
||||
@ -15667,7 +15621,6 @@
|
||||
case 19:
|
||||
return Ai(a23, b, c);
|
||||
case 23:
|
||||
return mi(a23, b, c);
|
||||
case 24:
|
||||
return mi(a23, b, c);
|
||||
}
|
||||
|
@ -156,7 +156,6 @@
|
||||
break;
|
||||
case 92:
|
||||
next1();
|
||||
break;
|
||||
}
|
||||
return position;
|
||||
}
|
||||
@ -571,9 +570,6 @@
|
||||
var previousCursor = cursor, result = interpolation(mergedProps);
|
||||
return cursor = previousCursor, handleInterpolation(mergedProps, registered, result);
|
||||
}
|
||||
break;
|
||||
case 'string':
|
||||
break;
|
||||
}
|
||||
if (null == registered) return interpolation;
|
||||
var cached = registered[interpolation];
|
||||
|
@ -85,9 +85,6 @@ function handleInterpolation(mergedProps, registered, interpolation) {
|
||||
var previousCursor = cursor, result = interpolation(mergedProps);
|
||||
return cursor = previousCursor, handleInterpolation(mergedProps, registered, result);
|
||||
}
|
||||
break;
|
||||
case 'string':
|
||||
break;
|
||||
}
|
||||
if (null == registered) return interpolation;
|
||||
var cached = registered[interpolation];
|
||||
|
@ -1303,7 +1303,6 @@
|
||||
break;
|
||||
case 'second':
|
||||
time = this._d.valueOf(), time += 1000 - (time % (divisor2 = 1000) + divisor2) % divisor2 - 1;
|
||||
break;
|
||||
}
|
||||
return this._d.setTime(time), hooks.updateOffset(this, !0), this;
|
||||
}, proto.format = function(inputString) {
|
||||
@ -1394,7 +1393,6 @@
|
||||
break;
|
||||
case 'second':
|
||||
time = this._d.valueOf(), time -= (time % (divisor4 = 1000) + divisor4) % divisor4;
|
||||
break;
|
||||
}
|
||||
return this._d.setTime(time), hooks.updateOffset(this, !0), this;
|
||||
}, proto.subtract = subtract, proto.toArray = function() {
|
||||
@ -1588,20 +1586,12 @@
|
||||
this._config = config, this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + /\d{1,2}/.source);
|
||||
}, proto$1.eras = function(m, format) {
|
||||
var i, l, date, eras = this._eras || getLocale('en')._eras;
|
||||
for(i = 0, l = eras.length; i < l; ++i){
|
||||
switch(typeof eras[i].since){
|
||||
case 'string':
|
||||
date = hooks(eras[i].since).startOf('day'), eras[i].since = date.valueOf();
|
||||
break;
|
||||
}
|
||||
switch(typeof eras[i].until){
|
||||
for(i = 0, l = eras.length; i < l; ++i)switch('string' == typeof eras[i].since && (date = hooks(eras[i].since).startOf('day'), eras[i].since = date.valueOf()), typeof eras[i].until){
|
||||
case 'undefined':
|
||||
eras[i].until = Infinity;
|
||||
break;
|
||||
case 'string':
|
||||
date = hooks(eras[i].until).startOf('day').valueOf(), eras[i].until = date.valueOf();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return eras;
|
||||
}, proto$1.erasParse = function(eraName, format, strict) {
|
||||
@ -1617,7 +1607,6 @@
|
||||
break;
|
||||
case 'NNNNN':
|
||||
if (narrow === eraName) return eras[i];
|
||||
break;
|
||||
}
|
||||
else if ([
|
||||
name,
|
||||
|
@ -1537,7 +1537,6 @@
|
||||
break;
|
||||
case Rasterizer.CONTOUR_DIR.UNKNOWN_DIR:
|
||||
ctx.strokeStyle = 'green';
|
||||
break;
|
||||
}
|
||||
p = q.firstVertex, ctx.beginPath(), ctx.moveTo(p.x, p.y);
|
||||
do p = p.next, ctx.lineTo(p.x, p.y);
|
||||
@ -4380,7 +4379,6 @@
|
||||
break;
|
||||
case this.STOP_CODE:
|
||||
done = !0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case this.CODE_B:
|
||||
@ -4397,7 +4395,6 @@
|
||||
break;
|
||||
case this.STOP_CODE:
|
||||
done = !0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case this.CODE_C:
|
||||
@ -4411,9 +4408,7 @@
|
||||
break;
|
||||
case this.STOP_CODE:
|
||||
done = !0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else done = !0;
|
||||
unshift && (codeset = codeset === this.CODE_A ? this.CODE_B : this.CODE_A);
|
||||
@ -6867,11 +6862,7 @@
|
||||
}
|
||||
function readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd) {
|
||||
var type = file.getUint16(entryOffset + 2, !bigEnd), numValues = file.getUint32(entryOffset + 4, !bigEnd);
|
||||
switch(type){
|
||||
case 3:
|
||||
if (1 === numValues) return file.getUint16(entryOffset + 8, !bigEnd);
|
||||
}
|
||||
return null;
|
||||
return 3 === type && 1 === numValues ? file.getUint16(entryOffset + 8, !bigEnd) : null;
|
||||
}
|
||||
function getStringFromBuffer(buffer, start, length) {
|
||||
for(var outstr = '', n = start; n < start + length; n++)outstr += String.fromCharCode(buffer.getUint8(n));
|
||||
@ -7151,7 +7142,6 @@
|
||||
break;
|
||||
case 8:
|
||||
drawAngle = -90 * TO_RADIANS;
|
||||
break;
|
||||
}
|
||||
return 0 !== drawAngle ? (_ctx.translate(_canvasSize.x / 2, _canvasSize.y / 2), _ctx.rotate(drawAngle), _ctx.drawImage(drawable, -_canvasSize.y / 2, -_canvasSize.x / 2, _canvasSize.y, _canvasSize.x), _ctx.rotate(-drawAngle), _ctx.translate(-_canvasSize.x / 2, -_canvasSize.y / 2)) : _ctx.drawImage(drawable, 0, 0, _canvasSize.x, _canvasSize.y), ctxData = _ctx.getImageData(_sx, _sy, _size.x, _size.y).data, doHalfSample ? Object(cv_utils.e)(ctxData, _size, _data) : Object(cv_utils.c)(ctxData, _data, _streamConfig), !0;
|
||||
}
|
||||
|
@ -9700,7 +9700,6 @@
|
||||
break;
|
||||
default:
|
||||
i += 3;
|
||||
break;
|
||||
}
|
||||
buffer = buffer.subarray(syncPoint), i -= syncPoint, syncPoint = 0;
|
||||
}, this.reset = function() {
|
||||
@ -9750,7 +9749,6 @@
|
||||
break;
|
||||
case 0x09:
|
||||
event.nalUnitType = 'access_unit_delimiter_rbsp';
|
||||
break;
|
||||
}
|
||||
self.trigger('data', event);
|
||||
}), nalByteStream.on('done', function() {
|
||||
@ -9890,7 +9888,6 @@
|
||||
expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(),
|
||||
expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()
|
||||
];
|
||||
break;
|
||||
}
|
||||
sarRatio && (sarRatio[0], sarRatio[1]);
|
||||
}
|
||||
@ -10345,7 +10342,6 @@
|
||||
break;
|
||||
}
|
||||
result.seiNals.push(seiNal);
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}, parseSamples = function(truns, baseMediaDecodeTime, tfhd) {
|
||||
@ -10649,7 +10645,6 @@
|
||||
break;
|
||||
default:
|
||||
frameI += 3;
|
||||
break;
|
||||
}
|
||||
return frameBuffer = frameBuffer.subarray(frameSyncPoint), frameI -= frameSyncPoint, frameSyncPoint = 0, frameBuffer && frameBuffer.byteLength > 3 && 'slice_layer_without_partitioning_rbsp_idr' === parseNalUnitType(0x1f & frameBuffer[frameSyncPoint + 3]) && (foundKeyFrame = !0), foundKeyFrame;
|
||||
}
|
||||
@ -10666,7 +10661,6 @@
|
||||
pmt.table = pmt.table || {}, Object.keys(table).forEach(function(key) {
|
||||
pmt.table[key] = table[key];
|
||||
});
|
||||
break;
|
||||
}
|
||||
startIndex += MP2T_PACKET_LENGTH, endIndex += MP2T_PACKET_LENGTH;
|
||||
continue;
|
||||
@ -10676,12 +10670,7 @@
|
||||
}, parseAudioPes_ = function(bytes, pmt, result) {
|
||||
for(var packet, pesType, pusi, parsed, startIndex = 0, endIndex = MP2T_PACKET_LENGTH, endLoop = !1; endIndex <= bytes.byteLength;){
|
||||
if (0x47 === bytes[startIndex] && (0x47 === bytes[endIndex] || endIndex === bytes.byteLength)) {
|
||||
switch(packet = bytes.subarray(startIndex, endIndex), probe.ts.parseType(packet, pmt.pid)){
|
||||
case 'pes':
|
||||
pesType = probe.ts.parsePesType(packet, pmt.table), pusi = probe.ts.parsePayloadUnitStartIndicator(packet), 'audio' === pesType && pusi && (parsed = probe.ts.parsePesTime(packet)) && (parsed.type = 'audio', result.audio.push(parsed), endLoop = !0);
|
||||
break;
|
||||
}
|
||||
if (endLoop) break;
|
||||
if (packet = bytes.subarray(startIndex, endIndex), 'pes' === probe.ts.parseType(packet, pmt.pid) && (pesType = probe.ts.parsePesType(packet, pmt.table), pusi = probe.ts.parsePayloadUnitStartIndicator(packet), 'audio' === pesType && pusi && (parsed = probe.ts.parsePesTime(packet)) && (parsed.type = 'audio', result.audio.push(parsed), endLoop = !0)), endLoop) break;
|
||||
startIndex += MP2T_PACKET_LENGTH, endIndex += MP2T_PACKET_LENGTH;
|
||||
continue;
|
||||
}
|
||||
@ -10689,12 +10678,7 @@
|
||||
}
|
||||
for(startIndex = (endIndex = bytes.byteLength) - MP2T_PACKET_LENGTH, endLoop = !1; startIndex >= 0;){
|
||||
if (0x47 === bytes[startIndex] && (0x47 === bytes[endIndex] || endIndex === bytes.byteLength)) {
|
||||
switch(packet = bytes.subarray(startIndex, endIndex), probe.ts.parseType(packet, pmt.pid)){
|
||||
case 'pes':
|
||||
pesType = probe.ts.parsePesType(packet, pmt.table), pusi = probe.ts.parsePayloadUnitStartIndicator(packet), 'audio' === pesType && pusi && (parsed = probe.ts.parsePesTime(packet)) && (parsed.type = 'audio', result.audio.push(parsed), endLoop = !0);
|
||||
break;
|
||||
}
|
||||
if (endLoop) break;
|
||||
if (packet = bytes.subarray(startIndex, endIndex), 'pes' === probe.ts.parseType(packet, pmt.pid) && (pesType = probe.ts.parsePesType(packet, pmt.table), pusi = probe.ts.parsePayloadUnitStartIndicator(packet), 'audio' === pesType && pusi && (parsed = probe.ts.parsePesTime(packet)) && (parsed.type = 'audio', result.audio.push(parsed), endLoop = !0)), endLoop) break;
|
||||
startIndex -= MP2T_PACKET_LENGTH, endIndex -= MP2T_PACKET_LENGTH;
|
||||
continue;
|
||||
}
|
||||
@ -10706,9 +10690,7 @@
|
||||
size: 0
|
||||
}; endIndex < bytes.byteLength;){
|
||||
if (0x47 === bytes[startIndex] && 0x47 === bytes[endIndex]) {
|
||||
switch(packet = bytes.subarray(startIndex, endIndex), probe.ts.parseType(packet, pmt.pid)){
|
||||
case 'pes':
|
||||
if (pesType = probe.ts.parsePesType(packet, pmt.table), pusi = probe.ts.parsePayloadUnitStartIndicator(packet), 'video' === pesType && (pusi && !endLoop && (parsed = probe.ts.parsePesTime(packet)) && (parsed.type = 'video', result.video.push(parsed), endLoop = !0), !result.firstKeyFrame)) {
|
||||
if (packet = bytes.subarray(startIndex, endIndex), 'pes' === probe.ts.parseType(packet, pmt.pid) && (pesType = probe.ts.parsePesType(packet, pmt.table), pusi = probe.ts.parsePayloadUnitStartIndicator(packet), 'video' === pesType && (pusi && !endLoop && (parsed = probe.ts.parsePesTime(packet)) && (parsed.type = 'video', result.video.push(parsed), endLoop = !0), !result.firstKeyFrame))) {
|
||||
if (pusi && 0 !== currentFrame.size) {
|
||||
for(frame = new Uint8Array(currentFrame.size), i = 0; currentFrame.data.length;)pes = currentFrame.data.shift(), frame.set(pes, i), i += pes.byteLength;
|
||||
if (probe.ts.videoPacketContainsKeyFrame(frame)) {
|
||||
@ -10719,8 +10701,6 @@
|
||||
}
|
||||
currentFrame.data.push(packet), currentFrame.size += packet.byteLength;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (endLoop && result.firstKeyFrame) break;
|
||||
startIndex += MP2T_PACKET_LENGTH, endIndex += MP2T_PACKET_LENGTH;
|
||||
continue;
|
||||
@ -10729,12 +10709,7 @@
|
||||
}
|
||||
for(startIndex = (endIndex = bytes.byteLength) - MP2T_PACKET_LENGTH, endLoop = !1; startIndex >= 0;){
|
||||
if (0x47 === bytes[startIndex] && 0x47 === bytes[endIndex]) {
|
||||
switch(packet = bytes.subarray(startIndex, endIndex), probe.ts.parseType(packet, pmt.pid)){
|
||||
case 'pes':
|
||||
pesType = probe.ts.parsePesType(packet, pmt.table), pusi = probe.ts.parsePayloadUnitStartIndicator(packet), 'video' === pesType && pusi && (parsed = probe.ts.parsePesTime(packet)) && (parsed.type = 'video', result.video.push(parsed), endLoop = !0);
|
||||
break;
|
||||
}
|
||||
if (endLoop) break;
|
||||
if (packet = bytes.subarray(startIndex, endIndex), 'pes' === probe.ts.parseType(packet, pmt.pid) && (pesType = probe.ts.parsePesType(packet, pmt.table), pusi = probe.ts.parsePayloadUnitStartIndicator(packet), 'video' === pesType && pusi && (parsed = probe.ts.parsePesTime(packet)) && (parsed.type = 'video', result.video.push(parsed), endLoop = !0)), endLoop) break;
|
||||
startIndex -= MP2T_PACKET_LENGTH, endIndex -= MP2T_PACKET_LENGTH;
|
||||
continue;
|
||||
}
|
||||
@ -10776,7 +10751,6 @@
|
||||
break;
|
||||
default:
|
||||
byteIndex++;
|
||||
break;
|
||||
}
|
||||
if (endLoop) return null;
|
||||
}
|
||||
@ -10809,7 +10783,6 @@
|
||||
break;
|
||||
case streamTypes.ADTS_STREAM_TYPE:
|
||||
result.audio = [], parseAudioPes_(bytes, pmt, result), 0 === result.audio.length && delete result.audio;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -1314,7 +1314,6 @@
|
||||
break;
|
||||
case ATTRIBUTE_NODE:
|
||||
deep = !0;
|
||||
break;
|
||||
}
|
||||
if (node2 || (node2 = node.cloneNode(!1)), node2.ownerDocument = doc, node2.parentNode = null, deep) for(var child = node.firstChild; child;)node2.appendChild(importNode(doc, child, deep)), child = child.nextSibling;
|
||||
return node2;
|
||||
@ -2043,7 +2042,6 @@
|
||||
errorHandler.warning('attribute "' + value1 + '" missed quot(")!!'), addAttribute(attrName, value1, start);
|
||||
case 5:
|
||||
s = 6;
|
||||
break;
|
||||
}
|
||||
else switch(s){
|
||||
case 2:
|
||||
@ -2096,14 +2094,11 @@
|
||||
for(var n in source)target[n] = source[n];
|
||||
}
|
||||
function parseDCC(source, start, domBuilder, errorHandler) {
|
||||
var next = source.charAt(start + 2);
|
||||
switch(next){
|
||||
case '-':
|
||||
if ('-' === source.charAt(start + 2)) {
|
||||
if ('-' !== source.charAt(start + 3)) return -1;
|
||||
var end = source.indexOf('-->', start + 4);
|
||||
if (end > start) return domBuilder.comment(source, start + 4, end - start - 4), end + 3;
|
||||
return errorHandler.error("Unclosed comment"), -1;
|
||||
default:
|
||||
return end > start ? (domBuilder.comment(source, start + 4, end - start - 4), end + 3) : (errorHandler.error("Unclosed comment"), -1);
|
||||
}
|
||||
if ('CDATA[' == source.substr(start + 3, 6)) {
|
||||
var end = source.indexOf(']]>', start + 9);
|
||||
return domBuilder.startCDATA(), domBuilder.characters(source, start + 9, end - start - 9), domBuilder.endCDATA(), end + 3;
|
||||
@ -2115,7 +2110,6 @@
|
||||
var lastMatch = matchs[len - 1];
|
||||
return domBuilder.startDTD(name, pubid, sysid), domBuilder.endDTD(), lastMatch.index + lastMatch[0].length;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
function parseInstruction(source, start, domBuilder) {
|
||||
@ -3625,9 +3619,6 @@
|
||||
case 'urn:mpeg:dash:utc:direct:2012':
|
||||
attributes.method = 'DIRECT', attributes.value = Date.parse(attributes.value);
|
||||
break;
|
||||
case 'urn:mpeg:dash:utc:http-ntp:2014':
|
||||
case 'urn:mpeg:dash:utc:ntp:2014':
|
||||
case 'urn:mpeg:dash:utc:sntp:2014':
|
||||
default:
|
||||
throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME);
|
||||
}
|
||||
@ -3948,7 +3939,6 @@
|
||||
"left",
|
||||
"right"
|
||||
]);
|
||||
break;
|
||||
}
|
||||
}, /:/, /\s/), cue.region = settings.get("region", null), cue.vertical = settings.get("vertical", "");
|
||||
try {
|
||||
@ -4566,7 +4556,6 @@
|
||||
break;
|
||||
case "end":
|
||||
textPos = cue.position - cue.size;
|
||||
break;
|
||||
}
|
||||
"" === cue.vertical ? this.applyStyles({
|
||||
left: this.formatStyle(textPos, "%"),
|
||||
@ -4620,7 +4609,6 @@
|
||||
"-x",
|
||||
"+x"
|
||||
], size = "width";
|
||||
break;
|
||||
}
|
||||
var size, step = boxPosition.lineHeight, position = step * Math.round(linePos), maxPosition = containerBox[size] + step, initialAxis = axis1[0];
|
||||
Math.abs(position) > maxPosition && (position = position < 0 ? -1 : 1, position *= Math.ceil(maxPosition / step) * step), linePos < 0 && (position += "" === cue2.vertical ? containerBox.height : containerBox.width, axis1 = axis1.reverse()), boxPosition.move(initialAxis, position);
|
||||
@ -4632,7 +4620,6 @@
|
||||
break;
|
||||
case "end":
|
||||
linePos -= calculatedPercentage;
|
||||
break;
|
||||
}
|
||||
switch(cue2.vertical){
|
||||
case "":
|
||||
@ -4649,7 +4636,6 @@
|
||||
styleBox.applyStyles({
|
||||
right: styleBox.formatStyle(linePos, "%")
|
||||
});
|
||||
break;
|
||||
}
|
||||
axis1 = [
|
||||
"+y",
|
||||
@ -4687,7 +4673,6 @@
|
||||
break;
|
||||
case "-y":
|
||||
this.top -= toMove, this.bottom -= toMove;
|
||||
break;
|
||||
}
|
||||
}, BoxPosition.prototype.overlaps = function(b2) {
|
||||
return this.left < b2.right && this.right > b2.left && this.top < b2.bottom && this.bottom > b2.top;
|
||||
@ -4774,8 +4759,7 @@
|
||||
}
|
||||
function parseHeader(input3) {
|
||||
input3.match(/X-TIMESTAMP-MAP/) ? parseOptions(input3, function(k1, v1) {
|
||||
switch(k1){
|
||||
case "X-TIMESTAMP-MAP":
|
||||
if ("X-TIMESTAMP-MAP" === k1) {
|
||||
var input, settings;
|
||||
input = v1, settings = new Settings(), parseOptions(input, function(k, v) {
|
||||
switch(k){
|
||||
@ -4784,18 +4768,14 @@
|
||||
break;
|
||||
case "LOCA":
|
||||
settings.set(k + 'L', parseTimeStamp(v));
|
||||
break;
|
||||
}
|
||||
}, /[^\d]:/, /,/), self.ontimestampmap && self.ontimestampmap({
|
||||
MPEGTS: settings.get("MPEGTS"),
|
||||
LOCAL: settings.get("LOCAL")
|
||||
});
|
||||
break;
|
||||
}
|
||||
}, /=/) : parseOptions(input3, function(k2, v2) {
|
||||
switch(k2){
|
||||
case "Region":
|
||||
!function(input) {
|
||||
"Region" === k2 && function(input) {
|
||||
var settings = new Settings();
|
||||
if (parseOptions(input, function(k, v) {
|
||||
switch(k){
|
||||
@ -4820,7 +4800,6 @@
|
||||
settings.alt(k, v, [
|
||||
"up"
|
||||
]);
|
||||
break;
|
||||
}
|
||||
}, /=/, /\s/), settings.has("id")) {
|
||||
var region = new (self.vttjs.VTTRegion || self.window.VTTRegion)();
|
||||
@ -4830,8 +4809,6 @@
|
||||
});
|
||||
}
|
||||
}(v2);
|
||||
break;
|
||||
}
|
||||
}, /:/);
|
||||
}
|
||||
data && (self.buffer += self.decoder.decode(data, {
|
||||
|
@ -442,7 +442,6 @@
|
||||
case e.DOM_DELTA_LINE:
|
||||
case e.DOM_DELTA_PAGE:
|
||||
e.wheelX = 5 * (e.deltaX || 0), e.wheelY = 5 * (e.deltaY || 0);
|
||||
break;
|
||||
}
|
||||
callback(e);
|
||||
}, destroyer) : addListener(el, "DOMMouseScroll", function(e) {
|
||||
@ -915,7 +914,6 @@
|
||||
break;
|
||||
case 88:
|
||||
onCut(e);
|
||||
break;
|
||||
}
|
||||
}, host);
|
||||
var onCompositionUpdate = function() {
|
||||
@ -1328,7 +1326,6 @@
|
||||
break;
|
||||
case "copy":
|
||||
range = editor.moveText(range, dragCursor, !0);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
var dropData = dataTransfer.getData('Text');
|
||||
@ -4515,7 +4512,6 @@
|
||||
case "remove":
|
||||
var endColumn = delta.end.column, endRow = delta.end.row;
|
||||
row === endRow ? docLines[row] = line.substring(0, startColumn) + line.substring(endColumn) : docLines.splice(row, endRow - row + 1, line.substring(0, startColumn) + docLines[endRow].substring(endColumn));
|
||||
break;
|
||||
}
|
||||
};
|
||||
}), ace.define("ace/anchor", [
|
||||
@ -7815,9 +7811,6 @@
|
||||
case "selectionPart":
|
||||
var range = this.selection.getRange(), config = this.renderer.layerConfig;
|
||||
(range.start.row >= config.lastRow || range.end.row <= config.firstRow) && this.renderer.scrollSelectionIntoView(this.selection.anchor, this.selection.lead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
"animate" == scrollIntoView && this.renderer.animateScrolling(this.curOp.scrollTop);
|
||||
}
|
||||
@ -8572,7 +8565,6 @@
|
||||
case ']':
|
||||
case '}':
|
||||
depth[bracketType]--, -1 === depth[bracketType] && (matchType = 'bracket', found = !0);
|
||||
break;
|
||||
}
|
||||
} else -1 !== token.type.indexOf('tag-name') && (isNaN(depth[token.value]) && (depth[token.value] = 0), '<' === prevToken.value ? depth[token.value]++ : '</' === prevToken.value && depth[token.value]--, -1 === depth[token.value] && (matchType = 'tag', found = !0));
|
||||
found || (prevToken = token, token = iterator.stepForward(), i = 0);
|
||||
@ -11131,7 +11123,6 @@ margin: 0 10px;\
|
||||
break;
|
||||
case "log":
|
||||
window.console && console.log && console.log.apply(console, msg.data);
|
||||
break;
|
||||
}
|
||||
}, this.reportError = function(err) {
|
||||
window.console && console.error && console.error(err);
|
||||
|
@ -0,0 +1,80 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('a' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 2,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 2,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('console' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: true,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
switch (a()) {
|
||||
case a():
|
||||
console.log(123);
|
||||
}
|
@ -0,0 +1 @@
|
||||
a() === a() && console.log(123);
|
@ -0,0 +1,42 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('console' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 3,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 3,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: true,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"conditionals": false,
|
||||
"switches": true,
|
||||
"dead_code": true
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
switch (1) {
|
||||
case 2:
|
||||
console.log(111);
|
||||
break;
|
||||
case 3:
|
||||
console.log(222);
|
||||
break;
|
||||
default:
|
||||
console.log(333);
|
||||
}
|
@ -0,0 +1 @@
|
||||
console.log(333);
|
@ -0,0 +1,80 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('a' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('console' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 3,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 3,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: true,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
switch (1) {
|
||||
case a():
|
||||
console.log(111);
|
||||
break;
|
||||
case 1:
|
||||
console.log(222);
|
||||
break;
|
||||
case 2:
|
||||
console.log(333);
|
||||
}
|
@ -0,0 +1 @@
|
||||
1 === a() ? console.log(111) : console.log(222);
|
@ -0,0 +1,80 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('a' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 2,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 2,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('console' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 3,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 3,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: true,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
switch (a) {
|
||||
case 1:
|
||||
console.log(1);
|
||||
break;
|
||||
case 2:
|
||||
console.log(2);
|
||||
break;
|
||||
case a():
|
||||
case 3:
|
||||
console.log(1);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
switch(a){
|
||||
case 1:
|
||||
console.log(1);
|
||||
break;
|
||||
case 2:
|
||||
console.log(2);
|
||||
break;
|
||||
case a():
|
||||
case 3:
|
||||
console.log(1);
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('a' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('console' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 3,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 3,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: true,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
switch (a) {
|
||||
case 1:
|
||||
console.log(1);
|
||||
break;
|
||||
case 2:
|
||||
console.log(2);
|
||||
break;
|
||||
default:
|
||||
console.log(1);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
switch(a){
|
||||
case 1:
|
||||
default:
|
||||
console.log(1);
|
||||
break;
|
||||
case 2:
|
||||
console.log(2);
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1154,7 +1154,6 @@
|
||||
try {
|
||||
(match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue)) && (nName = directiveNormalize(match[1]), addDirective(directives, nName, 'M', maxPriority, ignoreDirective) && (attrs[nName] = trim1(match[2])));
|
||||
} catch (e) {}
|
||||
break;
|
||||
}
|
||||
return directives.sort(byPriority), directives;
|
||||
}
|
||||
@ -3186,13 +3185,8 @@
|
||||
case "string":
|
||||
return comparator(obj, text);
|
||||
case "object":
|
||||
switch(typeof text){
|
||||
case "object":
|
||||
return comparator(obj, text);
|
||||
default:
|
||||
if ("object" == typeof text) return comparator(obj, text);
|
||||
for(var objKey in obj)if ('$' !== objKey.charAt(0) && search(obj[objKey], text)) return !0;
|
||||
break;
|
||||
}
|
||||
return !1;
|
||||
case "array":
|
||||
for(var i = 0; i < obj.length; i++)if (search(obj[i], text)) return !0;
|
||||
|
@ -715,7 +715,6 @@
|
||||
break;
|
||||
default:
|
||||
absStack.push(d);
|
||||
break;
|
||||
}
|
||||
return "/" + absStack.join("/");
|
||||
},
|
||||
@ -2515,7 +2514,6 @@
|
||||
case $.mobile.keyCode.DOWN:
|
||||
case $.mobile.keyCode.LEFT:
|
||||
event.preventDefault(), this._keySliding || (this._keySliding = !0, this.handle.addClass("ui-state-active"));
|
||||
break;
|
||||
}
|
||||
switch(event.keyCode){
|
||||
case $.mobile.keyCode.HOME:
|
||||
@ -2533,7 +2531,6 @@
|
||||
case $.mobile.keyCode.DOWN:
|
||||
case $.mobile.keyCode.LEFT:
|
||||
this.refresh(index - this.step);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -3203,9 +3200,6 @@
|
||||
break;
|
||||
case 4:
|
||||
isNaN(ar[0]) || (tol.t = ar[0]), isNaN(ar[1]) || (tol.r = ar[1]), isNaN(ar[2]) || (tol.b = ar[2]), isNaN(ar[3]) || (tol.l = ar[3]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return this._tolerance = tol, this;
|
||||
},
|
||||
|
@ -968,7 +968,6 @@ Event.Keys = {}, Event.Keys = new Hash(Event.Keys), function() {
|
||||
break;
|
||||
case 'array':
|
||||
object[key] = value.clone();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return object;
|
||||
|
@ -805,7 +805,6 @@
|
||||
break;
|
||||
default:
|
||||
priorityLevel = currentPriorityLevel;
|
||||
break;
|
||||
}
|
||||
var priorityLevel, previousPriorityLevel = currentPriorityLevel;
|
||||
currentPriorityLevel = priorityLevel;
|
||||
@ -834,10 +833,8 @@
|
||||
case 4:
|
||||
timeout = 10000;
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
timeout = 5000;
|
||||
break;
|
||||
}
|
||||
var expirationTime = startTime + timeout, newTask = {
|
||||
id: taskIdCounter++,
|
||||
|
@ -337,10 +337,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
var _assign = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign, REACT_ELEMENT_TYPE = 0xeac7, REACT_PORTAL_TYPE = 0xeaca, REACT_FRAGMENT_TYPE = 0xeacb, REACT_STRICT_MODE_TYPE = 0xeacc, REACT_PROFILER_TYPE = 0xead2, REACT_PROVIDER_TYPE = 0xeacd, REACT_CONTEXT_TYPE = 0xeace, REACT_FORWARD_REF_TYPE = 0xead0, REACT_SUSPENSE_TYPE = 0xead1, REACT_SUSPENSE_LIST_TYPE = 0xead8, REACT_MEMO_TYPE = 0xead3, REACT_LAZY_TYPE = 0xead4, REACT_BLOCK_TYPE = 0xead9, REACT_SCOPE_TYPE = 0xead7, REACT_OPAQUE_ID_TYPE = 0xeae0, REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1, REACT_OFFSCREEN_TYPE = 0xeae2, REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
||||
var _assign = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign, REACT_ELEMENT_TYPE = 0xeac7, REACT_PORTAL_TYPE = 0xeaca, REACT_FRAGMENT_TYPE = 0xeacb, REACT_STRICT_MODE_TYPE = 0xeacc, REACT_PROFILER_TYPE = 0xead2, REACT_PROVIDER_TYPE = 0xeacd, REACT_CONTEXT_TYPE = 0xeace, REACT_FORWARD_REF_TYPE = 0xead0, REACT_SUSPENSE_TYPE = 0xead1, REACT_SUSPENSE_LIST_TYPE = 0xead8, REACT_MEMO_TYPE = 0xead3, REACT_LAZY_TYPE = 0xead4, REACT_BLOCK_TYPE = 0xead9, REACT_OPAQUE_ID_TYPE = 0xeae0, REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1, REACT_OFFSCREEN_TYPE = 0xeae2, REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
||||
if ('function' == typeof Symbol && Symbol.for) {
|
||||
var symbolFor = Symbol.for;
|
||||
REACT_ELEMENT_TYPE = symbolFor('react.element'), REACT_PORTAL_TYPE = symbolFor('react.portal'), REACT_FRAGMENT_TYPE = symbolFor('react.fragment'), REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode'), REACT_PROFILER_TYPE = symbolFor('react.profiler'), REACT_PROVIDER_TYPE = symbolFor('react.provider'), REACT_CONTEXT_TYPE = symbolFor('react.context'), REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref'), REACT_SUSPENSE_TYPE = symbolFor('react.suspense'), REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list'), REACT_MEMO_TYPE = symbolFor('react.memo'), REACT_LAZY_TYPE = symbolFor('react.lazy'), REACT_BLOCK_TYPE = symbolFor('react.block'), symbolFor('react.server.block'), symbolFor('react.fundamental'), REACT_SCOPE_TYPE = symbolFor('react.scope'), REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id'), REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode'), REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen'), REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
||||
REACT_ELEMENT_TYPE = symbolFor('react.element'), REACT_PORTAL_TYPE = symbolFor('react.portal'), REACT_FRAGMENT_TYPE = symbolFor('react.fragment'), REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode'), REACT_PROFILER_TYPE = symbolFor('react.profiler'), REACT_PROVIDER_TYPE = symbolFor('react.provider'), REACT_CONTEXT_TYPE = symbolFor('react.context'), REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref'), REACT_SUSPENSE_TYPE = symbolFor('react.suspense'), REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list'), REACT_MEMO_TYPE = symbolFor('react.memo'), REACT_LAZY_TYPE = symbolFor('react.lazy'), REACT_BLOCK_TYPE = symbolFor('react.block'), symbolFor('react.server.block'), symbolFor('react.fundamental'), symbolFor('react.scope'), REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id'), REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode'), REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen'), REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
||||
}
|
||||
var MAYBE_ITERATOR_SYMBOL = 'function' == typeof Symbol && Symbol.iterator;
|
||||
function getIteratorFn(maybeIterable) {
|
||||
@ -2184,7 +2184,6 @@
|
||||
case 'lostpointercapture':
|
||||
var _pointerId = nativeEvent.pointerId;
|
||||
queuedPointerCaptures.delete(_pointerId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
function accumulateOrCreateContinuousQueuedReplayableEvent(existingQueuedEvent, blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
|
||||
@ -2381,6 +2380,8 @@
|
||||
function findUpdateLane(lanePriority, wipLanes) {
|
||||
switch(lanePriority){
|
||||
case 0:
|
||||
case 6:
|
||||
case 5:
|
||||
break;
|
||||
case 15:
|
||||
return SyncLane;
|
||||
@ -2397,9 +2398,6 @@
|
||||
case 8:
|
||||
var _lane3 = pickArbitraryLane(3584 & ~wipLanes);
|
||||
return _lane3 === NoLane && (_lane3 = pickArbitraryLane(4186112 & ~wipLanes)) === NoLane && (_lane3 = pickArbitraryLane(3584)), _lane3;
|
||||
case 6:
|
||||
case 5:
|
||||
break;
|
||||
case 2:
|
||||
var lane = pickArbitraryLane(805306368 & ~wipLanes);
|
||||
return lane === NoLane && (lane = pickArbitraryLane(805306368)), lane;
|
||||
@ -3249,10 +3247,8 @@
|
||||
case 1:
|
||||
listenerWrapper = dispatchUserBlockingUpdate;
|
||||
break;
|
||||
case 2:
|
||||
default:
|
||||
listenerWrapper = dispatchEvent;
|
||||
break;
|
||||
}
|
||||
return listenerWrapper.bind(null, domEventName, eventSystemFlags, targetContainer);
|
||||
}(targetContainer2, domEventName3, eventSystemFlags2), isPassiveListener = void 0;
|
||||
@ -3386,7 +3382,6 @@
|
||||
case 'pointerover':
|
||||
case 'pointerup':
|
||||
SyntheticEventCtor = SyntheticPointerEvent;
|
||||
break;
|
||||
}
|
||||
var inCapturePhase = (4 & eventSystemFlags) != 0, accumulateTargetOnly = !inCapturePhase && 'scroll' === domEventName, _listeners = accumulateSinglePhaseListeners(targetInst, reactName, nativeEvent.type, inCapturePhase, accumulateTargetOnly);
|
||||
if (_listeners.length > 0) {
|
||||
@ -3513,6 +3508,7 @@
|
||||
}
|
||||
switch(domEventName){
|
||||
case 'paste':
|
||||
default:
|
||||
return null;
|
||||
case 'keypress':
|
||||
if (!(nativeEvent9 = nativeEvent).ctrlKey && !nativeEvent9.altKey && !nativeEvent9.metaKey || nativeEvent9.ctrlKey && nativeEvent9.altKey) {
|
||||
@ -3522,8 +3518,6 @@
|
||||
return null;
|
||||
case 'compositionend':
|
||||
return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}(domEventName10, nativeEvent8))) return null;
|
||||
var chars1, listeners = accumulateTwoPhaseListeners(targetInst, 'onBeforeInput');
|
||||
@ -4893,7 +4887,6 @@
|
||||
break;
|
||||
}
|
||||
error1("Encountered two children with the same key, `%s`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted \u2014 the behavior is unsupported and could change in a future version.", key);
|
||||
break;
|
||||
}
|
||||
return knownKeys;
|
||||
}
|
||||
@ -4906,23 +4899,17 @@
|
||||
return placeSingleChild(function(returnFiber, currentFirstChild, element, lanes) {
|
||||
for(var key = element.key, child = currentFirstChild; null !== child;){
|
||||
if (child.key === key) {
|
||||
switch(child.tag){
|
||||
case 7:
|
||||
if (7 === child.tag) {
|
||||
if (element.type === REACT_FRAGMENT_TYPE) {
|
||||
deleteRemainingChildren(returnFiber, child.sibling);
|
||||
var existing = useFiber(child, element.props.children);
|
||||
return existing.return = returnFiber, existing._debugSource = element._source, existing._debugOwner = element._owner, existing;
|
||||
}
|
||||
break;
|
||||
case 22:
|
||||
default:
|
||||
if (child.elementType === element.type || isCompatibleFamilyForHotReloading(child, element)) {
|
||||
} else if (child.elementType === element.type || isCompatibleFamilyForHotReloading(child, element)) {
|
||||
deleteRemainingChildren(returnFiber, child.sibling);
|
||||
var _existing3 = useFiber(child, element.props);
|
||||
return _existing3.ref = coerceRef(returnFiber, child, element), _existing3.return = returnFiber, _existing3._debugSource = element._source, _existing3._debugOwner = element._owner, _existing3;
|
||||
}
|
||||
break;
|
||||
}
|
||||
deleteRemainingChildren(returnFiber, child);
|
||||
break;
|
||||
}
|
||||
@ -5061,7 +5048,6 @@
|
||||
default:
|
||||
var container = 8 === nodeType ? rootContainerInstance.parentNode : rootContainerInstance;
|
||||
namespace = getChildNamespace(container.namespaceURI || null, type = container.tagName);
|
||||
break;
|
||||
}
|
||||
return {
|
||||
namespace: namespace,
|
||||
@ -5131,7 +5117,6 @@
|
||||
break;
|
||||
case 5:
|
||||
returnFiber.type, parentProps = returnFiber.memoizedProps, parentInstance = returnFiber.stateNode, instance4 = instance, !0 !== parentProps[SUPPRESS_HYDRATION_WARNING$1] && (1 === instance4.nodeType ? warnForDeletedHydratableElement(parentInstance, instance4) : 8 === instance4.nodeType || warnForDeletedHydratableText(parentInstance, instance4));
|
||||
break;
|
||||
}
|
||||
var parentContainer, instance3, parentProps, parentInstance, instance4, childToDelete = createFiberFromHostInstanceForDeletion();
|
||||
childToDelete.stateNode = instance, childToDelete.return = returnFiber, childToDelete.flags = Deletion, null !== returnFiber.lastEffect ? (returnFiber.lastEffect.nextEffect = childToDelete, returnFiber.lastEffect = childToDelete) : returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
|
||||
@ -5147,7 +5132,6 @@
|
||||
break;
|
||||
case 6:
|
||||
warnForInsertedHydratedText(parentContainer, fiber.pendingProps);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
@ -5164,7 +5148,6 @@
|
||||
break;
|
||||
case 13:
|
||||
parentProps[SUPPRESS_HYDRATION_WARNING$1];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -5183,8 +5166,6 @@
|
||||
var instance6, text = fiber.pendingProps, textInstance = (instance6 = nextInstance, '' === text || 3 !== instance6.nodeType ? null : instance6);
|
||||
if (null !== textInstance) return fiber.stateNode = textInstance, !0;
|
||||
return !1;
|
||||
case 13:
|
||||
return !1;
|
||||
default:
|
||||
return !1;
|
||||
}
|
||||
@ -6597,7 +6578,6 @@
|
||||
break;
|
||||
default:
|
||||
error1('"%s" is not a supported revealOrder on <SuspenseList />. Did you mean "together", "forwards" or "backwards"?', revealOrder);
|
||||
break;
|
||||
}
|
||||
else error1('%s is not a supported value for revealOrder on <SuspenseList />. Did you mean "together", "forwards" or "backwards"?', revealOrder);
|
||||
}
|
||||
@ -6916,9 +6896,7 @@
|
||||
case 19:
|
||||
return updateSuspenseListComponent(current13, workInProgress16, renderLanes12);
|
||||
case 20:
|
||||
break;
|
||||
case 21:
|
||||
break;
|
||||
case 22:
|
||||
break;
|
||||
case 23:
|
||||
@ -6943,7 +6921,6 @@
|
||||
case 'collapsed':
|
||||
for(var _tailNode = renderState.tail, _lastTailNode = null; null !== _tailNode;)null !== _tailNode.alternate && (_lastTailNode = _tailNode), _tailNode = _tailNode.sibling;
|
||||
null === _lastTailNode ? hasRenderedATailFallback || null === renderState.tail ? renderState.tail = null : renderState.tail.sibling = null : _lastTailNode.sibling = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
function completeWork(current, workInProgress, renderLanes) {
|
||||
@ -6961,6 +6938,7 @@
|
||||
case 14:
|
||||
return null;
|
||||
case 1:
|
||||
case 17:
|
||||
return isContextProvider(workInProgress.type) && popContext(workInProgress), null;
|
||||
case 3:
|
||||
popHostContainer(workInProgress), popTopLevelContextObject(workInProgress), resetWorkInProgressVersions();
|
||||
@ -7012,18 +6990,14 @@
|
||||
break;
|
||||
case 'textarea':
|
||||
initWrapperState$2(domElement, rawProps), listenToNonDelegatedEvent('invalid', domElement);
|
||||
break;
|
||||
}
|
||||
assertValidProps(tag, rawProps), extraAttributeNames = new Set();
|
||||
for(var attributes = domElement.attributes, _i = 0; _i < attributes.length; _i++){
|
||||
var name = attributes[_i].name.toLowerCase();
|
||||
switch(name){
|
||||
case 'data-reactroot':
|
||||
break;
|
||||
case 'value':
|
||||
break;
|
||||
case 'checked':
|
||||
break;
|
||||
case 'selected':
|
||||
break;
|
||||
default:
|
||||
@ -7085,7 +7059,6 @@
|
||||
break;
|
||||
default:
|
||||
'function' == typeof rawProps.onClick && trapClickOnNonInteractiveElement(domElement);
|
||||
break;
|
||||
}
|
||||
return updatePayload;
|
||||
}(instance, type9, props7, hostContext2.namespace)), fiber.updateQueue = updatePayload1, null !== updatePayload1 && markUpdate(workInProgress);
|
||||
@ -7174,7 +7147,6 @@
|
||||
break;
|
||||
default:
|
||||
'function' == typeof props13.onClick && trapClickOnNonInteractiveElement(domElement3);
|
||||
break;
|
||||
}
|
||||
}(instance7, type10 = type11, props8 = newProps, rootContainerInstance), shouldAutoFocusHostComponent(type10, props8) && markUpdate(workInProgress);
|
||||
}
|
||||
@ -7201,7 +7173,6 @@
|
||||
returnFiber.type;
|
||||
var parentProps, textInstance2, text3, parentProps3 = returnFiber.memoizedProps;
|
||||
returnFiber.stateNode, parentProps = parentProps3, textInstance2 = textInstance1, text3 = textContent, !0 !== parentProps[SUPPRESS_HYDRATION_WARNING$1] && warnForUnmatchedText(textInstance2, text3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return shouldUpdate;
|
||||
@ -7218,8 +7189,6 @@
|
||||
return popHostContainer(workInProgress), updateHostContainer(workInProgress), null === current && listenToAllSupportedEvents(workInProgress.stateNode.containerInfo), null;
|
||||
case 10:
|
||||
return popProvider(workInProgress), null;
|
||||
case 17:
|
||||
return isContextProvider(workInProgress.type) && popContext(workInProgress), null;
|
||||
case 19:
|
||||
popSuspenseContext(workInProgress);
|
||||
var renderState = workInProgress.memoizedState;
|
||||
@ -7265,9 +7234,7 @@
|
||||
}
|
||||
return null;
|
||||
case 20:
|
||||
break;
|
||||
case 21:
|
||||
break;
|
||||
case 22:
|
||||
break;
|
||||
case 23:
|
||||
@ -7327,8 +7294,6 @@
|
||||
popHostContainer(interruptedWork);
|
||||
break;
|
||||
case 13:
|
||||
popSuspenseContext(interruptedWork);
|
||||
break;
|
||||
case 19:
|
||||
popSuspenseContext(interruptedWork);
|
||||
break;
|
||||
@ -7338,7 +7303,6 @@
|
||||
case 23:
|
||||
case 24:
|
||||
popRenderLanes(interruptedWork);
|
||||
break;
|
||||
}
|
||||
}
|
||||
function createCapturedValue(value, source) {
|
||||
@ -7403,7 +7367,6 @@
|
||||
break;
|
||||
default:
|
||||
lastProps = lastRawProps, nextProps = nextRawProps, 'function' != typeof lastProps.onClick && 'function' == typeof nextProps.onClick && trapClickOnNonInteractiveElement(domElement);
|
||||
break;
|
||||
}
|
||||
assertValidProps(tag, nextProps);
|
||||
var styleUpdates1 = null;
|
||||
@ -7541,7 +7504,6 @@
|
||||
enqueueCapturedUpdate(workInProgress, _update2);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
workInProgress = workInProgress.return;
|
||||
}while (null !== workInProgress)
|
||||
@ -7564,6 +7526,10 @@
|
||||
case 11:
|
||||
case 15:
|
||||
case 22:
|
||||
case 5:
|
||||
case 6:
|
||||
case 4:
|
||||
case 17:
|
||||
return;
|
||||
case 1:
|
||||
if (256 & finishedWork.flags && null !== current) {
|
||||
@ -7576,11 +7542,6 @@
|
||||
case 3:
|
||||
256 & finishedWork.flags && clearContainer(finishedWork.stateNode.containerInfo);
|
||||
return;
|
||||
case 5:
|
||||
case 6:
|
||||
case 4:
|
||||
case 17:
|
||||
return;
|
||||
}
|
||||
throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
|
||||
}
|
||||
@ -7633,11 +7594,8 @@
|
||||
var _instance = null;
|
||||
if (null !== finishedWork1.child) switch(finishedWork1.child.tag){
|
||||
case 5:
|
||||
_instance = finishedWork1.child.stateNode;
|
||||
break;
|
||||
case 1:
|
||||
_instance = finishedWork1.child.stateNode;
|
||||
break;
|
||||
}
|
||||
commitUpdateQueue(finishedWork1, _updateQueue, _instance);
|
||||
}
|
||||
@ -7650,8 +7608,13 @@
|
||||
}
|
||||
return;
|
||||
case 6:
|
||||
return;
|
||||
case 4:
|
||||
case 19:
|
||||
case 17:
|
||||
case 20:
|
||||
case 21:
|
||||
case 23:
|
||||
case 24:
|
||||
return;
|
||||
case 12:
|
||||
var _finishedWork$memoize2 = finishedWork1.memoizedProps, onRender = (_finishedWork$memoize2.onCommit, _finishedWork$memoize2.onRender);
|
||||
@ -7662,13 +7625,6 @@
|
||||
case 13:
|
||||
commitSuspenseHydrationCallbacks(finishedRoot, finishedWork1);
|
||||
return;
|
||||
case 19:
|
||||
case 17:
|
||||
case 20:
|
||||
case 21:
|
||||
case 23:
|
||||
case 24:
|
||||
return;
|
||||
}
|
||||
throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
|
||||
}
|
||||
@ -7697,14 +7653,7 @@
|
||||
var ref = finishedWork.ref;
|
||||
if (null !== ref) {
|
||||
var instanceToUse, instance = finishedWork.stateNode;
|
||||
switch(finishedWork.tag){
|
||||
case 5:
|
||||
instanceToUse = instance;
|
||||
break;
|
||||
default:
|
||||
instanceToUse = instance;
|
||||
}
|
||||
'function' == typeof ref ? ref(instanceToUse) : (ref.hasOwnProperty('current') || error1("Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().", getComponentName(finishedWork.type)), ref.current = instanceToUse);
|
||||
instanceToUse = (finishedWork.tag, instance), 'function' == typeof ref ? ref(instanceToUse) : (ref.hasOwnProperty('current') || error1("Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().", getComponentName(finishedWork.type)), ref.current = instanceToUse);
|
||||
}
|
||||
}
|
||||
function commitDetachRef(current) {
|
||||
@ -7748,9 +7697,7 @@
|
||||
unmountHostComponents(finishedRoot, current);
|
||||
return;
|
||||
case 20:
|
||||
return;
|
||||
case 18:
|
||||
return;
|
||||
case 21:
|
||||
return;
|
||||
}
|
||||
@ -7788,12 +7735,9 @@
|
||||
parent1 = parentStateNode, isContainer = !1;
|
||||
break;
|
||||
case 3:
|
||||
parent1 = parentStateNode.containerInfo, isContainer = !0;
|
||||
break;
|
||||
case 4:
|
||||
parent1 = parentStateNode.containerInfo, isContainer = !0;
|
||||
break;
|
||||
case 20:
|
||||
default:
|
||||
throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
|
||||
}
|
||||
@ -7855,8 +7799,6 @@
|
||||
currentParent = parentStateNode, currentParentIsContainer = !1;
|
||||
break findParent;
|
||||
case 3:
|
||||
currentParent = parentStateNode.containerInfo, currentParentIsContainer = !0;
|
||||
break findParent;
|
||||
case 4:
|
||||
currentParent = parentStateNode.containerInfo, currentParentIsContainer = !0;
|
||||
break findParent;
|
||||
@ -7910,6 +7852,8 @@
|
||||
}(3, finishedWork2);
|
||||
return;
|
||||
case 1:
|
||||
case 12:
|
||||
case 17:
|
||||
return;
|
||||
case 5:
|
||||
var instance = finishedWork2.stateNode;
|
||||
@ -7932,7 +7876,6 @@
|
||||
break;
|
||||
case 'select':
|
||||
element = domElement8, props = nextRawProps, wasMultiple = (node = element)._wrapperState.wasMultiple, node._wrapperState.wasMultiple = !!props.multiple, value = props.value, null != value ? updateOptions(node, !!props.multiple, value, !1) : !!props.multiple !== wasMultiple && (null != props.defaultValue ? updateOptions(node, !!props.multiple, props.defaultValue, !0) : updateOptions(node, !!props.multiple, props.multiple ? [] : '', !1));
|
||||
break;
|
||||
}
|
||||
}(domElement6, updatePayload6, type, oldProps, newProps));
|
||||
}
|
||||
@ -7946,18 +7889,13 @@
|
||||
var _root = finishedWork2.stateNode;
|
||||
_root.hydrate && (_root.hydrate = !1, retryIfBlockedOn(_root.containerInfo));
|
||||
return;
|
||||
case 12:
|
||||
return;
|
||||
case 13:
|
||||
commitSuspenseComponent(finishedWork2), attachSuspenseRetryListeners(finishedWork2);
|
||||
return;
|
||||
case 19:
|
||||
attachSuspenseRetryListeners(finishedWork2);
|
||||
return;
|
||||
case 17:
|
||||
return;
|
||||
case 20:
|
||||
break;
|
||||
case 21:
|
||||
break;
|
||||
case 23:
|
||||
@ -8129,6 +8067,7 @@
|
||||
case 1:
|
||||
throw Error("Root did not complete. This is a bug in React.");
|
||||
case 2:
|
||||
case 5:
|
||||
commitRoot(root4);
|
||||
break;
|
||||
case 3:
|
||||
@ -8164,9 +8103,6 @@
|
||||
}
|
||||
commitRoot(root4);
|
||||
break;
|
||||
case 5:
|
||||
commitRoot(root4);
|
||||
break;
|
||||
default:
|
||||
throw Error("Unknown root exit status.");
|
||||
}
|
||||
@ -8526,7 +8462,6 @@
|
||||
break;
|
||||
case Deletion:
|
||||
commitDeletion(root, nextEffect);
|
||||
break;
|
||||
}
|
||||
resetCurrentFiber(), nextEffect = nextEffect.nextEffect;
|
||||
}
|
||||
@ -8725,7 +8660,6 @@
|
||||
break;
|
||||
case 1:
|
||||
didWarnAboutUpdateInRender || (error1("Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state."), didWarnAboutUpdateInRender = !0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
didWarnAboutUpdateInRenderForAnotherComponent = new Set();
|
||||
@ -8897,7 +8831,6 @@
|
||||
break;
|
||||
case 11:
|
||||
candidateType = type.render;
|
||||
break;
|
||||
}
|
||||
if (null === resolveFamily) throw new Error('Expected resolveFamily to be set during hot reload.');
|
||||
var needsRender = !1, needsRemount = !1;
|
||||
@ -8917,7 +8850,6 @@
|
||||
break;
|
||||
case 11:
|
||||
candidateType = type.render;
|
||||
break;
|
||||
}
|
||||
var didMatch = !1;
|
||||
null !== candidateType && types.has(candidateType) && (didMatch = !0), didMatch ? findHostInstancesForFiberShallowly(fiber, hostInstances) : null !== child && findHostInstancesForMatchingFibersRecursively(child, types, hostInstances), null !== sibling && findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances);
|
||||
@ -8929,8 +8861,6 @@
|
||||
hostInstances.add(node.stateNode);
|
||||
return;
|
||||
case 4:
|
||||
hostInstances.add(node.stateNode.containerInfo);
|
||||
return;
|
||||
case 3:
|
||||
hostInstances.add(node.stateNode.containerInfo);
|
||||
return;
|
||||
@ -9010,7 +8940,6 @@
|
||||
break;
|
||||
case 11:
|
||||
workInProgress.type = resolveForwardRefForHotReloading(current.type);
|
||||
break;
|
||||
}
|
||||
return workInProgress;
|
||||
}
|
||||
@ -9051,7 +8980,6 @@
|
||||
return createFiberFromOffscreen(pendingProps, mode, lanes, key);
|
||||
case REACT_LEGACY_HIDDEN_TYPE:
|
||||
return createFiberFromLegacyHidden(pendingProps, mode, lanes, key);
|
||||
case REACT_SCOPE_TYPE:
|
||||
default:
|
||||
if ('object' == typeof type && null !== type) switch(type.$$typeof){
|
||||
case REACT_PROVIDER_TYPE:
|
||||
@ -9144,7 +9072,6 @@
|
||||
break;
|
||||
case 0:
|
||||
this._debugRootType = 'createLegacyRoot()';
|
||||
break;
|
||||
}
|
||||
}
|
||||
function registerMutableSourceForHydration(root, mutableSource) {
|
||||
@ -9175,7 +9102,6 @@
|
||||
return node.stateNode.context;
|
||||
case 1:
|
||||
if (isContextProvider(node.type)) return node.stateNode.__reactInternalMemoizedMergedChildContext;
|
||||
break;
|
||||
}
|
||||
node = node.return;
|
||||
}while (null !== node)
|
||||
@ -9195,13 +9121,7 @@
|
||||
}
|
||||
function getPublicRootInstance(container) {
|
||||
var containerFiber = container.current;
|
||||
if (!containerFiber.child) return null;
|
||||
switch(containerFiber.child.tag){
|
||||
case 5:
|
||||
return containerFiber.child.stateNode;
|
||||
default:
|
||||
return containerFiber.child.stateNode;
|
||||
}
|
||||
return containerFiber.child ? (containerFiber.child.tag, containerFiber.child.stateNode) : null;
|
||||
}
|
||||
function markRetryLaneImpl(fiber, retryLane) {
|
||||
var a, b, suspenseState = fiber.memoizedState;
|
||||
|
@ -7,8 +7,7 @@ def_optimize(AST_Call, function(self, compressor) {
|
||||
}).optimize(compressor);
|
||||
}
|
||||
if (is_undeclared_ref(exp)) exp.name;
|
||||
else if (exp instanceof AST_Dot) switch(exp.property){
|
||||
case "join":
|
||||
else if (exp instanceof AST_Dot && "join" === exp.property) {
|
||||
if (exp.expression instanceof AST_Array) {
|
||||
EXIT: if (!(self.args.length > 0) || (separator = self.args[0].evaluate(compressor)) !== self.args[0]) {
|
||||
for(var separator, first, elements = [], consts = [], i = 0, len = exp.expression.elements.length; i < len; i++){
|
||||
@ -47,7 +46,6 @@ def_optimize(AST_Call, function(self, compressor) {
|
||||
return node.expression = node.expression.clone(), node.expression.expression = node.expression.expression.clone(), node.expression.expression.elements = elements, best_of(compressor, self, node);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,9 +1,4 @@
|
||||
(function (a) {
|
||||
switch (1) {
|
||||
case (a = 1):
|
||||
console.log(a);
|
||||
break;
|
||||
default:
|
||||
console.log(2);
|
||||
}
|
||||
(function(a) {
|
||||
if (1 === (a = 1)) console.log(a);
|
||||
else console.log(2);
|
||||
})(1);
|
||||
|
@ -1,4 +1 @@
|
||||
switch (foo) {
|
||||
case "bar":
|
||||
baz();
|
||||
}
|
||||
if ("bar" === foo) baz();
|
||||
|
@ -0,0 +1,118 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('bar' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('foo' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('moo' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"dead_code": true,
|
||||
"switches": true
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
switch (foo) {
|
||||
case "bar":
|
||||
bar();
|
||||
break;
|
||||
case "moo":
|
||||
case moo:
|
||||
case "baz":
|
||||
break;
|
||||
}
|
@ -0,0 +1 @@
|
||||
if ("bar" === foo) bar();
|
@ -0,0 +1,6 @@
|
||||
switch (foo) {
|
||||
case "bar":
|
||||
bar();
|
||||
case "moo":
|
||||
case moo:
|
||||
}
|
@ -1,4 +1 @@
|
||||
switch (foo) {
|
||||
case "bar":
|
||||
baz();
|
||||
}
|
||||
if ("bar" === foo) baz();
|
||||
|
@ -1,4 +1 @@
|
||||
switch (foo) {
|
||||
case "bar":
|
||||
baz();
|
||||
}
|
||||
if ("bar" === foo) baz();
|
||||
|
@ -0,0 +1,80 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('console' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: true,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('id' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"switches": true,
|
||||
"dead_code": true
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
switch (id(123)) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
default:
|
||||
console.log("PASS");
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
id(123);
|
||||
console.log("PASS");
|
@ -0,0 +1,2 @@
|
||||
id(123);
|
||||
console.log("PASS");
|
@ -0,0 +1,80 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('console' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: true,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('id' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"switches": true,
|
||||
"dead_code": true
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
switch (id(123)) {
|
||||
case 1:
|
||||
"no side effect";
|
||||
case 1:
|
||||
default:
|
||||
console.log("PASS");
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
if (1 === id(123)) "no side effect";
|
||||
console.log("PASS");
|
@ -0,0 +1,2 @@
|
||||
id(123);
|
||||
console.log("PASS");
|
@ -0,0 +1,118 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('bar' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('foo' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('other' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"dead_code": true,
|
||||
"switches": true
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
switch (foo) {
|
||||
case "bar":
|
||||
bar();
|
||||
break;
|
||||
default:
|
||||
other();
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
if ("bar" === foo) bar();
|
||||
else other();
|
@ -0,0 +1,2 @@
|
||||
if ("bar" === foo) bar();
|
||||
else other();
|
@ -0,0 +1,118 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('bar' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('foo' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('other' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"dead_code": true,
|
||||
"switches": true
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
switch (foo) {
|
||||
case "bar":
|
||||
bar();
|
||||
default:
|
||||
other();
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
if ("bar" === foo) bar();
|
||||
other();
|
@ -0,0 +1,2 @@
|
||||
if ("bar" === foo) bar();
|
||||
other();
|
@ -0,0 +1,118 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('bar' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('foo' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('other' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"dead_code": true,
|
||||
"switches": true
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
switch (foo) {
|
||||
default:
|
||||
other();
|
||||
break;
|
||||
case "bar":
|
||||
bar();
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
if ("bar" === foo) bar();
|
||||
else other();
|
@ -0,0 +1,2 @@
|
||||
if ("bar" === foo) bar();
|
||||
else other();
|
@ -0,0 +1,118 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('bar' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('foo' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('other' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"dead_code": true,
|
||||
"switches": true
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
switch (foo) {
|
||||
default:
|
||||
other();
|
||||
case "bar":
|
||||
bar();
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
if ("bar" !== foo) other();
|
||||
bar();
|
@ -0,0 +1,2 @@
|
||||
if ("bar" !== foo) other();
|
||||
bar();
|
@ -0,0 +1,80 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('bar' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 2,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 2,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('other' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"dead_code": true,
|
||||
"switches": true,
|
||||
"evaluate": true
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
switch (1) {
|
||||
case bar:
|
||||
bar();
|
||||
break;
|
||||
case 1:
|
||||
other();
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
if (1 === bar) bar();
|
||||
else other();
|
@ -0,0 +1,5 @@
|
||||
if (1 === bar) bar();
|
||||
else {
|
||||
1;
|
||||
other();
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('bar' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 2,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 2,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('other' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 1,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: true,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: true,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user