Browse Source

Implement early errors for non-assignable nodes in assignment (#1019)

Co-authored-by: tofpie <tofpie@users.noreply.github.com>
pull/1023/head
tofpie 4 years ago committed by GitHub
parent
commit
e11abfb3a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      boa/src/syntax/parser/expression/assignment/mod.rs

3
boa/src/syntax/parser/expression/assignment/mod.rs

@ -217,5 +217,6 @@ where
/// [spec]: https://tc39.es/ecma262/#sec-assignment-operators-static-semantics-early-errors /// [spec]: https://tc39.es/ecma262/#sec-assignment-operators-static-semantics-early-errors
#[inline] #[inline]
pub(crate) fn is_assignable(node: &Node) -> bool { pub(crate) fn is_assignable(node: &Node) -> bool {
!matches!(node, Node::Const(_) | Node::ArrayDecl(_)) matches!(node, Node::GetConstField(_) | Node::GetField(_) | Node::Assign(_)
| Node::Call(_) | Node::Identifier(_) | Node::Object(_))
} }

Loading…
Cancel
Save