JSDOC/ScopeParser.js
authoralan <alan@alanfast.akbkhome.com>
Mon, 19 Apr 2010 06:57:45 +0000 (14:57 +0800)
committeralan <alan@alanfast.akbkhome.com>
Mon, 19 Apr 2010 06:57:45 +0000 (14:57 +0800)
JSDOC/ScopeParser.js

index 7512ce4..14e21ca 100644 (file)
@@ -551,7 +551,7 @@ ScopeParser.prototype = {
                     break;
                 */
                 case 'NAME':
-                case 'KEYW':
+               
                     symbol = token.data;
                     if (this.ts.lookTok(-1).data == "{"  && this.ts.lookTok(1).data == ":") {
                         // then we are in an object lit.. -> we need to flag the brace as such...
@@ -569,11 +569,39 @@ ScopeParser.prototype = {
                         break;
                     }
                     
+                     if (this.mode == 'CHECKING_SYMBOL_TREE') {
+
+                        identifier = this.getIdentifier(symbol, currentScope);
+                        //println("<B>??</B>");
+                        if (identifier == false) {
+
+                            if (symbol.length <= 3 &&  Scope.builtin.indexOf(symbol) < 0) {
+                                // Here, we found an undeclared and un-namespaced symbol that is
+                                // 3 characters or less in length. Declare it in the global scope.
+                                // We don't need to declare longer symbols since they won't cause
+                                // any conflict with other munged symbols.
+                                this.globalScope.declareIdentifier(symbol, token);
+                                this.warn("Found an undeclared symbol: " + symbol, true);
+                            } else {
+                                //println("undeclared")
+                            }
+                            
+                            
+                        } else {
+                            //println("<B>++</B>");
+                            token.identifier = identifier;
+                            identifier.refcount++;
+                        }
+                        
+                    }
+                    break;
                     
                     
-                    //println("<B>EID</B>");
                     
                     
+                    //println("<B>EID</B>");
+                 case 'KEYW':    
+                    symbol = token.data;
                     if (this.mode == 'BUILDING_SYMBOL_TREE') {
 
                         if (symbol == "eval") {
@@ -600,32 +628,7 @@ ScopeParser.prototype = {
                         }
                         break;
                     } 
-                    if (this.mode == 'CHECKING_SYMBOL_TREE') {
-
-                        identifier = this.getIdentifier(symbol, currentScope);
-                        //println("<B>??</B>");
-                        if (identifier == false) {
-
-                            if (symbol.length <= 3 &&  Scope.builtin.indexOf(symbol) < 0) {
-                                // Here, we found an undeclared and un-namespaced symbol that is
-                                // 3 characters or less in length. Declare it in the global scope.
-                                // We don't need to declare longer symbols since they won't cause
-                                // any conflict with other munged symbols.
-                                this.globalScope.declareIdentifier(symbol, token);
-                                this.warn("Found an undeclared symbol: " + symbol, true);
-                            } else {
-                                //println("undeclared")
-                            }
-                            
-                            
-                        } else {
-                            //println("<B>++</B>");
-                            token.identifier = identifier;
-                            identifier.refcount++;
-                        }
-                        
-                    }
-                    break;
+                   
             }
             if (!this.ts.nextTok()) break;
         }