JSDOC/Scope.js
[gnome.introspection-doc-generator] / JSDOC / ScopeParser.js
index 7c06bd2..a7abc9c 100644 (file)
@@ -224,7 +224,7 @@ ScopeParser.prototype = {
         var isObjectLitAr = [ false ];
         var isInObjectLitAr;
         thisScope = scope;
-        if (thisScope) {
+        if (thisScope && thisScope.gid != this.scopes[this.scopes.length-1]) {
             this.scopes.push(scope);
         } else {
             thisScope = this.scopes[this.scopes.length-1]
@@ -426,7 +426,7 @@ ScopeParser.prototype = {
                 
                 case "STRN.DOUBLE_QUOTE": // used for object lit detection..
                 case "STRN.SINGLE_QUOTE":
-                    print('SCOPE-STRING:' + token.toString());
+                  //  print('SCOPE-STRING:' + token.toString());
                     //println("<i>"+token.data+"</i>");
 
                     if (this.ts.lookTok(-1).data == '{' && this.ts.lookTok(1).data == ':') {
@@ -461,22 +461,7 @@ ScopeParser.prototype = {
                     // got identifier..
                     
                     // look for  { ** : <- indicates obj literal.. ** this could occur with numbers ..
-                    if ((this.ts.lookTok(-1).data == "{") && (this.ts.lookTok(1).data == ":")) {
-                        isObjectLitAr.pop();
-                        isObjectLitAr.push(true);
-                        //print(">>>>>> OBJLIT REPUSH(true)");
-                        //println("<i>"+token.data+"</i>");
-                        break;
-                    }
-                   // print("DEAL WITH obj lit:");
-                    isInObjectLitAr = isObjectLitAr[isObjectLitAr.length-1];
-                    
-                    if (isInObjectLitAr && (this.ts.lookTok(1).data == ":") && (this.ts.lookTok(-1).data == ",")) {
-                        // skip, it's an object lit key..
-                        //println("<i>"+token.data+"</i>");
-                        break;
-                    }
-                    
+                     
                     
                     // skip anyting with "." before it..!!
                      
@@ -488,6 +473,9 @@ ScopeParser.prototype = {
                     //print("SYMBOL: " + token.toString());
                     
                     symbol = token.data;
+                    if (symbol == 'this') {
+                        break;
+                    }
                     if (this.mode == 'PASS2_SYMBOL_TREE') {
                         
                         //println("GOT IDENT: -2 : " + this.ts.lookT(-2).toString() + " <BR> ..... -1 :  " +  this.ts.lookT(-1).toString() + " <BR> "); 
@@ -523,7 +511,7 @@ ScopeParser.prototype = {
                     if (token.type != 'KEYW') {
                         break;
                     }
-                    print('SCOPE-KEYW:' + token.toString());
+                    //print('SCOPE-KEYW:' + token.toString());
                    // print("Check eval:");
                 
                     symbol = token.data;
@@ -653,7 +641,7 @@ ScopeParser.prototype = {
                                     // key value..
                                     
                                     this.ts = new TokenStream(token.props[prop].val);
-                                    this.parseScope(currentScope);
+                                    this.parseScope(false);
                                     
                                 }
                                 this.ts = curTS;
@@ -723,7 +711,9 @@ ScopeParser.prototype = {
                         //skip '.'
                         break;
                     }
-                    
+                    if (symbol == 'this') {
+                        break;
+                       }
                     
                     if (this.mode == 'PASS2_SYMBOL_TREE') {
 
@@ -741,7 +731,7 @@ ScopeParser.prototype = {
                                 //print("Found an undeclared symbol: " + symbol + ' (line:' + token.line + ')');
                                 //throw "OOPS";
                             } else {
-                                print("undeclared:" + token.toString())
+                                //print("undeclared:" + token.toString())
                             }
                             
                             
@@ -868,7 +858,7 @@ ScopeParser.prototype = {
 
         //assert token.getType() == Token.LP;
         if (this.mode == 'BUILDING_SYMBOL_TREE') {
-            fnScope = new Scope(this.braceNesting, currentScope, token.n, '');
+            fnScope = new Scope(1, currentScope, token.n, '');
             
             //println("STORING SCOPE" + this.ts.cursor);
             
@@ -915,6 +905,7 @@ ScopeParser.prototype = {
             _this.ts = new TokenStream(tar);
             _this.parseScope(fnScope);
             
+            
         });
         
         //print(JSON.stringify(this.ts,null,4));