From 8aadfd09f56593598f92f3d03652b57381a8497a Mon Sep 17 00:00:00 2001 From: Dima Granetchi Date: Tue, 6 Jan 2015 13:37:39 +0200 Subject: [PATCH] short syntax in meta --- src/bindx/MetaUtils.hx | 5 ++++- test/BaseTest.hx | 2 +- test/ForceTest.hx | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/bindx/MetaUtils.hx b/src/bindx/MetaUtils.hx index 1cbb1bf..71fe3a8 100644 --- a/src/bindx/MetaUtils.hx +++ b/src/bindx/MetaUtils.hx @@ -18,8 +18,11 @@ class MetaUtils { if (meta.params != null) for (p in meta.params) { switch (p.expr) { case EBinop(OpAssign, e1, e2): - if (e1.toString() == name) res = {expr:e2.expr, pos:p.pos}; + if (e1.toString() == name) res = { expr:e2.expr, pos:p.pos }; + case EConst(CIdent(s)): + if (s == name) res = { expr:(macro true).expr , pos: p.pos }; case _: + trace(p.expr); Context.warning('Bindable arguments syntax error. Supported syntax: (flag1=true, flag2=false)', p.pos); } if (res != null) break; diff --git a/test/BaseTest.hx b/test/BaseTest.hx index 73294b5..079845a 100644 --- a/test/BaseTest.hx +++ b/test/BaseTest.hx @@ -301,7 +301,7 @@ class Bindable1 implements bindx.IBindable { @:bindable(lazySignal=false) public var str2:String; - @:bindable(lazySignal=true) + @:bindable(lazySignal) public function bind() { } diff --git a/test/ForceTest.hx b/test/ForceTest.hx index 7c014e9..6ac45ae 100644 --- a/test/ForceTest.hx +++ b/test/ForceTest.hx @@ -40,7 +40,7 @@ class ForceTest extends BuddySuite { } } -@:bindable(force=true) +@:bindable(force) class BindableForce implements bindx.IBindable { public var str(default, never):String;