[introspection-doc-generator] revert doc api to string, and let it work out how to find the doc - now works.



commit 3f7b5e6469dabb694d89d3be8c6239c0e6c938b6
Author: Alan Knowles <alan akbkhome com>
Date:   Sat Apr 16 17:13:49 2011 +0800

    revert doc api to string, and let it work out how to find the doc - now works.

 Introspect/Base.js      |    2 +-
 Introspect/Callback.js  |    2 +-
 Introspect/Constant.js  |    2 +-
 Introspect/Enum.js      |    2 +-
 Introspect/Method.js    |    8 ++++----
 Introspect/NameSpace.js |   15 ++++++++-------
 Introspect/Property.js  |    2 +-
 Introspect/Signal.js    |    2 +-
 8 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/Introspect/Base.js b/Introspect/Base.js
index 42efd44..c202fb8 100644
--- a/Introspect/Base.js
+++ b/Introspect/Base.js
@@ -52,7 +52,7 @@ var Base = XObject.define(
         this.implementedBy = []; // interface - which object uses it.
         this.extendsClasses = []; // what it extends...
         this.childClasses = []; // what 
-         this.desc = NameSpace.doc(ns,name );
+         this.desc = NameSpace.doc(ns+'.'+ name );
         
         
         var gi = GI.Repository.get_default();
diff --git a/Introspect/Callback.js b/Introspect/Callback.js
index c169c8a..0e7dd7f 100644
--- a/Introspect/Callback.js
+++ b/Introspect/Callback.js
@@ -36,7 +36,7 @@ var Callback = XObject.define(
             returns :   [ { type :  this.typeToName(GI.callable_info_get_return_type(sig)) } ]            
             
         });
-        this.desc =  NameSpace.doc(memberOf.alias ,  this.name);
+        this.desc =  NameSpace.doc(memberOf.alias +'.'+   this.name);
         //memberOf[saveto].push(this);
         //keylist.push(this.name);
         
diff --git a/Introspect/Constant.js b/Introspect/Constant.js
index b7cf15a..e572229 100644
--- a/Introspect/Constant.js
+++ b/Introspect/Constant.js
@@ -41,7 +41,7 @@ var Constant = XObject.define(
             }
         } 
          
-        this.desc = NameSpace.doc(memberOf.alias,  this.name)
+        this.desc = NameSpace.doc(memberOf.alias+'.'+   this.name)
 
         memberOf[saveto].push(this);
         keylist.push(this.name);
diff --git a/Introspect/Enum.js b/Introspect/Enum.js
index 8c316ac..a30da6c 100644
--- a/Introspect/Enum.js
+++ b/Introspect/Enum.js
@@ -25,7 +25,7 @@ var Enum = XObject.define(
                 return; // already loaded..
             }
             
-            this.desc = NameSpace.doc(this.alias,'');
+            this.desc = NameSpace.doc(this.alias);
             var bi = this.getBI();
                  
             for(var i =0; i < GI.enum_info_get_n_values(bi); i++) {
diff --git a/Introspect/Method.js b/Introspect/Method.js
index d3d32ea..93dedc4 100644
--- a/Introspect/Method.js
+++ b/Introspect/Method.js
@@ -35,14 +35,14 @@ var Method = XObject.define(
         var retval = [ { 
                 name : 0, 
                 type :  this.typeToName(GI.callable_info_get_return_type(m)),
-                desc : NameSpace.doc(memberOf.alias ,  n_original + '.return-value')
+                desc : NameSpace.doc(memberOf.alias +'.'+  n_original + '.return-value')
         } ];
 
         var args = this.argsToArrays(m, retval);
 
         if ((n == 'c_new') && !args.length && memberOf.constructors.length) {
 
-            memberOf.constructors[0].doc = NameSpace.doc(memberOf.alias ,  n_original);
+            memberOf.constructors[0].doc = NameSpace.doc(memberOf.alias +'.'+   n_original);
 
             return false; // skip.
         }
@@ -60,11 +60,11 @@ var Method = XObject.define(
             isStatic        : !(flags & GI.FunctionInfoFlags.IS_METHOD),
             memberOf        : memberOf.alias,
             exceptions      : [],
-            desc            : NameSpace.doc(memberOf.alias ,  n_original)
+            desc            : NameSpace.doc(memberOf.alias +'.'+  n_original)
         });
         // add descriptions to the arguments..
         this.params.map(function(p) {
-            p.desc = NameSpace.doc(memberOf.alias, n_original + '.' + p.name);
+            p.desc = NameSpace.doc(memberOf.alias+'.'+  n_original + '.' + p.name);
             //Seed.print(memberOf.alias + '.' + n_original + '.' + p.name + ':' +  p.desc);
         });
 
diff --git a/Introspect/NameSpace.js b/Introspect/NameSpace.js
index dc528c5..8330bd0 100644
--- a/Introspect/NameSpace.js
+++ b/Introspect/NameSpace.js
@@ -196,15 +196,16 @@ var NameSpace = {
         }
     },
 
-    doc : function(ns,what)
+    doc : function(what)
     {
         // invalid or empty namespace..
-        if (typeof(ns) == 'undefined' || -1 != ns.indexOf('.')) {
-            return '';
-        }
+        var ar = what.split('.');
+        var ns = ar.shift();
+        what = ar.join('.');
+        //print("doc get: " + ns + " what=" + what);
+         
         this.commentLoad(ns);
-        
-
+         
         return typeof(this.comments[ns][what]) == 'undefined' ?  '' : this.comments[ns][what];
     },
 
@@ -250,7 +251,7 @@ var NameSpace = {
                 path += '.signal';
             }
 
-            if (n) {
+            if (n && ((path != '') || (n != ns))) {
                 path += path.length ? '.' : '';
                 path += n;
             }
diff --git a/Introspect/Property.js b/Introspect/Property.js
index f8cf5b5..a0c508a 100644
--- a/Introspect/Property.js
+++ b/Introspect/Property.js
@@ -23,7 +23,7 @@ var Property = XObject.define(
         this.memberOf = memberOf.alias
         memberOf[saveto].push(this);
         keylist.push(this.name);
-        this.desc = NameSpace.doc(this.memberOf ,  n_original);
+        this.desc = NameSpace.doc(this.memberOf +'.'+  n_original);
         
 
         if (typeof(this.type) == 'string' && this.type.indexOf('.') > -1) {
diff --git a/Introspect/Signal.js b/Introspect/Signal.js
index 7d0cbef..e225ee0 100644
--- a/Introspect/Signal.js
+++ b/Introspect/Signal.js
@@ -33,7 +33,7 @@ var Signal = XObject.define(
             memberOf : memberOf.alias,
             exceptions : [],
             returns :   [ { type :  this.typeToName(GI.callable_info_get_return_type(sig)) } ],
-            desc : NameSpace.doc(memberOf.alias , 'signal.' + n_original)
+            desc : NameSpace.doc(memberOf.alias  +  '.signal.' + n_original)
         });
         memberOf[saveto].push(this);
         keylist.push(this.name);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]