Shared Dynamic tests and fixes in Engine; Also fixed a bug in Parser variable capturing

This commit is contained in:
Ilya Lakhin
2020-07-31 10:44:57 +07:00
parent aa87a7f5ef
commit 060dd33046
3 changed files with 231 additions and 137 deletions

View File

@@ -2182,12 +2182,9 @@ fn parse_binary_op(
let (op_token, pos) = input.next().unwrap();
let next = input.peek().unwrap();
let next_precedence = next.0.precedence(custom);
#[cfg(any(not(feature = "no_object"), not(feature = "no_capture")))]
if op_token == Token::Period {
if let (Token::Identifier(_), _) = next {
if let (Token::Identifier(_), _) = input.peek().unwrap() {
// prevents capturing of the object properties as vars: xxx.<var>
state.capture = false;
}
@@ -2195,6 +2192,8 @@ fn parse_binary_op(
let rhs = parse_unary(input, state, lib, settings)?;
let next_precedence = input.peek().unwrap().0.precedence(custom);
// Bind to right if the next operator has higher precedence
// If same precedence, then check if the operator binds right
let rhs = if (precedence == next_precedence && bind_right) || precedence < next_precedence {