Browse Source

Allow creating object with true/false property names (#2028)

This Pull Request allows "true"/"false" as property names when instantiating objects. This should make some additional tests in the test suite pass.
pull/2031/head
lupd 3 years ago
parent
commit
be15b85171
  1. 4
      boa_engine/src/syntax/parser/expression/primary/object_initializer/mod.rs

4
boa_engine/src/syntax/parser/expression/primary/object_initializer/mod.rs

@ -480,6 +480,10 @@ where
Node::Const(Const::from(interner.get_or_intern_static(word.as_str()))).into()
}
TokenKind::NullLiteral => Node::Const(Const::from(Sym::NULL)).into(),
TokenKind::BooleanLiteral(bool) => match bool {
true => Node::Const(Const::from(interner.get_or_intern_static("true"))).into(),
false => Node::Const(Const::from(interner.get_or_intern_static("false"))).into(),
},
_ => return Err(ParseError::AbruptEnd),
};
cursor.next(interner).expect("token disappeared");

Loading…
Cancel
Save