JSDOC/Scope.js
[gnome.introspection-doc-generator] / JSDOC / Scope.js
index dbb3e09..425a385 100644 (file)
@@ -9,6 +9,7 @@
 const Identifier = imports.Identifier.Identifier
 const XObject = imports.XObject.XObject; 
 
+Scope.id = 1;
 
 function Scope(braceN, parent, startTokN, lastIdent, token)
 {
@@ -18,7 +19,7 @@ function Scope(braceN, parent, startTokN, lastIdent, token)
     
     this.braceN = braceN
     this.parent = parent;
-    this.id = startTokN;
+    this.id = Scope.id++;
     this.identifiers = { };
     this.subScopes = [];
     this.hints = { };
@@ -61,10 +62,17 @@ Scope.prototype = {
     dump : function(indent) 
     {
         indent = indent || '';
+        var str = '';
+        for (var k in this.identifiers) {
+            str += str.length ? ", " : "";
+            str += k + '=>' + this.identifiers[k].mungedValue;
+        }
+        
         print(
-            indent +  "Scope: " + this.id + "\n" +
-            indent + "Started: " + ( this.token ? this.token.line  : 'TOP' ) + "\n" +
-            indent + "- " + XObject.keys(this.identifiers).join(", ") + "\n"
+            indent + "Scope: " + this.id + "\n" +
+            
+            indent + "Started: " + ( this.token ? this.token.toString(): 'TOP' ) + "\n" +
+            indent + "- " + str + "\n"
         );
         this.subScopes.forEach(function(s) {
             s.dump(indent + ' ');