JSDOC/ScopeNamer.js
[app.jsdoc] / JSDOC / ScopeNamer.js
index 1272d6f..f82421a 100644 (file)
@@ -99,7 +99,10 @@ 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)  {
+            if (!this.filename.match(/BuildDocs\.js/)) return;
+            return   print(str);
+        }, 
         
         collapseTop : true,
         
@@ -132,9 +135,16 @@ ScopeNamer = XObject.define(
             this.debugCall("walkStatements :" + scope ) ;            
             var _this = this;
             var res = false;
-            
-            
-            statements.forEach(function(st ) {
+            var isGlobal = scope == '_global_';
+           
+            statements.some(function(st ) {
+                // handle change of scope..
+                if (isGlobal &&
+                        st[0].jsdoc &&
+                        st[0].jsdoc.getTag('scope').length
+                   ) {
+                    scope = st[0].jsdoc.getTag('scope');
+                }
                 
                 
                 res = _this.walkStatement(scope, st);
@@ -170,6 +180,8 @@ ScopeNamer = XObject.define(
                 print("GOT ignore?");
                 return true;
             }
+           
+            
             while (null != (token = this.next())) {
                 
                 //'function' 
@@ -320,10 +332,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;