Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

inject can access model ($data)

  • Loading branch information...
commit 64f438ece7a568eb4053f0f8e9532c409273a628 1 parent 35b342d
@hax hax authored
Showing with 15 additions and 2 deletions.
  1. +2 −2 src/transpiler.php5.ometajs
  2. +13 −0 test/Transpiler.php5.coffee
View
4 src/transpiler.php5.ometajs
@@ -153,8 +153,8 @@ ometa PHP5Transpiler {
endElement -> '',
- inject :x :y [string*:lines] -> [x + ';'].concat(lines.map(function(l){ return '//' + l })),
- inject :x :y block:body -> [x, '{', body, '}'],
+ inject :x :y [string*:lines] resolve(#data) -> [x + ';'].concat(lines.map(function(l){ return '//' + l })),
+ inject :x :y block:body resolve(#data) -> [x, '{', body, '}'],
/*filter [#Symbol [``if'']] [spaces Expression.expression:exp node(exp):x] block:body
-> ['if (' + x + ') {', body, '}'],
filter [#Symbol [``else'']] :x block:body
View
13 test/Transpiler.php5.coffee
@@ -112,6 +112,19 @@ exports.PHP5Transpiler =
'}, $data->x);'
]],
+ 'inject may access model':
+ input: [[
+ 'binding', [1, 1], null, ['Symbol', 'x'], [
+ ['inject', [1, 1], 'echo $data->x', null, []]
+ ]
+ ]]
+
+ expect: [[
+ 'call_user_func(function ($context) use ($data) {',
+ [ [ "echo $data->x;" ] ],
+ '}, $data->x);'
+ ]],
+
'binding of a list':
input: [
['binding', [1, 1], null,
Please sign in to comment.
Something went wrong with that request. Please try again.