Don't even need an outcome

This commit is contained in:
Kevin Leung
2016-12-07 10:10:22 +08:00
parent f0d5d80266
commit aad311f524
2 changed files with 8 additions and 8 deletions

View File

@@ -393,10 +393,10 @@ class Exprs {
if(pos == null) pos = e.pos;
return
switch [e.expr, with.expr] {
case [EBlock(e1), EBlock(e2)]: Success(EBlock(e1.concat(e2)).at(pos));
case [EBlock(e1), e2]: Success(EBlock(e1.concat([with])).at(pos));
case [e1, EBlock(e2)]: Success(EBlock([e].concat(e2)).at(pos));
default: Success(EBlock([e, with]).at(pos));
case [EBlock(e1), EBlock(e2)]: EBlock(e1.concat(e2)).at(pos);
case [EBlock(e1), e2]: EBlock(e1.concat([with])).at(pos);
case [e1, EBlock(e2)]: EBlock([e].concat(e2)).at(pos);
default: EBlock([e, with]).at(pos);
}
}

View File

@@ -82,9 +82,9 @@ class Exprs extends Base {
}
function testConcat() {
exprEq(macro {a; b;}, (macro a).concat(macro b).sure());
exprEq(macro {a; b; c;}, (macro {a; b;}).concat(macro c).sure());
exprEq(macro {a; b; c;}, (macro a).concat(macro {b; c;}).sure());
exprEq(macro {a; b; c; d;}, (macro {a; b;}).concat(macro {c; d;}).sure());
exprEq(macro {a; b;}, (macro a).concat(macro b));
exprEq(macro {a; b; c;}, (macro {a; b;}).concat(macro c));
exprEq(macro {a; b; c;}, (macro a).concat(macro {b; c;}));
exprEq(macro {a; b; c; d;}, (macro {a; b;}).concat(macro {c; d;}));
}
}