REPL code review -- CompletenessAnalyzer

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Tue Sep 22 23:25:03 UTC 2015



On 22/09/15 18:46, Robert Field wrote:
> Each token is either set as XEXPR or XEXPR1, but tests are of XEXPR1o 
> or XEXPR.  So if you changed the flags to mean 
> can-be-in-expr-but-not-first and can-be-in-expr-but-including-first 
> then you would still need an or'ed value for the can-be-in-expr 
> checks. That doesn't simplify anything, and would make XANY1 more complex.
Looking at code usages, the number of tests are rather limited - you 
only check for XEXPR1o or XEXPR in few places: inside parseUnit (where 
you can use XEXPR1) and inside the predicate isExpression() inside TK - 
in which you can use an or.

In other words, with a bunch of bitwise-or you can get rid of the XYZo 
flags.

I guess whether it's better or not is in the eye of the beholder; 
personally, I try to use disjoint flags only where you can really have 
cases where A and B can occur independently (either or/both) - this is 
not exactly the case here.

Maurizio


More information about the kulla-dev mailing list