JSDOC/TokenReader.js
[gnome.introspection-doc-generator] / JSDOC / DocComment.js
index 4332fff..42201ab 100644 (file)
@@ -1,8 +1,8 @@
 //<Script type="text/javascript">
 
-XObject = imports.XObject.XObject;
+const XObject = imports.XObject.XObject;
 
-DocTag = imports.DocTag.DocTag;
+const DocTag = imports.DocTag.DocTag;
 
 /**
  * Create a new DocComment. This takes a raw documentation comment,
@@ -12,7 +12,7 @@ DocTag = imports.DocTag.DocTag;
  */ 
  
 
-DocComment = XObject.define(
+const DocComment = XObject.define(
 
     function(/**String*/comment) {
         this.isUserComment = true;
@@ -26,34 +26,25 @@ DocComment = XObject.define(
     }, 
     Object, // extends
     {
-        this.isUserComment = true;
-        this.src           = "";
-        this.meta          = "";
-        this.tagTexts      = [];
-        this.tags          = [];     
+        isUserComment : true,
+        src           : "",
+        meta          : "",
+        tagTexts      : [],
+        tags          : [],     
     
         /**
          * serialize..
          */
-        toObject :function(t)
+        toJSON :function(t)
         {
             
-            var ret = { };
-            for (var i in this) {
-                switch (typeof(this[i])) {
-                    case 'function':
-                    case 'object':
-                       continue;
-                        
-                    case 'string':
-                    case 'number':
-                    case 'boolean':                    
-                        ret[i] = this[i]; continue;
-                    default:
-                        print("unknown type:" + typeof(this[i]));
-                        Seed.quit();
-                   }
-            }
+            var ret = { '*object' : 'DocComment' };
+            
+            var _this = this;
+            ['isUserComment','src', 'meta',  'tags'].forEach(function(k) {
+                ret[k] = _this[k];
+            })
+            
             return ret;
         },    
         /**