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;
|
break;
|
||||||
case "concat":
|
case "concat":
|
||||||
console.log(args.firstArr.concat(args.secondArr));
|
console.log(args.firstArr.concat(args.secondArr));
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
reducer("add", {
|
reducer("add", {
|
||||||
|
@ -12,7 +12,6 @@ var reducer = function(op, args) {
|
|||||||
break;
|
break;
|
||||||
case "concat":
|
case "concat":
|
||||||
console.log(args.firstArr.concat(args.secondArr));
|
console.log(args.firstArr.concat(args.secondArr));
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
reducer("add", {
|
reducer("add", {
|
||||||
|
@ -77,7 +77,6 @@ var TypeScript;
|
|||||||
context.skipNextFuncDeclForClass ? context.skipNextFuncDeclForClass = !1 : (context.scopeGetter = function() {
|
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;
|
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);
|
}, context.scopeStartAST = ast);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
walker.options.goChildren = !0;
|
walker.options.goChildren = !0;
|
||||||
} else walker.options.goChildren = !1;
|
} else walker.options.goChildren = !1;
|
||||||
|
@ -42,7 +42,6 @@ import * as swcHelpers from "@swc/helpers";
|
|||||||
context.skipNextFuncDeclForClass ? context.skipNextFuncDeclForClass = !1 : (context.scopeGetter = function() {
|
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;
|
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);
|
}, context.scopeStartAST = ast);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
walker.options.goChildren = !0;
|
walker.options.goChildren = !0;
|
||||||
} else walker.options.goChildren = !1;
|
} else walker.options.goChildren = !1;
|
||||||
|
@ -246,7 +246,6 @@ var Formatting;
|
|||||||
break;
|
break;
|
||||||
case AuthorTokenKind.atkLBrack:
|
case AuthorTokenKind.atkLBrack:
|
||||||
updateStartOffset = node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkArray;
|
updateStartOffset = node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkArray;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
updateStartOffset && ParseNodeExtensions.SetNodeSpan(node, token.Span.startPosition(), node.AuthorNode.Details.EndOffset);
|
updateStartOffset && ParseNodeExtensions.SetNodeSpan(node, token.Span.startPosition(), node.AuthorNode.Details.EndOffset);
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,6 @@ import * as swcHelpers from "@swc/helpers";
|
|||||||
break;
|
break;
|
||||||
case AuthorTokenKind.atkLBrack:
|
case AuthorTokenKind.atkLBrack:
|
||||||
updateStartOffset = node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkArray;
|
updateStartOffset = node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkArray;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
updateStartOffset && ParseNodeExtensions.SetNodeSpan(node, token.Span.startPosition(), node.AuthorNode.Details.EndOffset);
|
updateStartOffset && ParseNodeExtensions.SetNodeSpan(node, token.Span.startPosition(), node.AuthorNode.Details.EndOffset);
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,4 @@ switch(foo){
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
foo = foo[0];
|
foo = foo[0];
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,4 @@ switch(foo){
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
foo = foo[0];
|
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;
|
M1.fn = fn;
|
||||||
}(M || (M = {})), new class {
|
}(M || (M = {})), new class {
|
||||||
}(), new Object();
|
}(), new Object(), (x)=>''
|
||||||
|
;
|
||||||
|
@ -1,11 +1 @@
|
|||||||
var y;
|
throw void 0;
|
||||||
switch(y){
|
|
||||||
case 'a':
|
|
||||||
throw y;
|
|
||||||
default:
|
|
||||||
throw y;
|
|
||||||
}
|
|
||||||
for(;;)throw 0;
|
|
||||||
for(;;)throw 0;
|
|
||||||
for(var idx in {})throw idx;
|
|
||||||
for(;;)throw null;
|
|
||||||
|
@ -1,20 +1,3 @@
|
|||||||
|
var y;
|
||||||
import * as swcHelpers from "@swc/helpers";
|
import * as swcHelpers from "@swc/helpers";
|
||||||
switch(y){
|
throw 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;
|
|
||||||
}();
|
|
||||||
|
@ -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>,
|
pub cons: Vec<Stmt>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Take for SwitchCase {
|
||||||
|
fn dummy() -> Self {
|
||||||
|
Self {
|
||||||
|
span: DUMMY_SP,
|
||||||
|
test: None,
|
||||||
|
cons: Vec::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[ast_node("CatchClause")]
|
#[ast_node("CatchClause")]
|
||||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
#[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_common::{util::take::Take, EqIgnoreSpan, Spanned, DUMMY_SP};
|
||||||
use swc_ecma_ast::*;
|
use swc_ecma_ast::*;
|
||||||
use swc_ecma_transforms_base::ext::ExprRefExt;
|
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 super::Optimizer;
|
||||||
use crate::{
|
use crate::{
|
||||||
compress::{
|
compress::{optimize::Ctx, util::negate_cost},
|
||||||
optimize::Ctx,
|
|
||||||
util::{always_terminates, negate_cost},
|
|
||||||
},
|
|
||||||
mode::Mode,
|
mode::Mode,
|
||||||
DISABLE_BUGGY_PASSES,
|
DISABLE_BUGGY_PASSES,
|
||||||
};
|
};
|
||||||
@ -701,7 +698,7 @@ where
|
|||||||
cons,
|
cons,
|
||||||
alt: Some(..),
|
alt: Some(..),
|
||||||
..
|
..
|
||||||
})) => always_terminates(cons),
|
})) => cons.terminates(),
|
||||||
_ => false,
|
_ => false,
|
||||||
});
|
});
|
||||||
if !need_work {
|
if !need_work {
|
||||||
@ -720,7 +717,7 @@ where
|
|||||||
cons,
|
cons,
|
||||||
alt: Some(alt),
|
alt: Some(alt),
|
||||||
..
|
..
|
||||||
}) if always_terminates(&cons) => {
|
}) if cons.terminates() => {
|
||||||
new_stmts.push(T::from_stmt(Stmt::If(IfStmt {
|
new_stmts.push(T::from_stmt(Stmt::If(IfStmt {
|
||||||
span,
|
span,
|
||||||
test,
|
test,
|
||||||
|
@ -1,15 +1,10 @@
|
|||||||
use swc_common::{util::take::Take, Spanned, DUMMY_SP};
|
use swc_common::{util::take::Take, Spanned, DUMMY_SP};
|
||||||
use swc_ecma_ast::*;
|
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 swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
|
||||||
|
|
||||||
use super::Optimizer;
|
use super::Optimizer;
|
||||||
use crate::{
|
use crate::{compress::util::is_pure_undefined, debug::dump, mode::Mode, util::ExprOptExt};
|
||||||
compress::util::{always_terminates, is_pure_undefined},
|
|
||||||
debug::dump,
|
|
||||||
mode::Mode,
|
|
||||||
util::ExprOptExt,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Methods related to the option `if_return`. All methods are noop if
|
/// Methods related to the option `if_return`. All methods are noop if
|
||||||
/// `if_return` is false.
|
/// `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 can_merge_as_if_return(s: &Stmt) -> bool {
|
||||||
fn cost(s: &Stmt) -> Option<isize> {
|
fn cost(s: &Stmt) -> Option<isize> {
|
||||||
if let Stmt::Block(..) = s {
|
if let Stmt::Block(..) = s {
|
||||||
if !always_terminates(s) {
|
if !s.terminates() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ use swc_common::{
|
|||||||
};
|
};
|
||||||
use swc_ecma_ast::*;
|
use swc_ecma_ast::*;
|
||||||
use swc_ecma_utils::{
|
use swc_ecma_utils::{
|
||||||
ident::IdentLike, prepend_stmts, undefined, ExprExt, ExprFactory, Id, IsEmpty, ModuleItemLike,
|
extract_var_ids, ident::IdentLike, prepend_stmts, undefined, ExprExt, ExprFactory, Id, IsEmpty,
|
||||||
StmtLike, Type, Value,
|
ModuleItemLike, StmtLike, Type, Value,
|
||||||
};
|
};
|
||||||
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith, VisitWith};
|
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith, VisitWith};
|
||||||
use tracing::{debug, span, Level};
|
use tracing::{debug, span, Level};
|
||||||
@ -133,8 +133,6 @@ struct Ctx {
|
|||||||
/// `true` while handling `expr` of `!expr`
|
/// `true` while handling `expr` of `!expr`
|
||||||
in_bang_arg: bool,
|
in_bang_arg: bool,
|
||||||
in_var_decl_of_for_in_or_of_loop: 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,
|
dont_use_negated_iife: bool,
|
||||||
|
|
||||||
@ -1551,7 +1549,6 @@ where
|
|||||||
#[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
|
#[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
|
||||||
fn visit_mut_block_stmt(&mut self, n: &mut BlockStmt) {
|
fn visit_mut_block_stmt(&mut self, n: &mut BlockStmt) {
|
||||||
let ctx = Ctx {
|
let ctx = Ctx {
|
||||||
stmt_labelled: false,
|
|
||||||
top_level: false,
|
top_level: false,
|
||||||
in_block: true,
|
in_block: true,
|
||||||
scope: n.span.ctxt,
|
scope: n.span.ctxt,
|
||||||
@ -1957,13 +1954,7 @@ where
|
|||||||
|
|
||||||
#[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
|
#[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
|
||||||
fn visit_mut_function(&mut self, n: &mut Function) {
|
fn visit_mut_function(&mut self, n: &mut Function) {
|
||||||
{
|
n.decorators.visit_mut_with(self);
|
||||||
let ctx = Ctx {
|
|
||||||
stmt_labelled: false,
|
|
||||||
..self.ctx
|
|
||||||
};
|
|
||||||
n.decorators.visit_mut_with(&mut *self.with_ctx(ctx));
|
|
||||||
}
|
|
||||||
|
|
||||||
let is_standalone = n.span.has_mark(self.marks.standalone);
|
let is_standalone = n.span.has_mark(self.marks.standalone);
|
||||||
|
|
||||||
@ -1978,7 +1969,6 @@ where
|
|||||||
{
|
{
|
||||||
let ctx = Ctx {
|
let ctx = Ctx {
|
||||||
skip_standalone: self.ctx.skip_standalone || is_standalone,
|
skip_standalone: self.ctx.skip_standalone || is_standalone,
|
||||||
stmt_labelled: false,
|
|
||||||
in_fn_like: true,
|
in_fn_like: true,
|
||||||
scope: n.span.ctxt,
|
scope: n.span.ctxt,
|
||||||
can_inline_arguments: true,
|
can_inline_arguments: true,
|
||||||
@ -2044,13 +2034,9 @@ where
|
|||||||
|
|
||||||
#[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
|
#[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
|
||||||
fn visit_mut_labeled_stmt(&mut self, n: &mut LabeledStmt) {
|
fn visit_mut_labeled_stmt(&mut self, n: &mut LabeledStmt) {
|
||||||
let ctx = Ctx {
|
|
||||||
stmt_labelled: true,
|
|
||||||
..self.ctx
|
|
||||||
};
|
|
||||||
let old_label = self.label.take();
|
let old_label = self.label.take();
|
||||||
self.label = Some(n.label.to_id());
|
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() {
|
if self.label.is_none() {
|
||||||
report_change!("Removing label `{}`", n.label);
|
report_change!("Removing label `{}`", n.label);
|
||||||
@ -2511,6 +2497,77 @@ where
|
|||||||
if cfg!(debug_assertions) {
|
if cfg!(debug_assertions) {
|
||||||
stmts.visit_with(&mut AssertValid);
|
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) {
|
fn visit_mut_str(&mut self, s: &mut Str) {
|
||||||
@ -2540,8 +2597,6 @@ where
|
|||||||
fn visit_mut_switch_stmt(&mut self, n: &mut SwitchStmt) {
|
fn visit_mut_switch_stmt(&mut self, n: &mut SwitchStmt) {
|
||||||
n.discriminant.visit_mut_with(self);
|
n.discriminant.visit_mut_with(self);
|
||||||
|
|
||||||
self.drop_unreachable_cases(n);
|
|
||||||
|
|
||||||
n.cases.visit_mut_with(self);
|
n.cases.visit_mut_with(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
use std::mem::take;
|
use swc_common::{util::take::Take, EqIgnoreSpan, Spanned, DUMMY_SP};
|
||||||
|
|
||||||
use swc_common::{util::take::Take, EqIgnoreSpan, DUMMY_SP};
|
|
||||||
use swc_ecma_ast::*;
|
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 swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
|
||||||
|
|
||||||
use super::Optimizer;
|
use super::Optimizer;
|
||||||
use crate::{mode::Mode, util::ExprOptExt};
|
use crate::{compress::util::is_primitive, mode::Mode};
|
||||||
|
|
||||||
/// Methods related to option `switches`.
|
/// Methods related to option `switches`.
|
||||||
impl<M> Optimizer<'_, M>
|
impl<M> Optimizer<'_, M>
|
||||||
@ -16,171 +14,147 @@ where
|
|||||||
/// Handle switches in the case where we can know which branch will be
|
/// Handle switches in the case where we can know which branch will be
|
||||||
/// taken.
|
/// taken.
|
||||||
pub(super) fn optimize_const_switches(&mut self, s: &mut Stmt) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let (label, stmt) = match s {
|
let stmt = match s {
|
||||||
Stmt::Switch(s) => (None, s),
|
Stmt::Switch(s) => s,
|
||||||
Stmt::Labeled(l) => match &mut *l.body {
|
|
||||||
Stmt::Switch(s) => (Some(l.label.clone()), s),
|
|
||||||
_ => return,
|
|
||||||
},
|
|
||||||
_ => return,
|
_ => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: evaluate
|
||||||
|
fn tail_expr(e: &Expr) -> &Expr {
|
||||||
|
match e {
|
||||||
|
Expr::Seq(s) => s.exprs.last().unwrap(),
|
||||||
|
_ => e,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let discriminant = &mut stmt.discriminant;
|
let discriminant = &mut stmt.discriminant;
|
||||||
if let Expr::Update(..) = &**discriminant {
|
|
||||||
|
let tail = if let Some(e) = is_primitive(tail_expr(discriminant)) {
|
||||||
|
e
|
||||||
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
};
|
||||||
|
|
||||||
if stmt
|
let mut var_ids = vec![];
|
||||||
.cases
|
let mut cases = Vec::new();
|
||||||
.iter()
|
let mut exact = None;
|
||||||
.any(|case| matches!(case.test.as_deref(), Some(Expr::Update(..))))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let matching_case = stmt.cases.iter_mut().position(|case| {
|
for (idx, case) in stmt.cases.iter_mut().enumerate() {
|
||||||
case.test
|
if let Some(test) = case.test.as_ref() {
|
||||||
.as_ref()
|
if let Some(e) = is_primitive(tail_expr(test)) {
|
||||||
.map(|test| discriminant.value_mut().eq_ignore_span(test))
|
if e.eq_ignore_span(tail) {
|
||||||
.unwrap_or(false)
|
cases.push(case.take());
|
||||||
});
|
exact = Some(idx);
|
||||||
|
break;
|
||||||
if let Some(case_idx) = matching_case {
|
} else {
|
||||||
let mut var_ids = vec![];
|
var_ids.extend(case.cons.extract_var_ids())
|
||||||
let mut stmts = vec![];
|
}
|
||||||
|
} else {
|
||||||
let should_preserve_switch = stmt.cases.iter().skip(case_idx).any(|case| {
|
cases.push(case.take())
|
||||||
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");
|
|
||||||
} else {
|
} else {
|
||||||
report_change!("switches: Removing a constant switch");
|
cases.push(case.take())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.changed = true;
|
if let Some(exact) = exact {
|
||||||
let mut preserved = vec![];
|
let exact_case = cases.last_mut().unwrap();
|
||||||
if !should_preserve_switch && !discriminant.is_lit() {
|
let mut terminate = exact_case.cons.terminates();
|
||||||
preserved.push(Stmt::Expr(ExprStmt {
|
for case in stmt.cases[(exact + 1)..].iter_mut() {
|
||||||
span: stmt.span,
|
if terminate {
|
||||||
expr: discriminant.take(),
|
var_ids.extend(case.cons.extract_var_ids())
|
||||||
}));
|
} else {
|
||||||
|
terminate |= case.cons.terminates();
|
||||||
if let Some(expr) = stmt.cases[case_idx].test.take() {
|
exact_case.cons.extend(case.cons.take())
|
||||||
preserved.push(Stmt::Expr(ExprStmt {
|
|
||||||
span: stmt.cases[case_idx].span,
|
|
||||||
expr,
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// remove default if there's an exact match
|
||||||
|
cases.retain(|case| case.test.is_some());
|
||||||
|
|
||||||
for case in &stmt.cases[..case_idx] {
|
if cases.len() == 2 {
|
||||||
for cons in &case.cons {
|
let last = cases.last_mut().unwrap();
|
||||||
var_ids.extend(
|
|
||||||
cons.extract_var_ids()
|
self.changed = true;
|
||||||
.into_iter()
|
report_change!("switches: Turn exact match into default");
|
||||||
.map(|name| VarDeclarator {
|
// so that following pass could turn it into if else
|
||||||
span: DUMMY_SP,
|
if let Some(test) = last.test.take() {
|
||||||
name: Pat::Ident(name.into()),
|
prepend(&mut last.cons, test.into_stmt())
|
||||||
init: None,
|
|
||||||
definite: Default::default(),
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for case in stmt.cases.iter_mut().skip(case_idx) {
|
if cases.len() == stmt.cases.len() {
|
||||||
let mut found_break = false;
|
stmt.cases = cases;
|
||||||
case.cons.retain(|stmt| match stmt {
|
return;
|
||||||
Stmt::Break(BreakStmt { label: None, .. }) => {
|
}
|
||||||
found_break = true;
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Search recursively.
|
self.optimize_switch_cases(&mut cases);
|
||||||
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,
|
|
||||||
});
|
|
||||||
|
|
||||||
for case_stmt in case.cons.take() {
|
let var_ids: Vec<VarDeclarator> = var_ids
|
||||||
match case_stmt {
|
.into_iter()
|
||||||
Stmt::Decl(Decl::Var(v)) if v.decls.iter().all(|v| v.init.is_none()) => {
|
.map(|name| VarDeclarator {
|
||||||
var_ids.extend(v.decls)
|
span: DUMMY_SP,
|
||||||
}
|
name: Pat::Ident(name.into()),
|
||||||
_ => {
|
init: None,
|
||||||
stmts.push(case_stmt);
|
definite: Default::default(),
|
||||||
}
|
})
|
||||||
}
|
.collect();
|
||||||
}
|
|
||||||
if found_break {
|
self.changed = true;
|
||||||
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");
|
||||||
|
|
||||||
|
let mut stmts = Vec::new();
|
||||||
|
|
||||||
if !var_ids.is_empty() {
|
if !var_ids.is_empty() {
|
||||||
prepend(
|
stmts.push(Stmt::Decl(Decl::Var(VarDecl {
|
||||||
&mut stmts,
|
span: DUMMY_SP,
|
||||||
Stmt::Decl(Decl::Var(VarDecl {
|
kind: VarDeclKind::Var,
|
||||||
span: DUMMY_SP,
|
declare: Default::default(),
|
||||||
kind: VarDeclKind::Var,
|
decls: var_ids,
|
||||||
declare: Default::default(),
|
})))
|
||||||
decls: take(&mut var_ids),
|
|
||||||
})),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let inner = if should_preserve_switch {
|
stmts.push(discriminant.take().into_stmt());
|
||||||
let mut cases = stmt.cases.take();
|
let mut last = cases.pop().unwrap();
|
||||||
let case = SwitchCase {
|
remove_last_break(&mut last.cons);
|
||||||
span: cases[case_idx].span,
|
|
||||||
test: cases[case_idx].test.take(),
|
|
||||||
cons: stmts,
|
|
||||||
};
|
|
||||||
|
|
||||||
Stmt::Switch(SwitchStmt {
|
if let Some(test) = last.test {
|
||||||
span: stmt.span,
|
stmts.push(test.into_stmt());
|
||||||
discriminant: stmt.discriminant.take(),
|
}
|
||||||
cases: vec![case],
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
preserved.extend(stmts);
|
|
||||||
Stmt::Block(BlockStmt {
|
|
||||||
span: DUMMY_SP,
|
|
||||||
stmts: preserved,
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
*s = match label {
|
stmts.extend(last.cons);
|
||||||
Some(label) => Stmt::Labeled(LabeledStmt {
|
*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,
|
span: DUMMY_SP,
|
||||||
label,
|
stmts: vec![
|
||||||
body: Box::new(inner),
|
Stmt::Decl(Decl::Var(VarDecl {
|
||||||
}),
|
span: DUMMY_SP,
|
||||||
None => inner,
|
kind: VarDeclKind::Var,
|
||||||
};
|
declare: Default::default(),
|
||||||
|
decls: var_ids,
|
||||||
|
})),
|
||||||
|
s.take(),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,183 +163,345 @@ where
|
|||||||
/// This method will
|
/// This method will
|
||||||
///
|
///
|
||||||
/// - drop the empty cases at the end.
|
/// - 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>) {
|
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;
|
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);
|
self.merge_cases_with_same_cons(cases);
|
||||||
|
|
||||||
let last_non_empty = cases.iter().rposition(|case| {
|
// last case with no empty body
|
||||||
// We should preserve test cases if the test is not a literal.
|
let mut last = cases.len();
|
||||||
match case.test.as_deref() {
|
|
||||||
Some(Expr::Lit(..)) | None => {}
|
|
||||||
_ => return true,
|
|
||||||
}
|
|
||||||
|
|
||||||
if case.cons.is_empty() {
|
for (idx, case) in cases.iter_mut().enumerate().rev() {
|
||||||
return false;
|
self.changed |= remove_last_break(&mut case.cons);
|
||||||
}
|
|
||||||
|
|
||||||
if case.cons.len() == 1 {
|
if !case.cons.is_empty() {
|
||||||
if let Stmt::Break(BreakStmt { label: None, .. }) = case.cons[0] {
|
last = idx + 1;
|
||||||
return false;
|
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(has_side_effect) = has_side_effect {
|
||||||
if let Some(last_non_empty) = last_non_empty {
|
last += has_side_effect + 1
|
||||||
if last_non_empty + 1 != cases.len() {
|
|
||||||
report_change!("switches: Removing empty cases at the end");
|
|
||||||
self.changed = true;
|
|
||||||
cases.drain(last_non_empty + 1..);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(last) = cases.last_mut() {
|
let default = cases.iter().position(|case| case.test.is_none());
|
||||||
if let Some(Stmt::Break(BreakStmt { label: None, .. })) = last.cons.last() {
|
|
||||||
report_change!("switches: Removing `break` at the end");
|
// if default is before empty cases, we must ensure empty case is preserved
|
||||||
self.changed = true;
|
if last < cases.len() && default.map(|idx| idx >= last).unwrap_or(true) {
|
||||||
last.cons.pop();
|
self.changed = true;
|
||||||
|
report_change!("switches: Removing empty cases at the end");
|
||||||
|
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 a case ends with break but content is same with the consecutive case
|
/// If a case ends with break but content is same with the another case
|
||||||
/// except the break statement, we merge them.
|
/// without break case order, except the break statement, we merge
|
||||||
|
/// them.
|
||||||
fn merge_cases_with_same_cons(&mut self, cases: &mut Vec<SwitchCase>) {
|
fn merge_cases_with_same_cons(&mut self, cases: &mut Vec<SwitchCase>) {
|
||||||
let mut stop_pos_opt = cases
|
let mut i = 0;
|
||||||
.iter()
|
let len = cases.len();
|
||||||
.position(|case| matches!(case.test.as_deref(), Some(Expr::Update(..))));
|
|
||||||
|
|
||||||
let mut found = None;
|
// may some smarter person find a better solution
|
||||||
'l: for (li, l) in cases.iter().enumerate().rev() {
|
while i < len {
|
||||||
if l.cons.is_empty() {
|
if cases[i].cons.is_empty() {
|
||||||
|
i += 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
let mut block_start = i + 1;
|
||||||
|
let mut cannot_cross_block = false;
|
||||||
|
|
||||||
if let Some(stop_pos) = stop_pos_opt {
|
for j in (i + 1)..len {
|
||||||
if li == stop_pos {
|
cannot_cross_block |= cases[j]
|
||||||
// Look for next stop position
|
.test
|
||||||
stop_pos_opt = cases
|
.as_deref()
|
||||||
.iter()
|
.map(|test| is_primitive(test).is_none())
|
||||||
.skip(li)
|
.unwrap_or(false)
|
||||||
.position(|case| matches!(case.test.as_deref(), Some(Expr::Update(..))))
|
|| !(cases[j].cons.is_empty()
|
||||||
.map(|v| v + li);
|
|| cases[j].cons.terminates()
|
||||||
continue;
|
|| j == cases.len() - 1);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(l_last) = l.cons.last() {
|
if cases[j].cons.is_empty() {
|
||||||
match l_last {
|
|
||||||
Stmt::Break(BreakStmt { label: None, .. }) => {}
|
|
||||||
_ => continue,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for r in cases.iter().skip(li + 1) {
|
|
||||||
if r.cons.is_empty() {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut r_cons_slice = r.cons.len();
|
if cannot_cross_block && block_start != i + 1 {
|
||||||
|
break;
|
||||||
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]) {
|
block_start = j + 1;
|
||||||
found = Some(li);
|
|
||||||
break 'l;
|
// 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)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if found {
|
||||||
|
self.changed = true;
|
||||||
|
report_change!("switches: Merging cases with same cons");
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(idx) = found {
|
i += 1;
|
||||||
self.changed = true;
|
|
||||||
report_change!("switches: Merging cases with same cons");
|
|
||||||
cases[idx].cons.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove unreachable cases using discriminant.
|
/// Try turn switch into if and remove empty switch
|
||||||
pub(super) fn drop_unreachable_cases(&mut self, s: &mut SwitchStmt) {
|
pub(super) fn optimize_switches(&mut self, s: &mut Stmt) {
|
||||||
if !self.options.switches {
|
if !self.options.switches || !self.options.dead_code {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let dt = s.discriminant.get_type();
|
if let Stmt::Switch(sw) = s {
|
||||||
|
match &mut *sw.cases {
|
||||||
if let Known(Type::Bool) = dt {
|
[] => {
|
||||||
let db = s.discriminant.as_pure_bool();
|
self.changed = true;
|
||||||
|
report_change!("switches: Removing empty switch");
|
||||||
if let Known(db) = db {
|
*s = Stmt::Expr(ExprStmt {
|
||||||
s.cases.retain(|case| match case.test.as_deref() {
|
span: sw.span,
|
||||||
Some(test) => {
|
expr: sw.discriminant.take(),
|
||||||
let tb = test.as_pure_bool();
|
})
|
||||||
!matches!(tb, Known(tb) if db != tb)
|
}
|
||||||
|
[case] => {
|
||||||
|
if contains_nested_break(case) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
None => false,
|
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();
|
||||||
|
|
||||||
|
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,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn optimize_switches(&mut self, _s: &mut Stmt) {
|
fn remove_last_break(stmt: &mut Vec<Stmt>) -> bool {
|
||||||
if !self.options.switches || self.ctx.stmt_labelled {}
|
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)]
|
#[derive(Default)]
|
||||||
struct BreakFinder {
|
struct BreakFinder {
|
||||||
found_unlabelled_break_for_stmt: bool,
|
top_level: bool,
|
||||||
|
nested_unlabelled_break: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Visit for BreakFinder {
|
impl Visit for BreakFinder {
|
||||||
noop_visit_type!();
|
noop_visit_type!();
|
||||||
|
|
||||||
fn visit_break_stmt(&mut self, s: &BreakStmt) {
|
fn visit_break_stmt(&mut self, s: &BreakStmt) {
|
||||||
if s.label.is_none() {
|
if !self.top_level && s.label.is_none() {
|
||||||
self.found_unlabelled_break_for_stmt = true;
|
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) {}
|
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) {}
|
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) {}
|
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) {}
|
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_while_stmt(&mut self, _: &WhileStmt) {}
|
||||||
|
|
||||||
|
fn visit_switch_stmt(&mut self, _: &SwitchStmt) {}
|
||||||
|
|
||||||
fn visit_function(&mut self, _: &Function) {}
|
fn visit_function(&mut self, _: &Function) {}
|
||||||
|
|
||||||
fn visit_arrow_expr(&mut self, _: &ArrowExpr) {}
|
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 swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
|
||||||
|
|
||||||
use super::Pure;
|
use super::Pure;
|
||||||
use crate::{
|
use crate::{compress::util::is_fine_for_if_cons, util::ModuleItemExt};
|
||||||
compress::util::{always_terminates, is_fine_for_if_cons},
|
|
||||||
util::ModuleItemExt,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Methods related to option `dead_code`.
|
/// Methods related to option `dead_code`.
|
||||||
impl Pure<'_> {
|
impl Pure<'_> {
|
||||||
@ -204,7 +201,7 @@ impl Pure<'_> {
|
|||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.find(|(_, stmt)| match stmt.as_stmt() {
|
.find(|(_, stmt)| match stmt.as_stmt() {
|
||||||
Some(s) => always_terminates(s),
|
Some(s) => s.terminates(),
|
||||||
_ => false,
|
_ => 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 {
|
pub(crate) fn is_valid_identifier(s: &str, ascii_only: bool) -> bool {
|
||||||
if ascii_only {
|
if ascii_only {
|
||||||
if s.chars().any(|c| !c.is_ascii()) {
|
if s.chars().any(|c| !c.is_ascii()) {
|
||||||
@ -533,18 +545,6 @@ pub(crate) fn eval_as_number(e: &Expr) -> Option<f64> {
|
|||||||
None
|
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
|
pub(crate) fn is_ident_used_by<N>(id: Id, node: &N) -> bool
|
||||||
where
|
where
|
||||||
N: for<'aa> VisitWith<UsageFinder<'aa>>,
|
N: for<'aa> VisitWith<UsageFinder<'aa>>,
|
||||||
|
@ -254,7 +254,7 @@ pub struct CompressOptions {
|
|||||||
#[serde(alias = "side_effects")]
|
#[serde(alias = "side_effects")]
|
||||||
pub side_effects: bool,
|
pub side_effects: bool,
|
||||||
|
|
||||||
#[serde(default)]
|
#[serde(default = "true_by_default")]
|
||||||
#[serde(alias = "switches")]
|
#[serde(alias = "switches")]
|
||||||
pub switches: bool,
|
pub switches: bool,
|
||||||
|
|
||||||
|
@ -370,8 +370,7 @@ impl TerserCompressorOptions {
|
|||||||
})
|
})
|
||||||
.unwrap_or(if self.defaults { 3 } else { 0 }),
|
.unwrap_or(if self.defaults { 3 } else { 0 }),
|
||||||
side_effects: self.side_effects.unwrap_or(self.defaults),
|
side_effects: self.side_effects.unwrap_or(self.defaults),
|
||||||
// TODO: Use self.defaults
|
switches: self.switches.unwrap_or(self.defaults),
|
||||||
switches: self.switches.unwrap_or(false),
|
|
||||||
top_retain: self.top_retain.map(From::from).unwrap_or_default(),
|
top_retain: self.top_retain.map(From::from).unwrap_or_default(),
|
||||||
top_level: self.toplevel.map(From::from),
|
top_level: self.toplevel.map(From::from),
|
||||||
typeofs: self.typeofs.unwrap_or(self.defaults),
|
typeofs: self.typeofs.unwrap_or(self.defaults),
|
||||||
|
@ -1002,7 +1002,6 @@
|
|||||||
value: value,
|
value: value,
|
||||||
done: !1
|
done: !1
|
||||||
});
|
});
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
(front = front.next) ? resume(front.key, front.arg) : back = null;
|
(front = front.next) ? resume(front.key, front.arg) : back = null;
|
||||||
}
|
}
|
||||||
@ -3478,13 +3477,7 @@
|
|||||||
if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
|
if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
|
||||||
switch(KIND){
|
switch(KIND){
|
||||||
case KEYS:
|
case KEYS:
|
||||||
return function() {
|
|
||||||
return new IteratorConstructor(this, KIND);
|
|
||||||
};
|
|
||||||
case VALUES:
|
case VALUES:
|
||||||
return function() {
|
|
||||||
return new IteratorConstructor(this, KIND);
|
|
||||||
};
|
|
||||||
case ENTRIES:
|
case ENTRIES:
|
||||||
return function() {
|
return function() {
|
||||||
return new IteratorConstructor(this, KIND);
|
return new IteratorConstructor(this, KIND);
|
||||||
@ -8906,7 +8899,6 @@
|
|||||||
break;
|
break;
|
||||||
case FRAGMENT:
|
case FRAGMENT:
|
||||||
chr != EOF && (url.fragment += percentEncode(chr, fragmentPercentEncodeSet));
|
chr != EOF && (url.fragment += percentEncode(chr, fragmentPercentEncodeSet));
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
pointer++;
|
pointer++;
|
||||||
}
|
}
|
||||||
@ -12521,6 +12513,7 @@
|
|||||||
if (ie) return "compositionend" === a || !ae && ge(a, b) ? (a = nd(), md = ld = kd = null, ie = !1, a) : null;
|
if (ie) return "compositionend" === a || !ae && ge(a, b) ? (a = nd(), md = ld = kd = null, ie = !1, a) : null;
|
||||||
switch(a){
|
switch(a){
|
||||||
case "paste":
|
case "paste":
|
||||||
|
default:
|
||||||
return null;
|
return null;
|
||||||
case "keypress":
|
case "keypress":
|
||||||
if (!(b.ctrlKey || b.altKey || b.metaKey) || b.ctrlKey && b.altKey) {
|
if (!(b.ctrlKey || b.altKey || b.metaKey) || b.ctrlKey && b.altKey) {
|
||||||
@ -12530,8 +12523,6 @@
|
|||||||
return null;
|
return null;
|
||||||
case "compositionend":
|
case "compositionend":
|
||||||
return de && "ko" !== b.locale ? null : b.data;
|
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({
|
}(a12, c5)) && 0 < (d = oe(d, "onBeforeInput")).length && (e = new Ld("onBeforeInput", "beforeinput", null, c5, e), g.push({
|
||||||
event: e,
|
event: e,
|
||||||
@ -13092,18 +13083,14 @@
|
|||||||
a: {
|
a: {
|
||||||
for(l2 = f.key, k2 = d; null !== k2;){
|
for(l2 = f.key, k2 = d; null !== k2;){
|
||||||
if (k2.key === l2) {
|
if (k2.key === l2) {
|
||||||
switch(k2.tag){
|
if (7 === k2.tag) {
|
||||||
case 7:
|
if (f.type === ua) {
|
||||||
if (f.type === ua) {
|
c6(a15, k2.sibling), (d = e5(k2, f.props.children)).return = a15, a15 = d;
|
||||||
c6(a15, k2.sibling), (d = e5(k2, f.props.children)).return = a15, a15 = d;
|
break a;
|
||||||
break a;
|
}
|
||||||
}
|
} else if (k2.elementType === f.type) {
|
||||||
break;
|
c6(a15, k2.sibling), (d = e5(k2, f.props)).ref = Qg(a15, k2, f), d.return = a15, a15 = d;
|
||||||
default:
|
break a;
|
||||||
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);
|
c6(a15, k2);
|
||||||
break;
|
break;
|
||||||
@ -13245,8 +13232,6 @@
|
|||||||
return null !== (b = 1 !== b.nodeType || c.toLowerCase() !== b.nodeName.toLowerCase() ? null : b) && (a.stateNode = b, !0);
|
return null !== (b = 1 !== b.nodeType || c.toLowerCase() !== b.nodeName.toLowerCase() ? null : b) && (a.stateNode = b, !0);
|
||||||
case 6:
|
case 6:
|
||||||
return null !== (b = "" === a.pendingProps || 3 !== b.nodeType ? null : b) && (a.stateNode = b, !0);
|
return null !== (b = "" === a.pendingProps || 3 !== b.nodeType ? null : b) && (a.stateNode = b, !0);
|
||||||
case 13:
|
|
||||||
return !1;
|
|
||||||
default:
|
default:
|
||||||
return !1;
|
return !1;
|
||||||
}
|
}
|
||||||
@ -14010,6 +13995,7 @@
|
|||||||
case 14:
|
case 14:
|
||||||
return null;
|
return null;
|
||||||
case 1:
|
case 1:
|
||||||
|
case 17:
|
||||||
return Ff(b.type) && Gf(), null;
|
return Ff(b.type) && Gf(), null;
|
||||||
case 3:
|
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;
|
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;
|
return fh(), Ci(b), null === a && cf(b.stateNode.containerInfo), null;
|
||||||
case 10:
|
case 10:
|
||||||
return rg(b), null;
|
return rg(b), null;
|
||||||
case 17:
|
|
||||||
return Ff(b.type) && Gf(), null;
|
|
||||||
case 19:
|
case 19:
|
||||||
if (H(P), null === (d = b.memoizedState)) return null;
|
if (H(P), null === (d = b.memoizedState)) return null;
|
||||||
if (f = 0 != (64 & b.flags), null === (g = d.rendering)) {
|
if (f = 0 != (64 & b.flags), null === (g = d.rendering)) {
|
||||||
@ -14364,6 +14348,10 @@
|
|||||||
case 11:
|
case 11:
|
||||||
case 15:
|
case 15:
|
||||||
case 22:
|
case 22:
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
|
case 4:
|
||||||
|
case 17:
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
if (256 & b.flags && null !== a) {
|
if (256 & b.flags && null !== a) {
|
||||||
@ -14374,11 +14362,6 @@
|
|||||||
case 3:
|
case 3:
|
||||||
256 & b.flags && qf(b.stateNode.containerInfo);
|
256 & b.flags && qf(b.stateNode.containerInfo);
|
||||||
return;
|
return;
|
||||||
case 5:
|
|
||||||
case 6:
|
|
||||||
case 4:
|
|
||||||
case 17:
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
throw Error(y(163));
|
throw Error(y(163));
|
||||||
}
|
}
|
||||||
@ -14413,8 +14396,6 @@
|
|||||||
if (null !== (b = c.updateQueue)) {
|
if (null !== (b = c.updateQueue)) {
|
||||||
if (a = null, null !== c.child) switch(c.child.tag){
|
if (a = null, null !== c.child) switch(c.child.tag){
|
||||||
case 5:
|
case 5:
|
||||||
a = c.child.stateNode;
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
a = c.child.stateNode;
|
a = c.child.stateNode;
|
||||||
}
|
}
|
||||||
@ -14425,14 +14406,8 @@
|
|||||||
a = c.stateNode, null === b && 4 & c.flags && mf(c.type, c.memoizedProps) && a.focus();
|
a = c.stateNode, null === b && 4 & c.flags && mf(c.type, c.memoizedProps) && a.focus();
|
||||||
return;
|
return;
|
||||||
case 6:
|
case 6:
|
||||||
return;
|
|
||||||
case 4:
|
case 4:
|
||||||
return;
|
|
||||||
case 12:
|
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 19:
|
||||||
case 17:
|
case 17:
|
||||||
case 20:
|
case 20:
|
||||||
@ -14440,6 +14415,9 @@
|
|||||||
case 23:
|
case 23:
|
||||||
case 24:
|
case 24:
|
||||||
return;
|
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));
|
throw Error(y(163));
|
||||||
}
|
}
|
||||||
@ -14529,8 +14507,6 @@
|
|||||||
var d = !1;
|
var d = !1;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
b = b.containerInfo, d = !0;
|
|
||||||
break;
|
|
||||||
case 4:
|
case 4:
|
||||||
b = b.containerInfo, d = !0;
|
b = b.containerInfo, d = !0;
|
||||||
break;
|
break;
|
||||||
@ -14575,8 +14551,6 @@
|
|||||||
f = !1;
|
f = !1;
|
||||||
break a;
|
break a;
|
||||||
case 3:
|
case 3:
|
||||||
e = e.containerInfo, f = !0;
|
|
||||||
break a;
|
|
||||||
case 4:
|
case 4:
|
||||||
e = e.containerInfo, f = !0;
|
e = e.containerInfo, f = !0;
|
||||||
break a;
|
break a;
|
||||||
@ -14628,6 +14602,8 @@
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
|
case 12:
|
||||||
|
case 17:
|
||||||
return;
|
return;
|
||||||
case 5:
|
case 5:
|
||||||
if (null != (c = b.stateNode)) {
|
if (null != (c = b.stateNode)) {
|
||||||
@ -14660,16 +14636,12 @@
|
|||||||
case 3:
|
case 3:
|
||||||
(c = b.stateNode).hydrate && (c.hydrate = !1, Cc(c.containerInfo));
|
(c = b.stateNode).hydrate && (c.hydrate = !1, Cc(c.containerInfo));
|
||||||
return;
|
return;
|
||||||
case 12:
|
|
||||||
return;
|
|
||||||
case 13:
|
case 13:
|
||||||
null !== b.memoizedState && (jj = O(), aj(b.child, !0)), kj(b);
|
null !== b.memoizedState && (jj = O(), aj(b.child, !0)), kj(b);
|
||||||
return;
|
return;
|
||||||
case 19:
|
case 19:
|
||||||
kj(b);
|
kj(b);
|
||||||
return;
|
return;
|
||||||
case 17:
|
|
||||||
return;
|
|
||||||
case 23:
|
case 23:
|
||||||
case 24:
|
case 24:
|
||||||
aj(b, null !== b.memoizedState);
|
aj(b, null !== b.memoizedState);
|
||||||
@ -14810,6 +14782,7 @@
|
|||||||
case 1:
|
case 1:
|
||||||
throw Error(y(345));
|
throw Error(y(345));
|
||||||
case 2:
|
case 2:
|
||||||
|
case 5:
|
||||||
Uj(a);
|
Uj(a);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@ -14836,9 +14809,6 @@
|
|||||||
}
|
}
|
||||||
Uj(a);
|
Uj(a);
|
||||||
break;
|
break;
|
||||||
case 5:
|
|
||||||
Uj(a);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
throw Error(y(329));
|
throw Error(y(329));
|
||||||
}
|
}
|
||||||
@ -14903,8 +14873,6 @@
|
|||||||
fh();
|
fh();
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
H(P);
|
|
||||||
break;
|
|
||||||
case 19:
|
case 19:
|
||||||
H(P);
|
H(P);
|
||||||
break;
|
break;
|
||||||
@ -15187,14 +15155,7 @@
|
|||||||
var Q = Z.ref;
|
var Q = Z.ref;
|
||||||
if (null !== Q) {
|
if (null !== Q) {
|
||||||
var L = Z.stateNode;
|
var L = Z.stateNode;
|
||||||
switch(Z.tag){
|
Z.tag, q = L, "function" == typeof Q ? Q(q) : Q.current = q;
|
||||||
case 5:
|
|
||||||
q = L;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
q = L;
|
|
||||||
}
|
|
||||||
"function" == typeof Q ? Q(q) : Q.current = q;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Z = Z.nextEffect;
|
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;
|
}, null !== (d = void 0 === d ? null : d) && (b.callback = d), Ag(e, b), Jg(e, g, f), g;
|
||||||
}
|
}
|
||||||
function mk(a) {
|
function mk(a) {
|
||||||
if (!(a = a.current).child) return null;
|
return (a = a.current).child ? (a.child.tag, a.child.stateNode) : null;
|
||||||
switch(a.child.tag){
|
|
||||||
case 5:
|
|
||||||
return a.child.stateNode;
|
|
||||||
default:
|
|
||||||
return a.child.stateNode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
function nk(a, b) {
|
function nk(a, b) {
|
||||||
if (null !== (a = a.memoizedState) && null !== a.dehydrated) {
|
if (null !== (a = a.memoizedState) && null !== a.dehydrated) {
|
||||||
@ -15613,7 +15568,6 @@
|
|||||||
case 7:
|
case 7:
|
||||||
return fi(a23, b, b.pendingProps, c), b.child;
|
return fi(a23, b, b.pendingProps, c), b.child;
|
||||||
case 8:
|
case 8:
|
||||||
return fi(a23, b, b.pendingProps.children, c), b.child;
|
|
||||||
case 12:
|
case 12:
|
||||||
return fi(a23, b, b.pendingProps.children, c), b.child;
|
return fi(a23, b, b.pendingProps.children, c), b.child;
|
||||||
case 10:
|
case 10:
|
||||||
@ -15667,7 +15621,6 @@
|
|||||||
case 19:
|
case 19:
|
||||||
return Ai(a23, b, c);
|
return Ai(a23, b, c);
|
||||||
case 23:
|
case 23:
|
||||||
return mi(a23, b, c);
|
|
||||||
case 24:
|
case 24:
|
||||||
return mi(a23, b, c);
|
return mi(a23, b, c);
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,6 @@
|
|||||||
break;
|
break;
|
||||||
case 92:
|
case 92:
|
||||||
next1();
|
next1();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
@ -571,9 +570,6 @@
|
|||||||
var previousCursor = cursor, result = interpolation(mergedProps);
|
var previousCursor = cursor, result = interpolation(mergedProps);
|
||||||
return cursor = previousCursor, handleInterpolation(mergedProps, registered, result);
|
return cursor = previousCursor, handleInterpolation(mergedProps, registered, result);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case 'string':
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (null == registered) return interpolation;
|
if (null == registered) return interpolation;
|
||||||
var cached = registered[interpolation];
|
var cached = registered[interpolation];
|
||||||
|
@ -85,9 +85,6 @@ function handleInterpolation(mergedProps, registered, interpolation) {
|
|||||||
var previousCursor = cursor, result = interpolation(mergedProps);
|
var previousCursor = cursor, result = interpolation(mergedProps);
|
||||||
return cursor = previousCursor, handleInterpolation(mergedProps, registered, result);
|
return cursor = previousCursor, handleInterpolation(mergedProps, registered, result);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case 'string':
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (null == registered) return interpolation;
|
if (null == registered) return interpolation;
|
||||||
var cached = registered[interpolation];
|
var cached = registered[interpolation];
|
||||||
|
@ -1303,7 +1303,6 @@
|
|||||||
break;
|
break;
|
||||||
case 'second':
|
case 'second':
|
||||||
time = this._d.valueOf(), time += 1000 - (time % (divisor2 = 1000) + divisor2) % divisor2 - 1;
|
time = this._d.valueOf(), time += 1000 - (time % (divisor2 = 1000) + divisor2) % divisor2 - 1;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return this._d.setTime(time), hooks.updateOffset(this, !0), this;
|
return this._d.setTime(time), hooks.updateOffset(this, !0), this;
|
||||||
}, proto.format = function(inputString) {
|
}, proto.format = function(inputString) {
|
||||||
@ -1394,7 +1393,6 @@
|
|||||||
break;
|
break;
|
||||||
case 'second':
|
case 'second':
|
||||||
time = this._d.valueOf(), time -= (time % (divisor4 = 1000) + divisor4) % divisor4;
|
time = this._d.valueOf(), time -= (time % (divisor4 = 1000) + divisor4) % divisor4;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return this._d.setTime(time), hooks.updateOffset(this, !0), this;
|
return this._d.setTime(time), hooks.updateOffset(this, !0), this;
|
||||||
}, proto.subtract = subtract, proto.toArray = function() {
|
}, 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);
|
this._config = config, this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + /\d{1,2}/.source);
|
||||||
}, proto$1.eras = function(m, format) {
|
}, proto$1.eras = function(m, format) {
|
||||||
var i, l, date, eras = this._eras || getLocale('en')._eras;
|
var i, l, date, eras = this._eras || getLocale('en')._eras;
|
||||||
for(i = 0, l = eras.length; i < l; ++i){
|
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){
|
||||||
switch(typeof eras[i].since){
|
case 'undefined':
|
||||||
case 'string':
|
eras[i].until = Infinity;
|
||||||
date = hooks(eras[i].since).startOf('day'), eras[i].since = date.valueOf();
|
break;
|
||||||
break;
|
case 'string':
|
||||||
}
|
date = hooks(eras[i].until).startOf('day').valueOf(), eras[i].until = date.valueOf();
|
||||||
switch(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;
|
return eras;
|
||||||
}, proto$1.erasParse = function(eraName, format, strict) {
|
}, proto$1.erasParse = function(eraName, format, strict) {
|
||||||
@ -1617,7 +1607,6 @@
|
|||||||
break;
|
break;
|
||||||
case 'NNNNN':
|
case 'NNNNN':
|
||||||
if (narrow === eraName) return eras[i];
|
if (narrow === eraName) return eras[i];
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else if ([
|
else if ([
|
||||||
name,
|
name,
|
||||||
|
@ -1537,7 +1537,6 @@
|
|||||||
break;
|
break;
|
||||||
case Rasterizer.CONTOUR_DIR.UNKNOWN_DIR:
|
case Rasterizer.CONTOUR_DIR.UNKNOWN_DIR:
|
||||||
ctx.strokeStyle = 'green';
|
ctx.strokeStyle = 'green';
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
p = q.firstVertex, ctx.beginPath(), ctx.moveTo(p.x, p.y);
|
p = q.firstVertex, ctx.beginPath(), ctx.moveTo(p.x, p.y);
|
||||||
do p = p.next, ctx.lineTo(p.x, p.y);
|
do p = p.next, ctx.lineTo(p.x, p.y);
|
||||||
@ -4380,7 +4379,6 @@
|
|||||||
break;
|
break;
|
||||||
case this.STOP_CODE:
|
case this.STOP_CODE:
|
||||||
done = !0;
|
done = !0;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case this.CODE_B:
|
case this.CODE_B:
|
||||||
@ -4397,7 +4395,6 @@
|
|||||||
break;
|
break;
|
||||||
case this.STOP_CODE:
|
case this.STOP_CODE:
|
||||||
done = !0;
|
done = !0;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case this.CODE_C:
|
case this.CODE_C:
|
||||||
@ -4411,9 +4408,7 @@
|
|||||||
break;
|
break;
|
||||||
case this.STOP_CODE:
|
case this.STOP_CODE:
|
||||||
done = !0;
|
done = !0;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else done = !0;
|
else done = !0;
|
||||||
unshift && (codeset = codeset === this.CODE_A ? this.CODE_B : this.CODE_A);
|
unshift && (codeset = codeset === this.CODE_A ? this.CODE_B : this.CODE_A);
|
||||||
@ -6867,11 +6862,7 @@
|
|||||||
}
|
}
|
||||||
function readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd) {
|
function readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd) {
|
||||||
var type = file.getUint16(entryOffset + 2, !bigEnd), numValues = file.getUint32(entryOffset + 4, !bigEnd);
|
var type = file.getUint16(entryOffset + 2, !bigEnd), numValues = file.getUint32(entryOffset + 4, !bigEnd);
|
||||||
switch(type){
|
return 3 === type && 1 === numValues ? file.getUint16(entryOffset + 8, !bigEnd) : null;
|
||||||
case 3:
|
|
||||||
if (1 === numValues) return file.getUint16(entryOffset + 8, !bigEnd);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
function getStringFromBuffer(buffer, start, length) {
|
function getStringFromBuffer(buffer, start, length) {
|
||||||
for(var outstr = '', n = start; n < start + length; n++)outstr += String.fromCharCode(buffer.getUint8(n));
|
for(var outstr = '', n = start; n < start + length; n++)outstr += String.fromCharCode(buffer.getUint8(n));
|
||||||
@ -7151,7 +7142,6 @@
|
|||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
drawAngle = -90 * TO_RADIANS;
|
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;
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
i += 3;
|
i += 3;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
buffer = buffer.subarray(syncPoint), i -= syncPoint, syncPoint = 0;
|
buffer = buffer.subarray(syncPoint), i -= syncPoint, syncPoint = 0;
|
||||||
}, this.reset = function() {
|
}, this.reset = function() {
|
||||||
@ -9750,7 +9749,6 @@
|
|||||||
break;
|
break;
|
||||||
case 0x09:
|
case 0x09:
|
||||||
event.nalUnitType = 'access_unit_delimiter_rbsp';
|
event.nalUnitType = 'access_unit_delimiter_rbsp';
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
self.trigger('data', event);
|
self.trigger('data', event);
|
||||||
}), nalByteStream.on('done', function() {
|
}), nalByteStream.on('done', function() {
|
||||||
@ -9890,7 +9888,6 @@
|
|||||||
expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(),
|
expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(),
|
||||||
expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()
|
expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()
|
||||||
];
|
];
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
sarRatio && (sarRatio[0], sarRatio[1]);
|
sarRatio && (sarRatio[0], sarRatio[1]);
|
||||||
}
|
}
|
||||||
@ -10345,7 +10342,6 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
result.seiNals.push(seiNal);
|
result.seiNals.push(seiNal);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}, parseSamples = function(truns, baseMediaDecodeTime, tfhd) {
|
}, parseSamples = function(truns, baseMediaDecodeTime, tfhd) {
|
||||||
@ -10649,7 +10645,6 @@
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
frameI += 3;
|
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;
|
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 = pmt.table || {}, Object.keys(table).forEach(function(key) {
|
||||||
pmt.table[key] = table[key];
|
pmt.table[key] = table[key];
|
||||||
});
|
});
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
startIndex += MP2T_PACKET_LENGTH, endIndex += MP2T_PACKET_LENGTH;
|
startIndex += MP2T_PACKET_LENGTH, endIndex += MP2T_PACKET_LENGTH;
|
||||||
continue;
|
continue;
|
||||||
@ -10676,12 +10670,7 @@
|
|||||||
}, parseAudioPes_ = function(bytes, pmt, result) {
|
}, parseAudioPes_ = function(bytes, pmt, result) {
|
||||||
for(var packet, pesType, pusi, parsed, startIndex = 0, endIndex = MP2T_PACKET_LENGTH, endLoop = !1; endIndex <= bytes.byteLength;){
|
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)) {
|
if (0x47 === bytes[startIndex] && (0x47 === bytes[endIndex] || endIndex === bytes.byteLength)) {
|
||||||
switch(packet = bytes.subarray(startIndex, endIndex), probe.ts.parseType(packet, pmt.pid)){
|
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;
|
||||||
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;
|
|
||||||
startIndex += MP2T_PACKET_LENGTH, endIndex += MP2T_PACKET_LENGTH;
|
startIndex += MP2T_PACKET_LENGTH, endIndex += MP2T_PACKET_LENGTH;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -10689,12 +10678,7 @@
|
|||||||
}
|
}
|
||||||
for(startIndex = (endIndex = bytes.byteLength) - MP2T_PACKET_LENGTH, endLoop = !1; startIndex >= 0;){
|
for(startIndex = (endIndex = bytes.byteLength) - MP2T_PACKET_LENGTH, endLoop = !1; startIndex >= 0;){
|
||||||
if (0x47 === bytes[startIndex] && (0x47 === bytes[endIndex] || 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)){
|
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;
|
||||||
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;
|
|
||||||
startIndex -= MP2T_PACKET_LENGTH, endIndex -= MP2T_PACKET_LENGTH;
|
startIndex -= MP2T_PACKET_LENGTH, endIndex -= MP2T_PACKET_LENGTH;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -10706,20 +10690,16 @@
|
|||||||
size: 0
|
size: 0
|
||||||
}; endIndex < bytes.byteLength;){
|
}; endIndex < bytes.byteLength;){
|
||||||
if (0x47 === bytes[startIndex] && 0x47 === bytes[endIndex]) {
|
if (0x47 === bytes[startIndex] && 0x47 === bytes[endIndex]) {
|
||||||
switch(packet = bytes.subarray(startIndex, endIndex), probe.ts.parseType(packet, pmt.pid)){
|
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))) {
|
||||||
case 'pes':
|
if (pusi && 0 !== currentFrame.size) {
|
||||||
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)) {
|
for(frame = new Uint8Array(currentFrame.size), i = 0; currentFrame.data.length;)pes = currentFrame.data.shift(), frame.set(pes, i), i += pes.byteLength;
|
||||||
if (pusi && 0 !== currentFrame.size) {
|
if (probe.ts.videoPacketContainsKeyFrame(frame)) {
|
||||||
for(frame = new Uint8Array(currentFrame.size), i = 0; currentFrame.data.length;)pes = currentFrame.data.shift(), frame.set(pes, i), i += pes.byteLength;
|
var firstKeyFrame = probe.ts.parsePesTime(frame);
|
||||||
if (probe.ts.videoPacketContainsKeyFrame(frame)) {
|
firstKeyFrame ? (result.firstKeyFrame = firstKeyFrame, result.firstKeyFrame.type = 'video') : console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.");
|
||||||
var firstKeyFrame = probe.ts.parsePesTime(frame);
|
|
||||||
firstKeyFrame ? (result.firstKeyFrame = firstKeyFrame, result.firstKeyFrame.type = 'video') : console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.");
|
|
||||||
}
|
|
||||||
currentFrame.size = 0;
|
|
||||||
}
|
|
||||||
currentFrame.data.push(packet), currentFrame.size += packet.byteLength;
|
|
||||||
}
|
}
|
||||||
break;
|
currentFrame.size = 0;
|
||||||
|
}
|
||||||
|
currentFrame.data.push(packet), currentFrame.size += packet.byteLength;
|
||||||
}
|
}
|
||||||
if (endLoop && result.firstKeyFrame) break;
|
if (endLoop && result.firstKeyFrame) break;
|
||||||
startIndex += MP2T_PACKET_LENGTH, endIndex += MP2T_PACKET_LENGTH;
|
startIndex += MP2T_PACKET_LENGTH, endIndex += MP2T_PACKET_LENGTH;
|
||||||
@ -10729,12 +10709,7 @@
|
|||||||
}
|
}
|
||||||
for(startIndex = (endIndex = bytes.byteLength) - MP2T_PACKET_LENGTH, endLoop = !1; startIndex >= 0;){
|
for(startIndex = (endIndex = bytes.byteLength) - MP2T_PACKET_LENGTH, endLoop = !1; startIndex >= 0;){
|
||||||
if (0x47 === bytes[startIndex] && 0x47 === bytes[endIndex]) {
|
if (0x47 === bytes[startIndex] && 0x47 === bytes[endIndex]) {
|
||||||
switch(packet = bytes.subarray(startIndex, endIndex), probe.ts.parseType(packet, pmt.pid)){
|
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;
|
||||||
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;
|
|
||||||
startIndex -= MP2T_PACKET_LENGTH, endIndex -= MP2T_PACKET_LENGTH;
|
startIndex -= MP2T_PACKET_LENGTH, endIndex -= MP2T_PACKET_LENGTH;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -10776,7 +10751,6 @@
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
byteIndex++;
|
byteIndex++;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (endLoop) return null;
|
if (endLoop) return null;
|
||||||
}
|
}
|
||||||
@ -10809,7 +10783,6 @@
|
|||||||
break;
|
break;
|
||||||
case streamTypes.ADTS_STREAM_TYPE:
|
case streamTypes.ADTS_STREAM_TYPE:
|
||||||
result.audio = [], parseAudioPes_(bytes, pmt, result), 0 === result.audio.length && delete result.audio;
|
result.audio = [], parseAudioPes_(bytes, pmt, result), 0 === result.audio.length && delete result.audio;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -1314,7 +1314,6 @@
|
|||||||
break;
|
break;
|
||||||
case ATTRIBUTE_NODE:
|
case ATTRIBUTE_NODE:
|
||||||
deep = !0;
|
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;
|
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;
|
return node2;
|
||||||
@ -2043,7 +2042,6 @@
|
|||||||
errorHandler.warning('attribute "' + value1 + '" missed quot(")!!'), addAttribute(attrName, value1, start);
|
errorHandler.warning('attribute "' + value1 + '" missed quot(")!!'), addAttribute(attrName, value1, start);
|
||||||
case 5:
|
case 5:
|
||||||
s = 6;
|
s = 6;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else switch(s){
|
else switch(s){
|
||||||
case 2:
|
case 2:
|
||||||
@ -2096,25 +2094,21 @@
|
|||||||
for(var n in source)target[n] = source[n];
|
for(var n in source)target[n] = source[n];
|
||||||
}
|
}
|
||||||
function parseDCC(source, start, domBuilder, errorHandler) {
|
function parseDCC(source, start, domBuilder, errorHandler) {
|
||||||
var next = source.charAt(start + 2);
|
if ('-' === source.charAt(start + 2)) {
|
||||||
switch(next){
|
if ('-' !== source.charAt(start + 3)) return -1;
|
||||||
case '-':
|
var end = source.indexOf('-->', start + 4);
|
||||||
if ('-' !== source.charAt(start + 3)) return -1;
|
return end > start ? (domBuilder.comment(source, start + 4, end - start - 4), end + 3) : (errorHandler.error("Unclosed comment"), -1);
|
||||||
var end = source.indexOf('-->', start + 4);
|
}
|
||||||
if (end > start) return domBuilder.comment(source, start + 4, end - start - 4), end + 3;
|
if ('CDATA[' == source.substr(start + 3, 6)) {
|
||||||
return errorHandler.error("Unclosed comment"), -1;
|
var end = source.indexOf(']]>', start + 9);
|
||||||
default:
|
return domBuilder.startCDATA(), domBuilder.characters(source, start + 9, end - start - 9), domBuilder.endCDATA(), end + 3;
|
||||||
if ('CDATA[' == source.substr(start + 3, 6)) {
|
}
|
||||||
var end = source.indexOf(']]>', start + 9);
|
var matchs = split(source, start), len = matchs.length;
|
||||||
return domBuilder.startCDATA(), domBuilder.characters(source, start + 9, end - start - 9), domBuilder.endCDATA(), end + 3;
|
if (len > 1 && /!doctype/i.test(matchs[0][0])) {
|
||||||
}
|
var name = matchs[1][0], pubid = !1, sysid = !1;
|
||||||
var matchs = split(source, start), len = matchs.length;
|
len > 3 && (/^public$/i.test(matchs[2][0]) ? (pubid = matchs[3][0], sysid = len > 4 && matchs[4][0]) : /^system$/i.test(matchs[2][0]) && (sysid = matchs[3][0]));
|
||||||
if (len > 1 && /!doctype/i.test(matchs[0][0])) {
|
var lastMatch = matchs[len - 1];
|
||||||
var name = matchs[1][0], pubid = !1, sysid = !1;
|
return domBuilder.startDTD(name, pubid, sysid), domBuilder.endDTD(), lastMatch.index + lastMatch[0].length;
|
||||||
len > 3 && (/^public$/i.test(matchs[2][0]) ? (pubid = matchs[3][0], sysid = len > 4 && matchs[4][0]) : /^system$/i.test(matchs[2][0]) && (sysid = matchs[3][0]));
|
|
||||||
var lastMatch = matchs[len - 1];
|
|
||||||
return domBuilder.startDTD(name, pubid, sysid), domBuilder.endDTD(), lastMatch.index + lastMatch[0].length;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -3625,9 +3619,6 @@
|
|||||||
case 'urn:mpeg:dash:utc:direct:2012':
|
case 'urn:mpeg:dash:utc:direct:2012':
|
||||||
attributes.method = 'DIRECT', attributes.value = Date.parse(attributes.value);
|
attributes.method = 'DIRECT', attributes.value = Date.parse(attributes.value);
|
||||||
break;
|
break;
|
||||||
case 'urn:mpeg:dash:utc:http-ntp:2014':
|
|
||||||
case 'urn:mpeg:dash:utc:ntp:2014':
|
|
||||||
case 'urn:mpeg:dash:utc:sntp:2014':
|
|
||||||
default:
|
default:
|
||||||
throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME);
|
throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME);
|
||||||
}
|
}
|
||||||
@ -3948,7 +3939,6 @@
|
|||||||
"left",
|
"left",
|
||||||
"right"
|
"right"
|
||||||
]);
|
]);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}, /:/, /\s/), cue.region = settings.get("region", null), cue.vertical = settings.get("vertical", "");
|
}, /:/, /\s/), cue.region = settings.get("region", null), cue.vertical = settings.get("vertical", "");
|
||||||
try {
|
try {
|
||||||
@ -4566,7 +4556,6 @@
|
|||||||
break;
|
break;
|
||||||
case "end":
|
case "end":
|
||||||
textPos = cue.position - cue.size;
|
textPos = cue.position - cue.size;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
"" === cue.vertical ? this.applyStyles({
|
"" === cue.vertical ? this.applyStyles({
|
||||||
left: this.formatStyle(textPos, "%"),
|
left: this.formatStyle(textPos, "%"),
|
||||||
@ -4620,7 +4609,6 @@
|
|||||||
"-x",
|
"-x",
|
||||||
"+x"
|
"+x"
|
||||||
], size = "width";
|
], size = "width";
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
var size, step = boxPosition.lineHeight, position = step * Math.round(linePos), maxPosition = containerBox[size] + step, initialAxis = axis1[0];
|
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);
|
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;
|
break;
|
||||||
case "end":
|
case "end":
|
||||||
linePos -= calculatedPercentage;
|
linePos -= calculatedPercentage;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
switch(cue2.vertical){
|
switch(cue2.vertical){
|
||||||
case "":
|
case "":
|
||||||
@ -4649,7 +4636,6 @@
|
|||||||
styleBox.applyStyles({
|
styleBox.applyStyles({
|
||||||
right: styleBox.formatStyle(linePos, "%")
|
right: styleBox.formatStyle(linePos, "%")
|
||||||
});
|
});
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
axis1 = [
|
axis1 = [
|
||||||
"+y",
|
"+y",
|
||||||
@ -4687,7 +4673,6 @@
|
|||||||
break;
|
break;
|
||||||
case "-y":
|
case "-y":
|
||||||
this.top -= toMove, this.bottom -= toMove;
|
this.top -= toMove, this.bottom -= toMove;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}, BoxPosition.prototype.overlaps = function(b2) {
|
}, BoxPosition.prototype.overlaps = function(b2) {
|
||||||
return this.left < b2.right && this.right > b2.left && this.top < b2.bottom && this.bottom > b2.top;
|
return this.left < b2.right && this.right > b2.left && this.top < b2.bottom && this.bottom > b2.top;
|
||||||
@ -4774,64 +4759,56 @@
|
|||||||
}
|
}
|
||||||
function parseHeader(input3) {
|
function parseHeader(input3) {
|
||||||
input3.match(/X-TIMESTAMP-MAP/) ? parseOptions(input3, function(k1, v1) {
|
input3.match(/X-TIMESTAMP-MAP/) ? parseOptions(input3, function(k1, v1) {
|
||||||
switch(k1){
|
if ("X-TIMESTAMP-MAP" === k1) {
|
||||||
case "X-TIMESTAMP-MAP":
|
var input, settings;
|
||||||
var input, settings;
|
input = v1, settings = new Settings(), parseOptions(input, function(k, v) {
|
||||||
input = v1, settings = new Settings(), parseOptions(input, function(k, v) {
|
switch(k){
|
||||||
switch(k){
|
case "MPEGT":
|
||||||
case "MPEGT":
|
settings.integer(k + 'S', v);
|
||||||
settings.integer(k + 'S', v);
|
break;
|
||||||
break;
|
case "LOCA":
|
||||||
case "LOCA":
|
settings.set(k + 'L', parseTimeStamp(v));
|
||||||
settings.set(k + 'L', parseTimeStamp(v));
|
}
|
||||||
break;
|
}, /[^\d]:/, /,/), self.ontimestampmap && self.ontimestampmap({
|
||||||
}
|
MPEGTS: settings.get("MPEGTS"),
|
||||||
}, /[^\d]:/, /,/), self.ontimestampmap && self.ontimestampmap({
|
LOCAL: settings.get("LOCAL")
|
||||||
MPEGTS: settings.get("MPEGTS"),
|
});
|
||||||
LOCAL: settings.get("LOCAL")
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}, /=/) : parseOptions(input3, function(k2, v2) {
|
}, /=/) : parseOptions(input3, function(k2, v2) {
|
||||||
switch(k2){
|
"Region" === k2 && function(input) {
|
||||||
case "Region":
|
var settings = new Settings();
|
||||||
!function(input) {
|
if (parseOptions(input, function(k, v) {
|
||||||
var settings = new Settings();
|
switch(k){
|
||||||
if (parseOptions(input, function(k, v) {
|
case "id":
|
||||||
switch(k){
|
settings.set(k, v);
|
||||||
case "id":
|
break;
|
||||||
settings.set(k, v);
|
case "width":
|
||||||
break;
|
settings.percent(k, v);
|
||||||
case "width":
|
break;
|
||||||
settings.percent(k, v);
|
case "lines":
|
||||||
break;
|
settings.integer(k, v);
|
||||||
case "lines":
|
break;
|
||||||
settings.integer(k, v);
|
case "regionanchor":
|
||||||
break;
|
case "viewportanchor":
|
||||||
case "regionanchor":
|
var xy = v.split(',');
|
||||||
case "viewportanchor":
|
if (2 !== xy.length) break;
|
||||||
var xy = v.split(',');
|
var anchor = new Settings();
|
||||||
if (2 !== xy.length) break;
|
if (anchor.percent("x", xy[0]), anchor.percent("y", xy[1]), !anchor.has("x") || !anchor.has("y")) break;
|
||||||
var anchor = new Settings();
|
settings.set(k + "X", anchor.get("x")), settings.set(k + "Y", anchor.get("y"));
|
||||||
if (anchor.percent("x", xy[0]), anchor.percent("y", xy[1]), !anchor.has("x") || !anchor.has("y")) break;
|
break;
|
||||||
settings.set(k + "X", anchor.get("x")), settings.set(k + "Y", anchor.get("y"));
|
case "scroll":
|
||||||
break;
|
settings.alt(k, v, [
|
||||||
case "scroll":
|
"up"
|
||||||
settings.alt(k, v, [
|
]);
|
||||||
"up"
|
}
|
||||||
]);
|
}, /=/, /\s/), settings.has("id")) {
|
||||||
break;
|
var region = new (self.vttjs.VTTRegion || self.window.VTTRegion)();
|
||||||
}
|
region.width = settings.get("width", 100), region.lines = settings.get("lines", 3), region.regionAnchorX = settings.get("regionanchorX", 0), region.regionAnchorY = settings.get("regionanchorY", 100), region.viewportAnchorX = settings.get("viewportanchorX", 0), region.viewportAnchorY = settings.get("viewportanchorY", 100), region.scroll = settings.get("scroll", ""), self.onregion && self.onregion(region), self.regionList.push({
|
||||||
}, /=/, /\s/), settings.has("id")) {
|
id: settings.get("id"),
|
||||||
var region = new (self.vttjs.VTTRegion || self.window.VTTRegion)();
|
region: region
|
||||||
region.width = settings.get("width", 100), region.lines = settings.get("lines", 3), region.regionAnchorX = settings.get("regionanchorX", 0), region.regionAnchorY = settings.get("regionanchorY", 100), region.viewportAnchorX = settings.get("viewportanchorX", 0), region.viewportAnchorY = settings.get("viewportanchorY", 100), region.scroll = settings.get("scroll", ""), self.onregion && self.onregion(region), self.regionList.push({
|
});
|
||||||
id: settings.get("id"),
|
}
|
||||||
region: region
|
}(v2);
|
||||||
});
|
|
||||||
}
|
|
||||||
}(v2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}, /:/);
|
}, /:/);
|
||||||
}
|
}
|
||||||
data && (self.buffer += self.decoder.decode(data, {
|
data && (self.buffer += self.decoder.decode(data, {
|
||||||
|
@ -442,7 +442,6 @@
|
|||||||
case e.DOM_DELTA_LINE:
|
case e.DOM_DELTA_LINE:
|
||||||
case e.DOM_DELTA_PAGE:
|
case e.DOM_DELTA_PAGE:
|
||||||
e.wheelX = 5 * (e.deltaX || 0), e.wheelY = 5 * (e.deltaY || 0);
|
e.wheelX = 5 * (e.deltaX || 0), e.wheelY = 5 * (e.deltaY || 0);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
callback(e);
|
callback(e);
|
||||||
}, destroyer) : addListener(el, "DOMMouseScroll", function(e) {
|
}, destroyer) : addListener(el, "DOMMouseScroll", function(e) {
|
||||||
@ -915,7 +914,6 @@
|
|||||||
break;
|
break;
|
||||||
case 88:
|
case 88:
|
||||||
onCut(e);
|
onCut(e);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}, host);
|
}, host);
|
||||||
var onCompositionUpdate = function() {
|
var onCompositionUpdate = function() {
|
||||||
@ -1328,7 +1326,6 @@
|
|||||||
break;
|
break;
|
||||||
case "copy":
|
case "copy":
|
||||||
range = editor.moveText(range, dragCursor, !0);
|
range = editor.moveText(range, dragCursor, !0);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var dropData = dataTransfer.getData('Text');
|
var dropData = dataTransfer.getData('Text');
|
||||||
@ -4515,7 +4512,6 @@
|
|||||||
case "remove":
|
case "remove":
|
||||||
var endColumn = delta.end.column, endRow = delta.end.row;
|
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));
|
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", [
|
}), ace.define("ace/anchor", [
|
||||||
@ -7815,9 +7811,6 @@
|
|||||||
case "selectionPart":
|
case "selectionPart":
|
||||||
var range = this.selection.getRange(), config = this.renderer.layerConfig;
|
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);
|
(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);
|
"animate" == scrollIntoView && this.renderer.animateScrolling(this.curOp.scrollTop);
|
||||||
}
|
}
|
||||||
@ -8572,7 +8565,6 @@
|
|||||||
case ']':
|
case ']':
|
||||||
case '}':
|
case '}':
|
||||||
depth[bracketType]--, -1 === depth[bracketType] && (matchType = 'bracket', found = !0);
|
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));
|
} 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);
|
found || (prevToken = token, token = iterator.stepForward(), i = 0);
|
||||||
@ -11131,7 +11123,6 @@ margin: 0 10px;\
|
|||||||
break;
|
break;
|
||||||
case "log":
|
case "log":
|
||||||
window.console && console.log && console.log.apply(console, msg.data);
|
window.console && console.log && console.log.apply(console, msg.data);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}, this.reportError = function(err) {
|
}, this.reportError = function(err) {
|
||||||
window.console && console.error && console.error(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 {
|
try {
|
||||||
(match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue)) && (nName = directiveNormalize(match[1]), addDirective(directives, nName, 'M', maxPriority, ignoreDirective) && (attrs[nName] = trim1(match[2])));
|
(match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue)) && (nName = directiveNormalize(match[1]), addDirective(directives, nName, 'M', maxPriority, ignoreDirective) && (attrs[nName] = trim1(match[2])));
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return directives.sort(byPriority), directives;
|
return directives.sort(byPriority), directives;
|
||||||
}
|
}
|
||||||
@ -3186,13 +3185,8 @@
|
|||||||
case "string":
|
case "string":
|
||||||
return comparator(obj, text);
|
return comparator(obj, text);
|
||||||
case "object":
|
case "object":
|
||||||
switch(typeof text){
|
if ("object" == typeof text) return comparator(obj, text);
|
||||||
case "object":
|
for(var objKey in obj)if ('$' !== objKey.charAt(0) && search(obj[objKey], text)) return !0;
|
||||||
return comparator(obj, text);
|
|
||||||
default:
|
|
||||||
for(var objKey in obj)if ('$' !== objKey.charAt(0) && search(obj[objKey], text)) return !0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return !1;
|
return !1;
|
||||||
case "array":
|
case "array":
|
||||||
for(var i = 0; i < obj.length; i++)if (search(obj[i], text)) return !0;
|
for(var i = 0; i < obj.length; i++)if (search(obj[i], text)) return !0;
|
||||||
|
@ -715,7 +715,6 @@
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
absStack.push(d);
|
absStack.push(d);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return "/" + absStack.join("/");
|
return "/" + absStack.join("/");
|
||||||
},
|
},
|
||||||
@ -2515,7 +2514,6 @@
|
|||||||
case $.mobile.keyCode.DOWN:
|
case $.mobile.keyCode.DOWN:
|
||||||
case $.mobile.keyCode.LEFT:
|
case $.mobile.keyCode.LEFT:
|
||||||
event.preventDefault(), this._keySliding || (this._keySliding = !0, this.handle.addClass("ui-state-active"));
|
event.preventDefault(), this._keySliding || (this._keySliding = !0, this.handle.addClass("ui-state-active"));
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
switch(event.keyCode){
|
switch(event.keyCode){
|
||||||
case $.mobile.keyCode.HOME:
|
case $.mobile.keyCode.HOME:
|
||||||
@ -2533,7 +2531,6 @@
|
|||||||
case $.mobile.keyCode.DOWN:
|
case $.mobile.keyCode.DOWN:
|
||||||
case $.mobile.keyCode.LEFT:
|
case $.mobile.keyCode.LEFT:
|
||||||
this.refresh(index - this.step);
|
this.refresh(index - this.step);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -3203,9 +3200,6 @@
|
|||||||
break;
|
break;
|
||||||
case 4:
|
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]);
|
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;
|
return this._tolerance = tol, this;
|
||||||
},
|
},
|
||||||
|
@ -968,7 +968,6 @@ Event.Keys = {}, Event.Keys = new Hash(Event.Keys), function() {
|
|||||||
break;
|
break;
|
||||||
case 'array':
|
case 'array':
|
||||||
object[key] = value.clone();
|
object[key] = value.clone();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
|
@ -805,7 +805,6 @@
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
priorityLevel = currentPriorityLevel;
|
priorityLevel = currentPriorityLevel;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
var priorityLevel, previousPriorityLevel = currentPriorityLevel;
|
var priorityLevel, previousPriorityLevel = currentPriorityLevel;
|
||||||
currentPriorityLevel = priorityLevel;
|
currentPriorityLevel = priorityLevel;
|
||||||
@ -834,10 +833,8 @@
|
|||||||
case 4:
|
case 4:
|
||||||
timeout = 10000;
|
timeout = 10000;
|
||||||
break;
|
break;
|
||||||
case 3:
|
|
||||||
default:
|
default:
|
||||||
timeout = 5000;
|
timeout = 5000;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
var expirationTime = startTime + timeout, newTask = {
|
var expirationTime = startTime + timeout, newTask = {
|
||||||
id: taskIdCounter++,
|
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) {
|
if ('function' == typeof Symbol && Symbol.for) {
|
||||||
var symbolFor = 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;
|
var MAYBE_ITERATOR_SYMBOL = 'function' == typeof Symbol && Symbol.iterator;
|
||||||
function getIteratorFn(maybeIterable) {
|
function getIteratorFn(maybeIterable) {
|
||||||
@ -2184,7 +2184,6 @@
|
|||||||
case 'lostpointercapture':
|
case 'lostpointercapture':
|
||||||
var _pointerId = nativeEvent.pointerId;
|
var _pointerId = nativeEvent.pointerId;
|
||||||
queuedPointerCaptures.delete(_pointerId);
|
queuedPointerCaptures.delete(_pointerId);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function accumulateOrCreateContinuousQueuedReplayableEvent(existingQueuedEvent, blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
|
function accumulateOrCreateContinuousQueuedReplayableEvent(existingQueuedEvent, blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
|
||||||
@ -2381,6 +2380,8 @@
|
|||||||
function findUpdateLane(lanePriority, wipLanes) {
|
function findUpdateLane(lanePriority, wipLanes) {
|
||||||
switch(lanePriority){
|
switch(lanePriority){
|
||||||
case 0:
|
case 0:
|
||||||
|
case 6:
|
||||||
|
case 5:
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
return SyncLane;
|
return SyncLane;
|
||||||
@ -2397,9 +2398,6 @@
|
|||||||
case 8:
|
case 8:
|
||||||
var _lane3 = pickArbitraryLane(3584 & ~wipLanes);
|
var _lane3 = pickArbitraryLane(3584 & ~wipLanes);
|
||||||
return _lane3 === NoLane && (_lane3 = pickArbitraryLane(4186112 & ~wipLanes)) === NoLane && (_lane3 = pickArbitraryLane(3584)), _lane3;
|
return _lane3 === NoLane && (_lane3 = pickArbitraryLane(4186112 & ~wipLanes)) === NoLane && (_lane3 = pickArbitraryLane(3584)), _lane3;
|
||||||
case 6:
|
|
||||||
case 5:
|
|
||||||
break;
|
|
||||||
case 2:
|
case 2:
|
||||||
var lane = pickArbitraryLane(805306368 & ~wipLanes);
|
var lane = pickArbitraryLane(805306368 & ~wipLanes);
|
||||||
return lane === NoLane && (lane = pickArbitraryLane(805306368)), lane;
|
return lane === NoLane && (lane = pickArbitraryLane(805306368)), lane;
|
||||||
@ -3249,10 +3247,8 @@
|
|||||||
case 1:
|
case 1:
|
||||||
listenerWrapper = dispatchUserBlockingUpdate;
|
listenerWrapper = dispatchUserBlockingUpdate;
|
||||||
break;
|
break;
|
||||||
case 2:
|
|
||||||
default:
|
default:
|
||||||
listenerWrapper = dispatchEvent;
|
listenerWrapper = dispatchEvent;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return listenerWrapper.bind(null, domEventName, eventSystemFlags, targetContainer);
|
return listenerWrapper.bind(null, domEventName, eventSystemFlags, targetContainer);
|
||||||
}(targetContainer2, domEventName3, eventSystemFlags2), isPassiveListener = void 0;
|
}(targetContainer2, domEventName3, eventSystemFlags2), isPassiveListener = void 0;
|
||||||
@ -3386,7 +3382,6 @@
|
|||||||
case 'pointerover':
|
case 'pointerover':
|
||||||
case 'pointerup':
|
case 'pointerup':
|
||||||
SyntheticEventCtor = SyntheticPointerEvent;
|
SyntheticEventCtor = SyntheticPointerEvent;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
var inCapturePhase = (4 & eventSystemFlags) != 0, accumulateTargetOnly = !inCapturePhase && 'scroll' === domEventName, _listeners = accumulateSinglePhaseListeners(targetInst, reactName, nativeEvent.type, inCapturePhase, accumulateTargetOnly);
|
var inCapturePhase = (4 & eventSystemFlags) != 0, accumulateTargetOnly = !inCapturePhase && 'scroll' === domEventName, _listeners = accumulateSinglePhaseListeners(targetInst, reactName, nativeEvent.type, inCapturePhase, accumulateTargetOnly);
|
||||||
if (_listeners.length > 0) {
|
if (_listeners.length > 0) {
|
||||||
@ -3513,6 +3508,7 @@
|
|||||||
}
|
}
|
||||||
switch(domEventName){
|
switch(domEventName){
|
||||||
case 'paste':
|
case 'paste':
|
||||||
|
default:
|
||||||
return null;
|
return null;
|
||||||
case 'keypress':
|
case 'keypress':
|
||||||
if (!(nativeEvent9 = nativeEvent).ctrlKey && !nativeEvent9.altKey && !nativeEvent9.metaKey || nativeEvent9.ctrlKey && nativeEvent9.altKey) {
|
if (!(nativeEvent9 = nativeEvent).ctrlKey && !nativeEvent9.altKey && !nativeEvent9.metaKey || nativeEvent9.ctrlKey && nativeEvent9.altKey) {
|
||||||
@ -3522,8 +3518,6 @@
|
|||||||
return null;
|
return null;
|
||||||
case 'compositionend':
|
case 'compositionend':
|
||||||
return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
|
return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}(domEventName10, nativeEvent8))) return null;
|
}(domEventName10, nativeEvent8))) return null;
|
||||||
var chars1, listeners = accumulateTwoPhaseListeners(targetInst, 'onBeforeInput');
|
var chars1, listeners = accumulateTwoPhaseListeners(targetInst, 'onBeforeInput');
|
||||||
@ -4893,7 +4887,6 @@
|
|||||||
break;
|
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);
|
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;
|
return knownKeys;
|
||||||
}
|
}
|
||||||
@ -4906,22 +4899,16 @@
|
|||||||
return placeSingleChild(function(returnFiber, currentFirstChild, element, lanes) {
|
return placeSingleChild(function(returnFiber, currentFirstChild, element, lanes) {
|
||||||
for(var key = element.key, child = currentFirstChild; null !== child;){
|
for(var key = element.key, child = currentFirstChild; null !== child;){
|
||||||
if (child.key === key) {
|
if (child.key === key) {
|
||||||
switch(child.tag){
|
if (7 === child.tag) {
|
||||||
case 7:
|
if (element.type === REACT_FRAGMENT_TYPE) {
|
||||||
if (element.type === REACT_FRAGMENT_TYPE) {
|
deleteRemainingChildren(returnFiber, child.sibling);
|
||||||
deleteRemainingChildren(returnFiber, child.sibling);
|
var existing = useFiber(child, element.props.children);
|
||||||
var existing = useFiber(child, element.props.children);
|
return existing.return = returnFiber, existing._debugSource = element._source, existing._debugOwner = element._owner, existing;
|
||||||
return existing.return = returnFiber, existing._debugSource = element._source, existing._debugOwner = element._owner, existing;
|
}
|
||||||
}
|
} else if (child.elementType === element.type || isCompatibleFamilyForHotReloading(child, element)) {
|
||||||
break;
|
deleteRemainingChildren(returnFiber, child.sibling);
|
||||||
case 22:
|
var _existing3 = useFiber(child, element.props);
|
||||||
default:
|
return _existing3.ref = coerceRef(returnFiber, child, element), _existing3.return = returnFiber, _existing3._debugSource = element._source, _existing3._debugOwner = element._owner, _existing3;
|
||||||
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);
|
deleteRemainingChildren(returnFiber, child);
|
||||||
break;
|
break;
|
||||||
@ -5061,7 +5048,6 @@
|
|||||||
default:
|
default:
|
||||||
var container = 8 === nodeType ? rootContainerInstance.parentNode : rootContainerInstance;
|
var container = 8 === nodeType ? rootContainerInstance.parentNode : rootContainerInstance;
|
||||||
namespace = getChildNamespace(container.namespaceURI || null, type = container.tagName);
|
namespace = getChildNamespace(container.namespaceURI || null, type = container.tagName);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
namespace: namespace,
|
namespace: namespace,
|
||||||
@ -5131,7 +5117,6 @@
|
|||||||
break;
|
break;
|
||||||
case 5:
|
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));
|
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();
|
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;
|
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;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
warnForInsertedHydratedText(parentContainer, fiber.pendingProps);
|
warnForInsertedHydratedText(parentContainer, fiber.pendingProps);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
@ -5164,7 +5148,6 @@
|
|||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
parentProps[SUPPRESS_HYDRATION_WARNING$1];
|
parentProps[SUPPRESS_HYDRATION_WARNING$1];
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -5183,8 +5166,6 @@
|
|||||||
var instance6, text = fiber.pendingProps, textInstance = (instance6 = nextInstance, '' === text || 3 !== instance6.nodeType ? null : instance6);
|
var instance6, text = fiber.pendingProps, textInstance = (instance6 = nextInstance, '' === text || 3 !== instance6.nodeType ? null : instance6);
|
||||||
if (null !== textInstance) return fiber.stateNode = textInstance, !0;
|
if (null !== textInstance) return fiber.stateNode = textInstance, !0;
|
||||||
return !1;
|
return !1;
|
||||||
case 13:
|
|
||||||
return !1;
|
|
||||||
default:
|
default:
|
||||||
return !1;
|
return !1;
|
||||||
}
|
}
|
||||||
@ -6597,7 +6578,6 @@
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error1('"%s" is not a supported revealOrder on <SuspenseList />. Did you mean "together", "forwards" or "backwards"?', revealOrder);
|
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);
|
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:
|
case 19:
|
||||||
return updateSuspenseListComponent(current13, workInProgress16, renderLanes12);
|
return updateSuspenseListComponent(current13, workInProgress16, renderLanes12);
|
||||||
case 20:
|
case 20:
|
||||||
break;
|
|
||||||
case 21:
|
case 21:
|
||||||
break;
|
|
||||||
case 22:
|
case 22:
|
||||||
break;
|
break;
|
||||||
case 23:
|
case 23:
|
||||||
@ -6943,7 +6921,6 @@
|
|||||||
case 'collapsed':
|
case 'collapsed':
|
||||||
for(var _tailNode = renderState.tail, _lastTailNode = null; null !== _tailNode;)null !== _tailNode.alternate && (_lastTailNode = _tailNode), _tailNode = _tailNode.sibling;
|
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;
|
null === _lastTailNode ? hasRenderedATailFallback || null === renderState.tail ? renderState.tail = null : renderState.tail.sibling = null : _lastTailNode.sibling = null;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function completeWork(current, workInProgress, renderLanes) {
|
function completeWork(current, workInProgress, renderLanes) {
|
||||||
@ -6961,6 +6938,7 @@
|
|||||||
case 14:
|
case 14:
|
||||||
return null;
|
return null;
|
||||||
case 1:
|
case 1:
|
||||||
|
case 17:
|
||||||
return isContextProvider(workInProgress.type) && popContext(workInProgress), null;
|
return isContextProvider(workInProgress.type) && popContext(workInProgress), null;
|
||||||
case 3:
|
case 3:
|
||||||
popHostContainer(workInProgress), popTopLevelContextObject(workInProgress), resetWorkInProgressVersions();
|
popHostContainer(workInProgress), popTopLevelContextObject(workInProgress), resetWorkInProgressVersions();
|
||||||
@ -7012,18 +6990,14 @@
|
|||||||
break;
|
break;
|
||||||
case 'textarea':
|
case 'textarea':
|
||||||
initWrapperState$2(domElement, rawProps), listenToNonDelegatedEvent('invalid', domElement);
|
initWrapperState$2(domElement, rawProps), listenToNonDelegatedEvent('invalid', domElement);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
assertValidProps(tag, rawProps), extraAttributeNames = new Set();
|
assertValidProps(tag, rawProps), extraAttributeNames = new Set();
|
||||||
for(var attributes = domElement.attributes, _i = 0; _i < attributes.length; _i++){
|
for(var attributes = domElement.attributes, _i = 0; _i < attributes.length; _i++){
|
||||||
var name = attributes[_i].name.toLowerCase();
|
var name = attributes[_i].name.toLowerCase();
|
||||||
switch(name){
|
switch(name){
|
||||||
case 'data-reactroot':
|
case 'data-reactroot':
|
||||||
break;
|
|
||||||
case 'value':
|
case 'value':
|
||||||
break;
|
|
||||||
case 'checked':
|
case 'checked':
|
||||||
break;
|
|
||||||
case 'selected':
|
case 'selected':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -7085,7 +7059,6 @@
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
'function' == typeof rawProps.onClick && trapClickOnNonInteractiveElement(domElement);
|
'function' == typeof rawProps.onClick && trapClickOnNonInteractiveElement(domElement);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return updatePayload;
|
return updatePayload;
|
||||||
}(instance, type9, props7, hostContext2.namespace)), fiber.updateQueue = updatePayload1, null !== updatePayload1 && markUpdate(workInProgress);
|
}(instance, type9, props7, hostContext2.namespace)), fiber.updateQueue = updatePayload1, null !== updatePayload1 && markUpdate(workInProgress);
|
||||||
@ -7174,7 +7147,6 @@
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
'function' == typeof props13.onClick && trapClickOnNonInteractiveElement(domElement3);
|
'function' == typeof props13.onClick && trapClickOnNonInteractiveElement(domElement3);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}(instance7, type10 = type11, props8 = newProps, rootContainerInstance), shouldAutoFocusHostComponent(type10, props8) && markUpdate(workInProgress);
|
}(instance7, type10 = type11, props8 = newProps, rootContainerInstance), shouldAutoFocusHostComponent(type10, props8) && markUpdate(workInProgress);
|
||||||
}
|
}
|
||||||
@ -7201,7 +7173,6 @@
|
|||||||
returnFiber.type;
|
returnFiber.type;
|
||||||
var parentProps, textInstance2, text3, parentProps3 = returnFiber.memoizedProps;
|
var parentProps, textInstance2, text3, parentProps3 = returnFiber.memoizedProps;
|
||||||
returnFiber.stateNode, parentProps = parentProps3, textInstance2 = textInstance1, text3 = textContent, !0 !== parentProps[SUPPRESS_HYDRATION_WARNING$1] && warnForUnmatchedText(textInstance2, text3);
|
returnFiber.stateNode, parentProps = parentProps3, textInstance2 = textInstance1, text3 = textContent, !0 !== parentProps[SUPPRESS_HYDRATION_WARNING$1] && warnForUnmatchedText(textInstance2, text3);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return shouldUpdate;
|
return shouldUpdate;
|
||||||
@ -7218,8 +7189,6 @@
|
|||||||
return popHostContainer(workInProgress), updateHostContainer(workInProgress), null === current && listenToAllSupportedEvents(workInProgress.stateNode.containerInfo), null;
|
return popHostContainer(workInProgress), updateHostContainer(workInProgress), null === current && listenToAllSupportedEvents(workInProgress.stateNode.containerInfo), null;
|
||||||
case 10:
|
case 10:
|
||||||
return popProvider(workInProgress), null;
|
return popProvider(workInProgress), null;
|
||||||
case 17:
|
|
||||||
return isContextProvider(workInProgress.type) && popContext(workInProgress), null;
|
|
||||||
case 19:
|
case 19:
|
||||||
popSuspenseContext(workInProgress);
|
popSuspenseContext(workInProgress);
|
||||||
var renderState = workInProgress.memoizedState;
|
var renderState = workInProgress.memoizedState;
|
||||||
@ -7265,9 +7234,7 @@
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
case 20:
|
case 20:
|
||||||
break;
|
|
||||||
case 21:
|
case 21:
|
||||||
break;
|
|
||||||
case 22:
|
case 22:
|
||||||
break;
|
break;
|
||||||
case 23:
|
case 23:
|
||||||
@ -7327,8 +7294,6 @@
|
|||||||
popHostContainer(interruptedWork);
|
popHostContainer(interruptedWork);
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
popSuspenseContext(interruptedWork);
|
|
||||||
break;
|
|
||||||
case 19:
|
case 19:
|
||||||
popSuspenseContext(interruptedWork);
|
popSuspenseContext(interruptedWork);
|
||||||
break;
|
break;
|
||||||
@ -7338,7 +7303,6 @@
|
|||||||
case 23:
|
case 23:
|
||||||
case 24:
|
case 24:
|
||||||
popRenderLanes(interruptedWork);
|
popRenderLanes(interruptedWork);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function createCapturedValue(value, source) {
|
function createCapturedValue(value, source) {
|
||||||
@ -7403,7 +7367,6 @@
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
lastProps = lastRawProps, nextProps = nextRawProps, 'function' != typeof lastProps.onClick && 'function' == typeof nextProps.onClick && trapClickOnNonInteractiveElement(domElement);
|
lastProps = lastRawProps, nextProps = nextRawProps, 'function' != typeof lastProps.onClick && 'function' == typeof nextProps.onClick && trapClickOnNonInteractiveElement(domElement);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
assertValidProps(tag, nextProps);
|
assertValidProps(tag, nextProps);
|
||||||
var styleUpdates1 = null;
|
var styleUpdates1 = null;
|
||||||
@ -7541,7 +7504,6 @@
|
|||||||
enqueueCapturedUpdate(workInProgress, _update2);
|
enqueueCapturedUpdate(workInProgress, _update2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
workInProgress = workInProgress.return;
|
workInProgress = workInProgress.return;
|
||||||
}while (null !== workInProgress)
|
}while (null !== workInProgress)
|
||||||
@ -7564,6 +7526,10 @@
|
|||||||
case 11:
|
case 11:
|
||||||
case 15:
|
case 15:
|
||||||
case 22:
|
case 22:
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
|
case 4:
|
||||||
|
case 17:
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
if (256 & finishedWork.flags && null !== current) {
|
if (256 & finishedWork.flags && null !== current) {
|
||||||
@ -7576,11 +7542,6 @@
|
|||||||
case 3:
|
case 3:
|
||||||
256 & finishedWork.flags && clearContainer(finishedWork.stateNode.containerInfo);
|
256 & finishedWork.flags && clearContainer(finishedWork.stateNode.containerInfo);
|
||||||
return;
|
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.");
|
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;
|
var _instance = null;
|
||||||
if (null !== finishedWork1.child) switch(finishedWork1.child.tag){
|
if (null !== finishedWork1.child) switch(finishedWork1.child.tag){
|
||||||
case 5:
|
case 5:
|
||||||
_instance = finishedWork1.child.stateNode;
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
_instance = finishedWork1.child.stateNode;
|
_instance = finishedWork1.child.stateNode;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
commitUpdateQueue(finishedWork1, _updateQueue, _instance);
|
commitUpdateQueue(finishedWork1, _updateQueue, _instance);
|
||||||
}
|
}
|
||||||
@ -7650,8 +7608,13 @@
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 6:
|
case 6:
|
||||||
return;
|
|
||||||
case 4:
|
case 4:
|
||||||
|
case 19:
|
||||||
|
case 17:
|
||||||
|
case 20:
|
||||||
|
case 21:
|
||||||
|
case 23:
|
||||||
|
case 24:
|
||||||
return;
|
return;
|
||||||
case 12:
|
case 12:
|
||||||
var _finishedWork$memoize2 = finishedWork1.memoizedProps, onRender = (_finishedWork$memoize2.onCommit, _finishedWork$memoize2.onRender);
|
var _finishedWork$memoize2 = finishedWork1.memoizedProps, onRender = (_finishedWork$memoize2.onCommit, _finishedWork$memoize2.onRender);
|
||||||
@ -7662,13 +7625,6 @@
|
|||||||
case 13:
|
case 13:
|
||||||
commitSuspenseHydrationCallbacks(finishedRoot, finishedWork1);
|
commitSuspenseHydrationCallbacks(finishedRoot, finishedWork1);
|
||||||
return;
|
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.");
|
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;
|
var ref = finishedWork.ref;
|
||||||
if (null !== ref) {
|
if (null !== ref) {
|
||||||
var instanceToUse, instance = finishedWork.stateNode;
|
var instanceToUse, instance = finishedWork.stateNode;
|
||||||
switch(finishedWork.tag){
|
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);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function commitDetachRef(current) {
|
function commitDetachRef(current) {
|
||||||
@ -7748,9 +7697,7 @@
|
|||||||
unmountHostComponents(finishedRoot, current);
|
unmountHostComponents(finishedRoot, current);
|
||||||
return;
|
return;
|
||||||
case 20:
|
case 20:
|
||||||
return;
|
|
||||||
case 18:
|
case 18:
|
||||||
return;
|
|
||||||
case 21:
|
case 21:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -7788,12 +7735,9 @@
|
|||||||
parent1 = parentStateNode, isContainer = !1;
|
parent1 = parentStateNode, isContainer = !1;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
parent1 = parentStateNode.containerInfo, isContainer = !0;
|
|
||||||
break;
|
|
||||||
case 4:
|
case 4:
|
||||||
parent1 = parentStateNode.containerInfo, isContainer = !0;
|
parent1 = parentStateNode.containerInfo, isContainer = !0;
|
||||||
break;
|
break;
|
||||||
case 20:
|
|
||||||
default:
|
default:
|
||||||
throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
|
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;
|
currentParent = parentStateNode, currentParentIsContainer = !1;
|
||||||
break findParent;
|
break findParent;
|
||||||
case 3:
|
case 3:
|
||||||
currentParent = parentStateNode.containerInfo, currentParentIsContainer = !0;
|
|
||||||
break findParent;
|
|
||||||
case 4:
|
case 4:
|
||||||
currentParent = parentStateNode.containerInfo, currentParentIsContainer = !0;
|
currentParent = parentStateNode.containerInfo, currentParentIsContainer = !0;
|
||||||
break findParent;
|
break findParent;
|
||||||
@ -7910,6 +7852,8 @@
|
|||||||
}(3, finishedWork2);
|
}(3, finishedWork2);
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
|
case 12:
|
||||||
|
case 17:
|
||||||
return;
|
return;
|
||||||
case 5:
|
case 5:
|
||||||
var instance = finishedWork2.stateNode;
|
var instance = finishedWork2.stateNode;
|
||||||
@ -7932,7 +7876,6 @@
|
|||||||
break;
|
break;
|
||||||
case 'select':
|
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));
|
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));
|
}(domElement6, updatePayload6, type, oldProps, newProps));
|
||||||
}
|
}
|
||||||
@ -7946,18 +7889,13 @@
|
|||||||
var _root = finishedWork2.stateNode;
|
var _root = finishedWork2.stateNode;
|
||||||
_root.hydrate && (_root.hydrate = !1, retryIfBlockedOn(_root.containerInfo));
|
_root.hydrate && (_root.hydrate = !1, retryIfBlockedOn(_root.containerInfo));
|
||||||
return;
|
return;
|
||||||
case 12:
|
|
||||||
return;
|
|
||||||
case 13:
|
case 13:
|
||||||
commitSuspenseComponent(finishedWork2), attachSuspenseRetryListeners(finishedWork2);
|
commitSuspenseComponent(finishedWork2), attachSuspenseRetryListeners(finishedWork2);
|
||||||
return;
|
return;
|
||||||
case 19:
|
case 19:
|
||||||
attachSuspenseRetryListeners(finishedWork2);
|
attachSuspenseRetryListeners(finishedWork2);
|
||||||
return;
|
return;
|
||||||
case 17:
|
|
||||||
return;
|
|
||||||
case 20:
|
case 20:
|
||||||
break;
|
|
||||||
case 21:
|
case 21:
|
||||||
break;
|
break;
|
||||||
case 23:
|
case 23:
|
||||||
@ -8129,6 +8067,7 @@
|
|||||||
case 1:
|
case 1:
|
||||||
throw Error("Root did not complete. This is a bug in React.");
|
throw Error("Root did not complete. This is a bug in React.");
|
||||||
case 2:
|
case 2:
|
||||||
|
case 5:
|
||||||
commitRoot(root4);
|
commitRoot(root4);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@ -8164,9 +8103,6 @@
|
|||||||
}
|
}
|
||||||
commitRoot(root4);
|
commitRoot(root4);
|
||||||
break;
|
break;
|
||||||
case 5:
|
|
||||||
commitRoot(root4);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
throw Error("Unknown root exit status.");
|
throw Error("Unknown root exit status.");
|
||||||
}
|
}
|
||||||
@ -8526,7 +8462,6 @@
|
|||||||
break;
|
break;
|
||||||
case Deletion:
|
case Deletion:
|
||||||
commitDeletion(root, nextEffect);
|
commitDeletion(root, nextEffect);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
resetCurrentFiber(), nextEffect = nextEffect.nextEffect;
|
resetCurrentFiber(), nextEffect = nextEffect.nextEffect;
|
||||||
}
|
}
|
||||||
@ -8725,7 +8660,6 @@
|
|||||||
break;
|
break;
|
||||||
case 1:
|
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);
|
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();
|
didWarnAboutUpdateInRenderForAnotherComponent = new Set();
|
||||||
@ -8897,7 +8831,6 @@
|
|||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
candidateType = type.render;
|
candidateType = type.render;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (null === resolveFamily) throw new Error('Expected resolveFamily to be set during hot reload.');
|
if (null === resolveFamily) throw new Error('Expected resolveFamily to be set during hot reload.');
|
||||||
var needsRender = !1, needsRemount = !1;
|
var needsRender = !1, needsRemount = !1;
|
||||||
@ -8917,7 +8850,6 @@
|
|||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
candidateType = type.render;
|
candidateType = type.render;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
var didMatch = !1;
|
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);
|
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);
|
hostInstances.add(node.stateNode);
|
||||||
return;
|
return;
|
||||||
case 4:
|
case 4:
|
||||||
hostInstances.add(node.stateNode.containerInfo);
|
|
||||||
return;
|
|
||||||
case 3:
|
case 3:
|
||||||
hostInstances.add(node.stateNode.containerInfo);
|
hostInstances.add(node.stateNode.containerInfo);
|
||||||
return;
|
return;
|
||||||
@ -9010,7 +8940,6 @@
|
|||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
workInProgress.type = resolveForwardRefForHotReloading(current.type);
|
workInProgress.type = resolveForwardRefForHotReloading(current.type);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return workInProgress;
|
return workInProgress;
|
||||||
}
|
}
|
||||||
@ -9051,7 +8980,6 @@
|
|||||||
return createFiberFromOffscreen(pendingProps, mode, lanes, key);
|
return createFiberFromOffscreen(pendingProps, mode, lanes, key);
|
||||||
case REACT_LEGACY_HIDDEN_TYPE:
|
case REACT_LEGACY_HIDDEN_TYPE:
|
||||||
return createFiberFromLegacyHidden(pendingProps, mode, lanes, key);
|
return createFiberFromLegacyHidden(pendingProps, mode, lanes, key);
|
||||||
case REACT_SCOPE_TYPE:
|
|
||||||
default:
|
default:
|
||||||
if ('object' == typeof type && null !== type) switch(type.$$typeof){
|
if ('object' == typeof type && null !== type) switch(type.$$typeof){
|
||||||
case REACT_PROVIDER_TYPE:
|
case REACT_PROVIDER_TYPE:
|
||||||
@ -9144,7 +9072,6 @@
|
|||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
this._debugRootType = 'createLegacyRoot()';
|
this._debugRootType = 'createLegacyRoot()';
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function registerMutableSourceForHydration(root, mutableSource) {
|
function registerMutableSourceForHydration(root, mutableSource) {
|
||||||
@ -9175,7 +9102,6 @@
|
|||||||
return node.stateNode.context;
|
return node.stateNode.context;
|
||||||
case 1:
|
case 1:
|
||||||
if (isContextProvider(node.type)) return node.stateNode.__reactInternalMemoizedMergedChildContext;
|
if (isContextProvider(node.type)) return node.stateNode.__reactInternalMemoizedMergedChildContext;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
node = node.return;
|
node = node.return;
|
||||||
}while (null !== node)
|
}while (null !== node)
|
||||||
@ -9195,13 +9121,7 @@
|
|||||||
}
|
}
|
||||||
function getPublicRootInstance(container) {
|
function getPublicRootInstance(container) {
|
||||||
var containerFiber = container.current;
|
var containerFiber = container.current;
|
||||||
if (!containerFiber.child) return null;
|
return containerFiber.child ? (containerFiber.child.tag, containerFiber.child.stateNode) : null;
|
||||||
switch(containerFiber.child.tag){
|
|
||||||
case 5:
|
|
||||||
return containerFiber.child.stateNode;
|
|
||||||
default:
|
|
||||||
return containerFiber.child.stateNode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
function markRetryLaneImpl(fiber, retryLane) {
|
function markRetryLaneImpl(fiber, retryLane) {
|
||||||
var a, b, suspenseState = fiber.memoizedState;
|
var a, b, suspenseState = fiber.memoizedState;
|
||||||
|
@ -7,47 +7,45 @@ def_optimize(AST_Call, function(self, compressor) {
|
|||||||
}).optimize(compressor);
|
}).optimize(compressor);
|
||||||
}
|
}
|
||||||
if (is_undeclared_ref(exp)) exp.name;
|
if (is_undeclared_ref(exp)) exp.name;
|
||||||
else if (exp instanceof AST_Dot) switch(exp.property){
|
else if (exp instanceof AST_Dot && "join" === exp.property) {
|
||||||
case "join":
|
if (exp.expression instanceof AST_Array) {
|
||||||
if (exp.expression instanceof AST_Array) {
|
EXIT: if (!(self.args.length > 0) || (separator = self.args[0].evaluate(compressor)) !== self.args[0]) {
|
||||||
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++){
|
||||||
for(var separator, first, elements = [], consts = [], i = 0, len = exp.expression.elements.length; i < len; i++){
|
var el = exp.expression.elements[i];
|
||||||
var el = exp.expression.elements[i];
|
if (el instanceof AST_Expansion) break EXIT;
|
||||||
if (el instanceof AST_Expansion) break EXIT;
|
var value = el.evaluate(compressor);
|
||||||
var value = el.evaluate(compressor);
|
value !== el ? consts.push(value) : (consts.length > 0 && (elements.push(make_node(AST_String, self, {
|
||||||
value !== el ? consts.push(value) : (consts.length > 0 && (elements.push(make_node(AST_String, self, {
|
|
||||||
value: consts.join(separator)
|
|
||||||
})), consts.length = 0), elements.push(el));
|
|
||||||
}
|
|
||||||
if (consts.length > 0 && elements.push(make_node(AST_String, self, {
|
|
||||||
value: consts.join(separator)
|
value: consts.join(separator)
|
||||||
})), 0 == elements.length) return make_node(AST_String, self, {
|
})), consts.length = 0), elements.push(el));
|
||||||
value: ""
|
|
||||||
});
|
|
||||||
if (1 == elements.length) {
|
|
||||||
if (elements[0].is_string(compressor)) return elements[0];
|
|
||||||
return make_node(AST_Binary, elements[0], {
|
|
||||||
operator: "+",
|
|
||||||
left: make_node(AST_String, self, {
|
|
||||||
value: ""
|
|
||||||
}),
|
|
||||||
right: elements[0]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if ("" == separator) return first = elements[0].is_string(compressor) || elements[1].is_string(compressor) ? elements.shift() : make_node(AST_String, self, {
|
|
||||||
value: ""
|
|
||||||
}), elements.reduce(function(prev, el) {
|
|
||||||
return make_node(AST_Binary, el, {
|
|
||||||
operator: "+",
|
|
||||||
left: prev,
|
|
||||||
right: el
|
|
||||||
});
|
|
||||||
}, first).optimize(compressor);
|
|
||||||
var node = self.clone();
|
|
||||||
return node.expression = node.expression.clone(), node.expression.expression = node.expression.expression.clone(), node.expression.expression.elements = elements, best_of(compressor, self, node);
|
|
||||||
}
|
}
|
||||||
|
if (consts.length > 0 && elements.push(make_node(AST_String, self, {
|
||||||
|
value: consts.join(separator)
|
||||||
|
})), 0 == elements.length) return make_node(AST_String, self, {
|
||||||
|
value: ""
|
||||||
|
});
|
||||||
|
if (1 == elements.length) {
|
||||||
|
if (elements[0].is_string(compressor)) return elements[0];
|
||||||
|
return make_node(AST_Binary, elements[0], {
|
||||||
|
operator: "+",
|
||||||
|
left: make_node(AST_String, self, {
|
||||||
|
value: ""
|
||||||
|
}),
|
||||||
|
right: elements[0]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ("" == separator) return first = elements[0].is_string(compressor) || elements[1].is_string(compressor) ? elements.shift() : make_node(AST_String, self, {
|
||||||
|
value: ""
|
||||||
|
}), elements.reduce(function(prev, el) {
|
||||||
|
return make_node(AST_Binary, el, {
|
||||||
|
operator: "+",
|
||||||
|
left: prev,
|
||||||
|
right: el
|
||||||
|
});
|
||||||
|
}, first).optimize(compressor);
|
||||||
|
var node = self.clone();
|
||||||
|
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) {
|
(function(a) {
|
||||||
switch (1) {
|
if (1 === (a = 1)) console.log(a);
|
||||||
case (a = 1):
|
else console.log(2);
|
||||||
console.log(a);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.log(2);
|
|
||||||
}
|
|
||||||
})(1);
|
})(1);
|
||||||
|
@ -1,4 +1 @@
|
|||||||
switch (foo) {
|
if ("bar" === foo) baz();
|
||||||
case "bar":
|
|
||||||
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) {
|
if ("bar" === foo) baz();
|
||||||
case "bar":
|
|
||||||
baz();
|
|
||||||
}
|
|
||||||
|
@ -1,4 +1 @@
|
|||||||
switch (foo) {
|
if ("bar" === foo) baz();
|
||||||
case "bar":
|
|
||||||
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