Skip to content

Commit

Permalink
Unassigned variables are set to undefined not null
Browse files Browse the repository at this point in the history
  • Loading branch information
pop committed Sep 28, 2019
1 parent 48819b6 commit e7b3087
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ impl Executor for Interpreter {
let (name, value) = var.clone();
let val = match value {
Some(v) => self.run(&v)?,
None => Gc::new(ValueData::Null),
None => Gc::new(ValueData::Undefined),
};
self.environment.create_mutable_binding(name.clone(), false);
self.environment.initialize_binding(&name, val);
Expand All @@ -404,7 +404,7 @@ impl Executor for Interpreter {
let (name, value) = var.clone();
let val = match value {
Some(v) => self.run(&v)?,
None => Gc::new(ValueData::Null),
None => Gc::new(ValueData::Undefined),
};
self.environment.create_mutable_binding(name.clone(), false);
self.environment.initialize_binding(&name, val);
Expand Down

0 comments on commit e7b3087

Please sign in to comment.