From 5b030c56f8bdb2e26d3b68c3113e4d82f940d3b2 Mon Sep 17 00:00:00 2001 From: duzhaofeng Date: Mon, 28 Mar 2022 10:08:26 +0800 Subject: [PATCH] fix prefix/postfix operators parse issue like: if ((!a) && (b++)) { ... } --- javalang/parser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/javalang/parser.py b/javalang/parser.py index fb8623e..4aa19e3 100644 --- a/javalang/parser.py +++ b/javalang/parser.py @@ -1868,10 +1868,13 @@ def parse_expression_3(self): pass primary = self.parse_primary() + if getattr(primary, "prefix_operators", None): + prefix_operators.extend(primary.prefix_operators) primary.prefix_operators = prefix_operators if getattr(primary, "selectors", None) is None: primary.selectors = list() - primary.postfix_operators = list() + if getattr(primary, "postfix_operators", None) is None: + primary.postfix_operators = list() token = self.tokens.look() while token.value in '[.':