Add tests and only traverse in the crates directory

This commit is contained in:
DJMcNab 2018-12-19 21:19:32 +00:00
parent db67741430
commit a3b842fb8b
7 changed files with 185 additions and 94 deletions

View file

@ -73,6 +73,10 @@ pub(crate) fn block(p: &mut Parser) {
// for _ in () {}
// {}
// {}
// macro_rules! test {
// () => {}
// }
// test!{}
// }
if is_blocklike {
p.eat(SEMI);
@ -168,13 +172,13 @@ fn current_op(p: &Parser) -> (u8, Op) {
// Parses expression with binding power of at least bp.
fn expr_bp(p: &mut Parser, r: Restrictions, bp: u8) -> BlockLike {
let mut lhs = match lhs(p, r) {
Some((lhs, macro_blocklike)) => {
Some((lhs, blocklike)) => {
// test stmt_bin_expr_ambiguity
// fn foo() {
// let _ = {1} & 2;
// {1} &2;
// }
if r.prefer_stmt && macro_blocklike.is_block() {
if r.prefer_stmt && blocklike.is_block() {
return BlockLike::Block;
}
lhs