mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
b7cd88dcd6
Part of #23043. Migrate `oxc_minifier` over to new `AstBuilder`.
23 lines
724 B
Rust
23 lines
724 B
Rust
use oxc_allocator::Allocator;
|
|
use oxc_ast::{ast::Expression, builder::AstBuilder};
|
|
use oxc_ecmascript::ToBoolean;
|
|
use oxc_span::SPAN;
|
|
|
|
use super::GlobalReferenceInformation;
|
|
|
|
#[test]
|
|
fn test() {
|
|
let allocator = Allocator::default();
|
|
let ast = AstBuilder::new(&allocator);
|
|
let ast = *
|
|
|
|
let undefined = Expression::new_identifier(SPAN, "undefined", ast);
|
|
let shadowed_undefined_bool =
|
|
undefined.to_boolean(&GlobalReferenceInformation { is_undefined_shadowed: true });
|
|
let global_undefined_bool =
|
|
undefined.to_boolean(&GlobalReferenceInformation { is_undefined_shadowed: false });
|
|
|
|
assert_eq!(shadowed_undefined_bool, None);
|
|
assert_eq!(global_undefined_bool, Some(false));
|
|
}
|