JSDOC/ScopeNamer.js
[app.jsdoc] / JSDOC / ScopeNamer.js
index bdbc8c3..0a45749 100644 (file)
@@ -99,7 +99,11 @@ ScopeNamer = XObject.define(
          * add/remove ';' after return to configure at present..
          * @param {String} str String to output
          */
-        debugCall : function(str)  { return   print(str); }, 
+        debugCall : function(str)  {
+            return;
+            if (!this.filename.match(/BuildDocs\.js/)) return;
+            return   print(str);
+        }, 
         
         collapseTop : true,
         
@@ -140,6 +144,7 @@ ScopeNamer = XObject.define(
                         st[0].jsdoc &&
                         st[0].jsdoc.getTag('scope').length
                    ) {
+                    print(st[0].jsdoc.getTag('scope'));
                     scope = st[0].jsdoc.getTag('scope');
                 }
                 
@@ -238,7 +243,23 @@ ScopeNamer = XObject.define(
                     // only register names of objects if 
                     var name = this.lookTok(-2).data;
                     name = !isGlobal && isVar ? false : name;
+                    
                     name = !isGlobal && name && !name.match(/^this\./) ? false : name;
+                    if (!isGlobal && name && name.match(/^this\./) ) { 
+                        // see if scope ends in prototype..
+                        print(JSON.stringify(scope));
+                        if (
+                            (scope.split('.').pop() == 'prototype') &&
+                            (name.split('.').length == 2)
+                        ){
+                            name = name.split('.').pop();
+                        } else {
+                            name = false;
+                        }
+                        
+                    }  else {
+                        name = false;
+                    }
                     //print(JSON.stringify(token,null,4));
                     this.walkObject(scope, name, token.props, jd);
                     continue;
@@ -296,7 +317,12 @@ ScopeNamer = XObject.define(
                 case 'XObject.extend':
                 case 'Roo.apply':
                     //print(JSON.stringify(items,null,4));
-                    scope = items[0][0].data;
+                    // SHOULD WE ADD SCOPE HERE???
+                    var topscope = scope.split('.').pop();
+                    
+                    scope = (topscope == items[0][0].data) ?
+                        items[0][0].data :
+                        scope + '.' + items[0][0].data;
                     // 2nd arg is a object def
                     if (items[1][0].data != '{') {
                         return;
@@ -329,10 +355,12 @@ ScopeNamer = XObject.define(
                     
                     this.addSymbol(symbol, jsdocTok.jsdoc);
                     var sn = new ScopeNamer(this);
+                    //print(JSON.stringify(items, null,4));
+                    // ctr statements.
+                    sn.walkStatements(scope + '.prototype', items[0][2].items);
                     
                     
-                    sn.walkStatements(scope, items[0][2].items);
-                    sn.walkObject(scope + '.prototype', false, items[2].props );
+                    sn.walkObject(scope + '.prototype', false, items[2][0].props );
                     return;
                 
                 
@@ -406,9 +434,16 @@ ScopeNamer = XObject.define(
             // if a symbol alias is documented more than once the last one with the user docs wins
             
             // dumpe some invalid symbols..
-            if (symbol.alias.split(/[#.]/).length > 2) {
+            var ptype_ar = symbol.alias.split(/#/);
+            if (ptype_ar.length > 2) {
+                // multiple #
                 return;
             }
+            if (ptype_ar.length > 1 && ptype_ar[1].split(/\./).length > 1) {
+                // multiple . after #
+                return;
+            }
+            
             ScopeNamer.prototype.debugCall("addSymbol : " + symbol.alias );       
             
             if (ScopeNamer.symbols.hasSymbol(symbol.alias)) {