[macro] signal macro expression wrap with function
This commit is contained in:
@@ -17,21 +17,21 @@ views:
|
|||||||
contentSize: true
|
contentSize: true
|
||||||
paddings: [25, 8]
|
paddings: [25, 8]
|
||||||
text: List
|
text: List
|
||||||
+onPress: "$code:function(_) switcher.change('list_form')"
|
+onPress: "$code:switcher.change('list_form')"
|
||||||
- id: tail_form
|
- id: tail_form
|
||||||
$type: haxework.gui.ToggleButtonView
|
$type: haxework.gui.ToggleButtonView
|
||||||
skin: $r:skin:tab
|
skin: $r:skin:tab
|
||||||
contentSize: true
|
contentSize: true
|
||||||
paddings: [25, 8]
|
paddings: [25, 8]
|
||||||
text: Tail
|
text: Tail
|
||||||
+onPress: "$code:function(_) switcher.change('tail_form')"
|
+onPress: "$code:switcher.change('tail_form')"
|
||||||
- id: any_form
|
- id: any_form
|
||||||
$type: haxework.gui.ToggleButtonView
|
$type: haxework.gui.ToggleButtonView
|
||||||
skin: $r:skin:tab
|
skin: $r:skin:tab
|
||||||
contentSize: true
|
contentSize: true
|
||||||
paddings: [25, 8]
|
paddings: [25, 8]
|
||||||
text: Any
|
text: Any
|
||||||
+onPress: "$code:function(_) switcher.change('any_form')"
|
+onPress: "$code:switcher.change('any_form')"
|
||||||
- id: switcher
|
- id: switcher
|
||||||
$type: haxework.gui.frame.FrameSwitcher
|
$type: haxework.gui.frame.FrameSwitcher
|
||||||
skin: $r:skin:border
|
skin: $r:skin:border
|
||||||
@@ -64,19 +64,19 @@ views:
|
|||||||
contentSize: true
|
contentSize: true
|
||||||
padding: 8
|
padding: 8
|
||||||
text: green
|
text: green
|
||||||
+onPress: "$code:function(_) Theme.setColor(0x33aa33)"
|
+onPress: "$code:Theme.setColor(0x33aa33)"
|
||||||
- $type: haxework.gui.ButtonView
|
- $type: haxework.gui.ButtonView
|
||||||
skin: $r:skin:button
|
skin: $r:skin:button
|
||||||
contentSize: true
|
contentSize: true
|
||||||
padding: 8
|
padding: 8
|
||||||
text: red
|
text: red
|
||||||
+onPress: "$code:function(_) Theme.setColor(0xaa3333)"
|
+onPress: "$code:Theme.setColor(0xaa3333)"
|
||||||
- $type: haxework.gui.ButtonView
|
- $type: haxework.gui.ButtonView
|
||||||
skin: $r:skin:button
|
skin: $r:skin:button
|
||||||
contentSize: true
|
contentSize: true
|
||||||
padding: 8
|
padding: 8
|
||||||
text: yellow
|
text: yellow
|
||||||
+onPress: "$code:function(_) Theme.setColor(0xaaaa33)"
|
+onPress: "$code:Theme.setColor(0xaaaa33)"
|
||||||
rightMargin: 30
|
rightMargin: 30
|
||||||
|
|
||||||
- $type: haxework.gui.ButtonView
|
- $type: haxework.gui.ButtonView
|
||||||
@@ -94,5 +94,4 @@ views:
|
|||||||
contentSize: true
|
contentSize: true
|
||||||
padding: 8
|
padding: 8
|
||||||
text: Cancel
|
text: Cancel
|
||||||
#+onPress: $this:close
|
+onPress: "$code:flash.system.System.exit(0)"
|
||||||
+onPress: "$code:function(_) flash.system.System.exit(0)"
|
|
||||||
|
|||||||
@@ -154,7 +154,12 @@ class TemplateMacro {
|
|||||||
var value = createValue(name, key, Reflect.field(data, key), position, exprs);
|
var value = createValue(name, key, Reflect.field(data, key), position, exprs);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
if (key.charAt(0) == "+") {
|
if (key.charAt(0) == "+") {
|
||||||
exprs.push(Context.parse('${name}.${key.substr(1)}.connect(${value})', getPosition(position)));
|
var e:Expr = Context.parse(value, getPosition(position));
|
||||||
|
e = switch (e.expr) {
|
||||||
|
case ECall(_, _): macro function(_) ${e};
|
||||||
|
case _: e;
|
||||||
|
}
|
||||||
|
exprs.push(macro $p{[name, key.substr(1)]}.connect(${e}));
|
||||||
} else {
|
} else {
|
||||||
exprs.push(Context.parse('${name}.${key} = ${value}', getPosition(position)));
|
exprs.push(Context.parse('${name}.${key} = ${value}', getPosition(position)));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user