JsTemplate/Link.js
[gnome.introspection-doc-generator] / JsTemplate / Template.js
index cec981a..6adb708 100644 (file)
@@ -22,14 +22,13 @@ Template = XObject.define(
         XObject.extend(this, cfg)
         //this.templateFile = templateFile;
         if (!this.templateFile  || !this.Link) {
-            throw {
-                "No templateFile or Link sent to Template Contructor..";
-            }
+            throw  "No templateFile or Link sent to Template Contructor..";
+            
         }
         
         
-        this.template = Gio.simple_read(templateFile);
-        this.templateName = GLib.path_get_basename(templateFile);
+        this.template = Gio.simple_read(this.templateFile);
+        this.templateName = GLib.path_get_basename(this.templateFile);
         this.code = "";
         this.parse();
     }, 
@@ -133,7 +132,7 @@ Template = XObject.define(
             var values = this.values;
             
             var makeSortby = this.makeSortby;
-            var makeSignature = this.makeSignature;
+            var makeSignature =   XObject.createDelegate(this.makeSignature, this);
             var summarize = this.summarize ;
             var makeFuncSkel = this.makeFuncSkel;
             var resolveLinks = this.resolveLinks;
@@ -142,15 +141,15 @@ Template = XObject.define(
             Template.data = data;
             
             var Link = this.Link;
-            
+            var Options = imports.Options ? imports.Options.Options : false;
             try {
                 eval(this.code);
-               } catch (e) {
+            } catch (e) {
                  Gio.simple_write('/tmp/template.js', this.code);
                  Seed.print('in /tmp/template.js');
                 throw e;
                 Seed.quit();
-                }
+            }
             
             
             //File.write("/tmp/jstookit_eval.js", this.code);
@@ -202,7 +201,7 @@ Template = XObject.define(
 
         makeSignature : function(params) {
             if (!params) return "()";
-            var _this = this;
+            var Link = this.Link;
             var signature = "("        +
                 params.filter(
                     function($) {
@@ -215,7 +214,7 @@ Template = XObject.define(
                         return "" +
                             ($.isOptional ? "[" : "") +
                             (($.type) ? 
-                                (new _this.Link().toSymbol(
+                                (new Link().toSymbol(
                                     (typeof($.type) == 'object' ) ? 'Function' : $.type
                                 )) + " " :  ""
                             )   +