From bf4171663742e7c51dad15591bbfb671424b5382 Mon Sep 17 00:00:00 2001 From: Dima Granetchi Date: Wed, 26 Nov 2014 16:38:11 +0200 Subject: [PATCH] chainTo, exprTo --- src/bindx/BindxExt.hx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/bindx/BindxExt.hx b/src/bindx/BindxExt.hx index ffe5df5..e8dd3bc 100644 --- a/src/bindx/BindxExt.hx +++ b/src/bindx/BindxExt.hx @@ -35,10 +35,20 @@ class BindExt { return internalBindExpr(expr, listener); } + @:noUsing macro static public function exprTo(expr:Expr, target:Expr):Expr { + var type = Context.typeof(expr).toComplexType(); + return internalBindExpr(expr, macro function (_, to:Null<$type>) $target = to); + } + @:noUsing macro static public function chain(expr:Expr, listener:Expr):Expr { return internalBindChain(expr, listener); } + @:noUsing macro static public function chainTo(expr:Expr, target:Expr):Expr { + var type = Context.typeof(expr).toComplexType(); + return internalBindChain(expr, macro function (_, to:Null<$type>) $target = to); + } + #if macro public static function internalBindChain(expr:Expr, listener:Expr):Expr {