stop override this var

This commit is contained in:
Dima Granetchi
2014-11-24 22:29:25 +02:00
parent ffa6655f39
commit 228ee2d026
2 changed files with 6 additions and 7 deletions
+4 -5
View File
@@ -137,17 +137,15 @@ class BindExt {
case _: macro if (!init) { var v:Null<$type> = null; try { v = $expr; } catch (e:Dynamic) { }; $i{zeroListener}(null, v); }; case _: macro if (!init) { var v:Null<$type> = null; try { v = $expr; } catch (e:Dynamic) { }; $i{zeroListener}(null, v); };
} }
var base = [
(macro var init:Bool = true),
];
var init = [ var init = [
macro function $fieldListenerName(?from:Dynamic, ?to:Dynamic) $callListener, macro function $fieldListenerName(?from:Dynamic, ?to:Dynamic) $callListener,
macro function $methodListenerName() $callListener macro function $methodListenerName() $callListener
]; ];
init = [macro var init:Bool = true].concat(chain.init).concat(init).concat(chain.bind);
var res = macro (function ($zeroListener):Void->Void var res = macro (function ($zeroListener):Void->Void
$b { base.concat(chain.init).concat(init).concat(chain.bind).concat([macro init = false, macro $i{methodListenerName}(), macro return function ():Void $b { chain.unbind }]) } $b { init.concat([macro init = false, macro $i{methodListenerName}(), macro return function ():Void $b { chain.unbind }]) }
)($listener); )($listener);
trace(new Printer().printExpr(res)); trace(new Printer().printExpr(res));
@@ -294,6 +292,7 @@ class BindExt {
throw new bindx.Error("Chain is not bindable.", pos); throw new bindx.Error("Chain is not bindable.", pos);
var zeroName = res.zeroName = zeroListener.f.e.toString(); var zeroName = res.zeroName = zeroListener.f.e.toString();
if (zeroName != "this")
res.init.unshift(macro var $zeroName = $i{zeroName}); res.init.unshift(macro var $zeroName = $i{zeroName});
// TODO: local var // TODO: local var
+1 -1
View File
@@ -2,7 +2,7 @@
-cp src -cp src
-cp test -cp test
-D dump=pretty -D dump=pretty
-neko bin/test.n --interp
-lib buddy -lib buddy
-D reporter=buddy.reporting.TravisHxReporter -D reporter=buddy.reporting.TravisHxReporter
-D console_log -D console_log