unwrapFormatedString

This commit is contained in:
Dima Granetchi
2014-12-09 22:43:48 +02:00
parent 9eb1aee780
commit 361cdbe65e
+11 -9
View File
@@ -62,6 +62,16 @@ class BindExt {
)($listener);
}
static inline function unwrapFormatedString(expr:Expr):Expr {
return if (MacroStringTools.isFormatExpr(expr)) {
var f = switch (expr.expr) {
case EConst(CString(s)): s;
case _: null;
}
if (f != null) MacroStringTools.formatString(f, expr.pos) else expr;
} else expr;
}
static function internalBindExpr(expr:Expr, listener:Expr):Expr {
var type = Context.typeof(expr).toComplexType();
var listenerNameExpr = macro listener;
@@ -75,15 +85,7 @@ class BindExt {
var prefix = 0;
function findChain(expr:Expr) {
var isChain;
if (MacroStringTools.isFormatExpr(expr)) {
var f = switch (expr.expr) {
case EConst(CString(s)): s;
case _: null;
}
if (f != null)
expr = MacroStringTools.formatString(f, expr.pos);
}
expr = unwrapFormatedString(expr);
var e = expr;
var ecall = false;
do switch (e.expr) {