diff --git a/boa/src/exec/mod.rs b/boa/src/exec/mod.rs index 2d134201d7..af9f92f382 100644 --- a/boa/src/exec/mod.rs +++ b/boa/src/exec/mod.rs @@ -385,6 +385,7 @@ impl Executable for Node { Node::Const(Const::Num(num)) => Ok(Value::rational(num)), Node::Const(Const::Int(num)) => Ok(Value::integer(num)), Node::Const(Const::BigInt(ref num)) => Ok(Value::from(num.clone())), + Node::Const(Const::Undefined) => Ok(Value::Undefined), // we can't move String from Const into value, because const is a garbage collected value // Which means Drop() get's called on Const, but str will be gone at that point. // Do Const values need to be garbage collected? We no longer need them once we've generated Values @@ -423,7 +424,8 @@ impl Executable for Node { } Node::Try(ref try_node) => try_node.run(interpreter), Node::Break(ref break_node) => break_node.run(interpreter), - ref i => unimplemented!("{:?}", i), + Node::ConditionalOp(_) => unimplemented!("ConditionalOp"), + Node::Continue(_) => unimplemented!("Continue"), } } } diff --git a/boa/src/exec/tests.rs b/boa/src/exec/tests.rs index 5313648411..662c9c00e8 100644 --- a/boa/src/exec/tests.rs +++ b/boa/src/exec/tests.rs @@ -770,7 +770,9 @@ mod in_operator { let bar_obj = bar_val.as_object().unwrap(); let foo_val = forward_val(&mut engine, "Foo").unwrap(); let foo_obj = foo_val.as_object().unwrap(); - assert!(bar_obj.prototype().strict_equals(&foo_obj.get_field("prototype").unwrap())); + assert!(bar_obj + .prototype() + .strict_equals(&foo_obj.get_field("prototype").unwrap())); } } @@ -1220,3 +1222,15 @@ fn test_result_of_empty_block() { let scenario = "{}"; assert_eq!(&exec(scenario), "undefined"); } + +#[test] +fn test_undefined_constant() { + let scenario = "undefined"; + assert_eq!(&exec(scenario), "undefined"); +} + +#[test] +fn test_undefined_type() { + let scenario = "typeof undefined"; + assert_eq!(&exec(scenario), "\"undefined\""); +}