JSDOC/TokenReader.js
[gnome.introspection-doc-generator] / JSDOC / SymbolSet.js
index fcefaa1..5843a94 100644 (file)
@@ -2,10 +2,12 @@
 
  
 XObject         = imports.XObject.XObject;
+DocComment      = imports.DocComment.DocComment;
+// circular references..
 ///Options         = imports.BuildDocs.Options;
 //Parser          = imports.Parser.Parser;
-Symbol          = imports.Symbol.Symbol;
-DocComment      = imports.DocComment.DocComment;
+//Symbol          = imports.Symbol.Symbol;
+
 
 
 SymbolSet = XObject.define(
@@ -15,11 +17,15 @@ SymbolSet = XObject.define(
     Object,
     {
         
+        _index : false,
+        
+        
         init : function() {
             this._index = {};
         },
 
-        keys : function() {
+        keys : function() 
+        {
             var found = [];
             for (var p in this._index) {
                 found.push(p);
@@ -29,12 +35,14 @@ SymbolSet = XObject.define(
 
 
         hasSymbol : function(alias) {
-            return this.keys().indexOf(alias) > -1;
+            return typeof(this._index[alias]) != 'undefined';
+            //return this.keys().indexOf(alias) > -1;
         },
 
         addSymbol : function(symbol) {
             //print("ADDING SYMBOL:"+symbol.alias.toString());
             
+            
             if (this.hasSymbol(symbol.alias)) {
                 imports.BuildDocs.Options.LOG.warn("Overwriting symbol documentation for: "+symbol.alias + ".");
             }
@@ -54,6 +62,17 @@ SymbolSet = XObject.define(
             }
             return found;
         },
+        /**
+         * for serializing
+         */
+        toJSON : function() {
+            return {
+                '*object' : 'SymbolSet',
+                _index : this._index
+            };
+            
+        },
+
 
         deleteSymbol : function(alias) {
             if (!this.hasSymbol(alias)) return;
@@ -80,6 +99,9 @@ SymbolSet = XObject.define(
         resolveBorrows : function() {
             for (p in this._index) {
                 var symbol = this._index[p];
+                
+                
+                
                 if (symbol.is("FILE") || symbol.is("GLOBAL")) continue;
                 
                 var borrows = symbol.inherits;
@@ -192,7 +214,7 @@ SymbolSet = XObject.define(
                            // print("symbol NOT a BUILT IN - createing a container");
                             // Eg. Ext.y.z (missing y)
                             // we need to add in the missing symbol...
-                            container = new Symbol(symbol.memberOf, [], "OBJECT", new DocComment(""));
+                            container = new imports.Symbol.Symbol(symbol.memberOf, [], "OBJECT", new DocComment(""));
                             container.isNamespace = true;
                             this.addSymbol( container );
                            // print(container.toSource());
@@ -227,10 +249,10 @@ SymbolSet = XObject.define(
                     if (contributer) {
                         contributer.childClasses.push(symbol.alias);
                         symbol.inheritsFrom.push(contributer.alias);
-                        if (!isUnique(symbol.inheritsFrom)) {
-                            imports.BuildDocs.Options.LOG.warn("Can't resolve augments: Circular reference: "+symbol.alias+" inherits from "+contributer.alias+" more than once.");
-                        }
-                        else {
+                        //if (!isUnique(symbol.inheritsFrom)) {
+                        //    imports.BuildDocs.Options.LOG.warn("Can't resolve augments: Circular reference: "+symbol.alias+" inherits from "+contributer.alias+" more than once.");
+                        //}
+                        //else {
                             var cmethods = contributer.methods;
                             var cproperties = contributer.properties;
                             var cfgs = contributer.cfgs;
@@ -245,7 +267,7 @@ SymbolSet = XObject.define(
                             }
                             
                                 
-                        }
+                        //}
                     }
                     else {
                         
@@ -304,6 +326,7 @@ SymbolSet = XObject.define(
             //while(addAugments(symbol.augments) >  0) { }
             
         }
+         
 })
 
 SymbolSet.isBuiltin = function(name) {