JSDOC/Symbol.js
[gnome.introspection-doc-generator] / JSDOC / Symbol.js
index 9649444..991e35b 100644 (file)
@@ -3,9 +3,9 @@
 XObject         = imports.XObject.XObject;
 
 SymbolSet       = imports.SymbolSet.SymbolSet;
-Parser          = imports.Parser.Parser;
+//Parser          = imports.Parser.Parser;
 DocComment      = imports.DocComment.DocComment;
-
+DocTag          = imports.DocTag.DocTag;
 /**
        Create a new Symbol.
        @class Represents a symbol in the source code.
@@ -19,13 +19,101 @@ Symbol = XObject.define(
     Object,
     {
         
+        
+        name : "",
+        defaultValue : "",
+        params : [],
+        $args : [], // original arguments used when constructing.
+        addOn : "",
+        alias : "",
+        augments : false, // Doctag
+        author : "",
+        classDesc : "",
+        comment : { isUserComment: false },
+        deprecated : "",
+        desc : "",
+        events : [],
+        example : "",
+        exceptions : [],
+        inherits : [],
+        inheritsFrom : [],
+        isa : "OBJECT", // OBJECT//FUNCTION
+        isEvent : false,
+        isConstant : false,
+        isIgnored : false,
+        isInner : false,
+        isNamespace : false,
+        isPrivate : false,
+        isStatic : false,
+        memberOf : "",
+        methods : [],
+        _name : "",
+        _params : [],
+        properties : [],
+        requires : [],
+        returns : [],
+        see : [],
+        since : "",
+        srcFile : {},
+        type : "",
+        version : "",
+        childClasses : [],
+        cfgs : {},
+        
+        
             
-        /*
-        toQDump : function(t)
+        
+        toObject : function()
         {
-            return toQDump(t, 'Symbol.fromDump({', '})', {});//new Symbol());
+            
+            function array2object(a , m)
+            {
+                m = m || false;
+                var r = [];
+                a.forEach(function(e) {
+                    r.push(m ? e : e.toObject());
+                })
+            }
+            
+            var ret = { };
+            for (var i in this) {
+                if (Symbol.hide.indexOf(i) > -1) {
+                    continue;
+                }
+                switch (typeof(this[i])) {
+                    case 'function':
+                        continue;
+                    case 'object':
+                        switch(i) {
+                            //arrays..
+                            case 'params' : 
+                                ret[i] = array2object(this[i],true); 
+                                continue;
+                                
+                            //objects..
+                            case 'augments' : 
+                                print(JSON.stringify(this[i]));
+                                ret[i] = this[i].toObject();
+                                continue;
+                                
+                            default:
+                                print("object? :" + i);
+                                Seed.quit();
+                        }
+                        
+                        
+                    case 'string':
+                    case 'number':
+                        ret[i] = this[i]; continue;
+                    default:
+                        print("unknown type:" + typeof(this[i]));
+                        Seed.quit();
+                   }
+            }
+            
+            
         },
-        */
+        
         init : function() 
         {
             this.name = "";
@@ -461,7 +549,7 @@ Symbol = XObject.define(
                     if (properties[i].type) property.type = properties[i].type;
                     if (properties[i].defaultValue) property.defaultValue = properties[i].defaultValue;
                     this.addProperty(property);
-                    Parser.addSymbol(property);
+                    imports.Parser.Parser.addSymbol(property);
                 }
             }
             
@@ -719,12 +807,16 @@ Symbol = XObject.define(
                
             }
             return r;
-          }
+        }
 });
 
-
-
-
+/**
+ * Elements that are not serialized
+ * 
+ */
+Symbol.hide = [ 
+    '$args' // not needed AFAIK
+]
 
 Symbol.srcFile = ""; //running reference to the current file being parsed