@@ -1134,7 +1134,11 @@ impl Pure<'_> {
11341134 callee : Callee :: Expr ( callee) ,
11351135 args,
11361136 ..
1137- } ) if callee. is_one_of_global_ref_to ( self . expr_ctx , & [ "Array" , "Object" , "RegExp" ] ) => {
1137+ } ) if callee. is_one_of_global_ref_to (
1138+ self . expr_ctx . unresolved_ctxt ,
1139+ & [ "Array" , "Object" , "RegExp" ] ,
1140+ ) =>
1141+ {
11381142 let new_expr = match & * * callee {
11391143 Expr :: Ident ( Ident { sym, .. } ) if & * * sym == "RegExp" => {
11401144 self . optimize_regex ( args, span)
@@ -1163,7 +1167,7 @@ impl Pure<'_> {
11631167 args,
11641168 ..
11651169 } ) if callee. is_one_of_global_ref_to (
1166- self . expr_ctx ,
1170+ self . expr_ctx . unresolved_ctxt ,
11671171 & [ "Boolean" , "Number" , "String" , "Symbol" ] ,
11681172 ) =>
11691173 {
@@ -1273,7 +1277,7 @@ impl Pure<'_> {
12731277 args,
12741278 ..
12751279 } ) if callee. is_one_of_global_ref_to (
1276- self . expr_ctx ,
1280+ self . expr_ctx . unresolved_ctxt ,
12771281 & [
12781282 "Object" ,
12791283 // https://262.ecma-international.org/12.0/#sec-array-constructor
@@ -1292,7 +1296,7 @@ impl Pure<'_> {
12921296 "TypeError" ,
12931297 "URIError" ,
12941298 ] ,
1295- ) || ( callee. is_global_ref_to ( self . expr_ctx , "RegExp" )
1299+ ) || ( callee. is_global_ref_to ( self . expr_ctx . unresolved_ctxt , "RegExp" )
12961300 && can_compress_new_regexp ( args. as_deref ( ) ) ) =>
12971301 {
12981302 self . changed = true ;
@@ -1615,7 +1619,7 @@ impl Pure<'_> {
16151619 callee : Callee :: Expr ( callee) ,
16161620 args,
16171621 ..
1618- } ) if callee. is_pure_callee ( self . expr_ctx ) => {
1622+ } ) if callee. is_pure_callee ( self . expr_ctx . unresolved_ctxt ) => {
16191623 report_change ! ( "ignore_return_value: Dropping a pure call (callee is pure)" ) ;
16201624 self . changed = true ;
16211625
@@ -1644,7 +1648,9 @@ impl Pure<'_> {
16441648 ctxt,
16451649 args,
16461650 ..
1647- } ) if callee. is_pure_callee ( self . expr_ctx ) || ctxt. has_mark ( self . marks . pure ) => {
1651+ } ) if callee. is_pure_callee ( self . expr_ctx . unresolved_ctxt )
1652+ || ctxt. has_mark ( self . marks . pure ) =>
1653+ {
16481654 report_change ! ( "ignore_return_value: Dropping a pure call" ) ;
16491655 self . changed = true ;
16501656
@@ -1667,7 +1673,7 @@ impl Pure<'_> {
16671673 args,
16681674 ..
16691675 } ) => {
1670- if callee. is_pure_callee ( self . expr_ctx ) {
1676+ if callee. is_pure_callee ( self . expr_ctx . unresolved_ctxt ) {
16711677 self . changed = true ;
16721678 report_change ! ( "Dropping pure call as callee is pure" ) ;
16731679 * e = self
@@ -1683,7 +1689,7 @@ impl Pure<'_> {
16831689 tpl,
16841690 ..
16851691 } ) => {
1686- if callee. is_pure_callee ( self . expr_ctx ) {
1692+ if callee. is_pure_callee ( self . expr_ctx . unresolved_ctxt ) {
16871693 self . changed = true ;
16881694 report_change ! ( "Dropping pure tag tpl as callee is pure" ) ;
16891695 * e = self
@@ -2157,7 +2163,7 @@ impl Pure<'_> {
21572163 Expr :: New ( NewExpr {
21582164 span, callee, args, ..
21592165 } ) if callee. is_one_of_global_ref_to (
2160- self . expr_ctx ,
2166+ self . expr_ctx . unresolved_ctxt ,
21612167 & [
21622168 "Map" , "Set" , "Array" , "Object" , "Boolean" , "Number" , "String" ,
21632169 ] ,
@@ -2181,7 +2187,7 @@ impl Pure<'_> {
21812187 args,
21822188 ..
21832189 } ) if callee. is_one_of_global_ref_to (
2184- self . expr_ctx ,
2190+ self . expr_ctx . unresolved_ctxt ,
21852191 & [ "Array" , "Object" , "Boolean" , "Number" ] ,
21862192 ) =>
21872193 {
@@ -2422,8 +2428,12 @@ impl Pure<'_> {
24222428 _ => return ,
24232429 } ;
24242430
2425- let lt = cond. cons . get_type ( self . expr_ctx ) ;
2426- let rt = cond. alt . get_type ( self . expr_ctx ) ;
2431+ let lt = cond
2432+ . cons
2433+ . get_type ( self . expr_ctx . unresolved_ctxt , self . expr_ctx . remaining_depth ) ;
2434+ let rt = cond
2435+ . alt
2436+ . get_type ( self . expr_ctx . unresolved_ctxt , self . expr_ctx . remaining_depth ) ;
24272437 match ( lt, rt) {
24282438 ( Known ( Type :: Bool ) , Known ( Type :: Bool ) ) => { }
24292439 _ => return ,
0 commit comments