JSDOC/Symbol.js
[gnome.introspection-doc-generator] / JSDOC / Symbol.js
index 64c40fe..10dff41 100644 (file)
@@ -26,17 +26,17 @@ Symbol = XObject.define(
         $args : [], // original arguments used when constructing.
         addOn : "",
         alias : "",
-        augments : [],
+        augments : [], // Doctag[]
         author : "",
         classDesc : "",
-        comment : { isUserComment: false },
+        comment : {},
         deprecated : "",
         desc : "",
-        events : [],
+        //events : false,
         example : "",
-        exceptions : [],
-        inherits : [],
-        inheritsFrom : [],
+        exceptions : [],  // Doctag[]
+        inherits : [],  // Doctag[]
+        //inheritsFrom : [],
         isa : "OBJECT", // OBJECT//FUNCTION
         isEvent : false,
         isConstant : false,
@@ -46,13 +46,13 @@ Symbol = XObject.define(
         isPrivate : false,
         isStatic : false,
         memberOf : "",
-        methods : [],
+        methods : [], // Symbol[]
         _name : "",
-        _params : [],
-        properties : [],
-        requires : [],
-        returns : [],
-        see : [],
+        _params : [], //Doctag[]
+        properties : [], //Doctag[]
+        requires : [],  //Doctag[]
+        returns : [], //Doctag[]
+        see : [], //Doctag[]
         since : "",
         srcFile : {},
         type : "",
@@ -66,13 +66,14 @@ Symbol = XObject.define(
         toObject : function()
         {
             
-            function array2object(a , m)
+            function array2object(a)
             {
-                m = m || false;
+                
                 var r = [];
                 a.forEach(function(e) {
-                    r.push(m ? e : e.toObject());
-                })
+                    r.push(e.toObject());
+                });
+                return r;
             }
             
             var ret = { };
@@ -87,14 +88,37 @@ Symbol = XObject.define(
                         switch(i) {
                             //arrays..
                             case 'params' : 
+                            case 'augments' :                             
+                            case 'exceptions' :  
+                            case 'inherits' :
+                            case 'methods' :
+                            case '_params': 
+                            case 'properties': 
+                            case 'requires':
+                            case 'returns':
+                            case 'see':
                                 ret[i] = array2object(this[i],true); 
                                 continue;
+
                                 
+                            case 'cfgs': // key val of doctags..
+                                ret[i] = {}
+                                for(k in this[i]) {
+                                    ret[i][k] = this[i][k].toObject()
+                                }
+                                continue;
                             //objects..
-                            case 'augments' : 
-                                ret[i] = this[i].toArray();
+                            
+                            case 'comment' :
+                                print(JSON.stringify(this[i]));
+                                ret[i] = this[i].toObject();
                                 continue;
-                                
+                            
+                            //skip
+                            case 'inheritsFrom':
+                            case 'childClasses':
+                                continue;
+            
                             default:
                                 print("object? :" + i);
                                 Seed.quit();
@@ -103,58 +127,45 @@ Symbol = XObject.define(
                         
                     case 'string':
                     case 'number':
+                    case 'boolean':
                         ret[i] = this[i]; continue;
                     default:
                         print("unknown type:" + typeof(this[i]));
                         Seed.quit();
                    }
             }
-            
+            return ret;
             
         },
         
         init : function() 
         {
-            this.name = "";
-            this.defaultValue = "";
+            // only initialize arrays / objects..
             this.params = [];
             this.$args = [];
-            this.addOn = "";
-            this.alias = "";
-            this.augments = [];
-            this.author = "";
-            this.classDesc = "";
-            this.comment = { isUserComment: false };
-            //this.defaultValue = null;
-            this.deprecated = "";
-            this.desc = "";
-            this.events = [];
-            this.example = "";
+            
+            //this.events = [];
             this.exceptions = [];
             this.inherits = [];
-            this.inheritsFrom = [];
+            //
             this.isa = "OBJECT"; // OBJECT//FUNCTION
-            this.isEvent = false;
-            this.isConstant = false;
-            this.isIgnored = false;
-            this.isInner = false;
-            this.isNamespace = false;
-            this.isPrivate = false;
-            this.isStatic = false;
-            this.memberOf = "";
             this.methods = [];
-            this._name = "";
             this._params = [];
             this.properties = [];
             this.requires = [];
             this.returns = [];
             this.see = [];
-            this.since = "";
             this.srcFile = {};
-            this.type = "";
-            this.version = "";
-            this.childClasses = [];
+            
+            
             this.cfgs = {};
+            // derived later?
+            this.inheritsFrom = [];
+            this.childClasses = [];
+            
+            this.comment = new DocComment();
+            this.comment.isUserComment =  false;
+            
                
         },