Permalink
Browse files

Передаем во внешнюю функцию полный контекст (такой же, как в обычную …

…функцию). Fixes #12
  • Loading branch information...
1 parent 6c0eef7 commit b3155ebc2343a905de4dfae64f5967532de47eb8 @pasaran committed May 5, 2012
Showing with 15 additions and 8 deletions.
  1. +5 −2 templates/js.tmpl
  2. +3 −1 tests/functions.09.js
  3. +7 −5 tests/functions.13.js
View
@@ -67,7 +67,7 @@ template :prologue
function_ :defs
- // %{ Name }
+ // %{ Name } : %{ type() }
function f%{ Fid }(c%{ Cid }, a%{ Rid }, index, count %{ Args }) {
%{ Args :defaults }
%{ . :prologue }
@@ -419,8 +419,11 @@ inline_complex
// ----------------------------------------------------------------------------------------------------------------- //
+inline_function [ this.External && !this.Args.empty() ]
+ (Yater.externals['%{ Name }'])(c%{ Cid }, a%{ Rid }, index, count, %{ Args })
+
inline_function [ this.External ]
- (Yater.externals['%{ Name }'])(%{ Args })
+ (Yater.externals['%{ Name }'])(c%{ Cid }, a%{ Rid }, index, count)
inline_function [ this.Kid != null ]
k%{ Kid }(%{ Args }, root)
@@ -1,10 +1,12 @@
Yater.externals = {
- reverse: function(nodeset) {
+
+ reverse: function(c0, a0, index, count, nodeset) {
var r = [];
for (var i = nodeset.length; i--;) {
r.push( nodeset[i] );
}
return r;
}
+
};
View
@@ -1,9 +1,11 @@
Yater.externals = {
- attrs: function() {
- return {
- class: "b-hello",
- id: "hello"
- };
+ attrs: function(c0, a0, index, count) {
+ var attrs = a0.attrs;
+
+ attrs['class'] = 'b-hello';
+ attrs['id'] = 'hello';
+
+ return '';
}
};

0 comments on commit b3155eb

Please sign in to comment.