JSDOC/ScopeParser.js
authoralan <alan@alanfast.akbkhome.com>
Mon, 19 Apr 2010 07:29:01 +0000 (15:29 +0800)
committeralan <alan@alanfast.akbkhome.com>
Mon, 19 Apr 2010 07:29:01 +0000 (15:29 +0800)
JSDOC/ScopeParser.js

index 86789cd..faac24c 100644 (file)
@@ -476,53 +476,53 @@ ScopeParser.prototype = {
             
             //println("<i>"+token.data+"</i>");
             
-            switch (token.data.toUpperCase()) {
-
-                case ';':
-                case ',':
-                    if (this.braceNesting == expressionBraceNesting &&
-                            bracketNesting == 0 &&
-                            parensNesting == 0) {
-                        
-                        return;
-                    }
-                    break;
+            switch (token.type) {
+                case 'PUNC':
+                    switch(token.data) {
+                         
+                        case ';':
+                        case ',':
+                            if (this.braceNesting == expressionBraceNesting &&
+                                    bracketNesting == 0 &&
+                                    parensNesting == 0) {
+                                
+                                return;
+                            }
+                            break;
 
-                case 'FUNCTION':
-                    this.parseFunctionDeclaration();
-                    break;
+                       
 
-                case '{': //Token.LC:
-                    isObjectLitAr.push(false);
-                    
-                    this.braceNesting++;
-                    break;
+                        case '{': //Token.LC:
+                            isObjectLitAr.push(false);
+                            
+                            this.braceNesting++;
+                            break;
 
-                case '}': //Token.RC:
-                    this.braceNesting--;
-                    isObjectLitAr.pop();
-                    
-                   // assert braceNesting >= expressionBraceNesting;
-                    break;
+                        case '}': //Token.RC:
+                            this.braceNesting--;
+                            isObjectLitAr.pop();
+                            
+                           // assert braceNesting >= expressionBraceNesting;
+                            break;
 
-                case '[': //Token.LB:
-                    bracketNesting++;
-                    break;
+                        case '[': //Token.LB:
+                            bracketNesting++;
+                            break;
 
-                case ']': //Token.RB:
-                    bracketNesting--;
-                    break;
+                        case ']': //Token.RB:
+                            bracketNesting--;
+                            break;
 
-                case '(': //Token.LP:
-                    parensNesting++;
-                    break;
+                        case '(': //Token.LP:
+                            parensNesting++;
+                            break;
 
-                case ')': //Token.RP:
-                    parensNesting--;
+                        case ')': //Token.RP:
+                            parensNesting--;
+                            break;
+                    }
                     break;
-            }
-            switch(token.type) {
-                   
+                    
                 case 'STRN': // used for object lit detection..
                     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...
@@ -548,16 +548,8 @@ ScopeParser.prototype = {
                     
                     break;
                 
-                  
-                    
-                /*
-                case Token.SPECIALCOMMENT:
-                    if (mode == BUILDING_SYMBOL_TREE) {
-                        protectScopeFromObfuscation(currentScope);
-                        this.warn("Using JScript conditional comments is not recommended." + (munge ? " Moreover, using JScript conditional comments reduces the level of compression!" : ""), true);
-                    }
-                    break;
-                */
+                      
+             
                 case 'NAME':
                
                     symbol = token.data;
@@ -608,7 +600,16 @@ ScopeParser.prototype = {
                     
                     
                     //println("<B>EID</B>");
-                 case 'KEYW':    
+                 case 'KEYW':   
+                 
+                    if (token.name == "FUNCTION") {
+                        
+                        this.parseFunctionDeclaration();
+                        break;
+                    }
+               
+                    
+             
                     symbol = token.data;
                     if (this.mode == 'BUILDING_SYMBOL_TREE') {