Merge branch 'master' of https://github.com/haxetink/tink_macro
This commit is contained in:
@@ -388,6 +388,17 @@ class Exprs {
|
||||
case EFunction(_, f): Success(f);
|
||||
default: e.pos.makeFailure(NOT_A_FUNCTION);
|
||||
}
|
||||
|
||||
static public function concat(e:Expr, with:Expr, ?pos) {
|
||||
if(pos == null) pos = e.pos;
|
||||
return
|
||||
switch [e.expr, with.expr] {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
static inline var NOT_AN_INT = "integer constant expected";
|
||||
static inline var NOT_AN_IDENT = "identifier expected";
|
||||
|
Reference in New Issue
Block a user