JSDOC/ScopeParser.js
authorAlan Knowles <alan@akbkhome.com>
Thu, 15 Jul 2010 08:52:27 +0000 (16:52 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 15 Jul 2010 08:52:27 +0000 (16:52 +0800)
JSDOC/ScopeParser.js

index a7abc9c..b77f6ee 100644 (file)
@@ -277,7 +277,7 @@ ScopeParser.prototype = {
                         
 
                         if (this.mode == "BUILDING_SYMBOL_TREE") {
-                            identifier = thisScope.getIdentifier(token.data) ;
+                            identifier = thisScope.getIdentifier(token.data,token) ;
                             
                             if (identifier == false) {
                                 thisScope.declareIdentifier(token.data, token);
@@ -485,7 +485,7 @@ ScopeParser.prototype = {
                         //println("GOT IDENT: <B>" + symbol + "</B><BR/>");
                              
                             //println("GOT IDENT (2): <B>" + symbol + "</B><BR/>");
-                        identifier = this.getIdentifier(symbol, thisScope);
+                        identifier = this.getIdentifier(symbol, thisScope, token);
                         
                         if (identifier == false) {
 // BUG!find out where builtin is defined...
@@ -525,7 +525,7 @@ ScopeParser.prototype = {
                                 var _t = this;
                                 this.ts.look(-1).data.replace(/eval:var:([a-z_]+)/ig, function(m, a) {
                                     
-                                    var hi = _t.getIdentifier(a, thisScope);
+                                    var hi = _t.getIdentifier(a, thisScope, token);
                                    // println("PROTECT "+a+" from munge" + (hi ? "FOUND" : "MISSING"));
                                     if (hi) {
                                      //   println("PROTECT "+a+" from munge");
@@ -717,7 +717,7 @@ ScopeParser.prototype = {
                     
                     if (this.mode == 'PASS2_SYMBOL_TREE') {
 
-                        identifier = this.getIdentifier(symbol, currentScope);
+                        identifier = this.getIdentifier(symbol, currentScope, token);
                         //println("<B>??</B>");
                         if (identifier == false) {
 
@@ -767,7 +767,7 @@ ScopeParser.prototype = {
                                 // look for eval:var:noreplace\n
                                 var _t = this;
                                 this.ts.look(-1).data.replace(/eval:var:([a-z]+)/ig, function(m, a) {
-                                    var hi = _t.getIdentifier(a, currentScope);
+                                    var hi = _t.getIdentifier(a, currentScope, token);
                                    //println("PROTECT "+a+" from munge" + (hi ? "FOUND" : "MISSING"));
                                     if (hi) {
                                       //  println("PROTECT "+a+" from munge");
@@ -822,7 +822,7 @@ ScopeParser.prototype = {
             currentScope.declareIdentifier(symbol, token);
         } else {
             //?? why inc the refcount?? - that should be set when building the tree???
-            identifier = this.getIdentifier(symbol, currentScope);
+            identifier = this.getIdentifier(symbol, currentScope, token);
             identifier.refcount++;
         }
 
@@ -848,7 +848,7 @@ ScopeParser.prototype = {
             if (this.mode == 'BUILDING_SYMBOL_TREE') {
                 // Get the name of the function and declare it in the current scope.
                 symbol = token.data;
-                if (currentScope.getIdentifier(symbol) != false) {
+                if (currentScope.getIdentifier(symbol,token) != false) {
                     this.warn("The function " + symbol + " has already been declared in the same scope...", true);
                 }
                 currentScope.declareIdentifier(symbol,token);
@@ -937,10 +937,10 @@ ScopeParser.prototype = {
         scope.preventMunging();
     },
     
-    getIdentifier: function(symbol, scope) {
+    getIdentifier: function(symbol, scope, token) {
         var identifier;
         while (scope != false) {
-            identifier = scope.getIdentifier(symbol);
+            identifier = scope.getIdentifier(symbol, token);
             //println("ScopeParser.getIdentgetUsedSymbols("+symbol+")=" + scope.getUsedSymbols().join(','));
             if (identifier) {
                 return identifier;