X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JSDOC%2FScope.js;h=dbb3e0976c9f269c0a127ae5fb16d1041e39532f;hp=41bbf1021b568f9719d6de8c809123e0787c74f8;hb=b85554bcc3d6985efcf6691a161dea7c85d9d81b;hpb=1bd252155a7c4304ae8cfbad003afe0a8f3fc275 diff --git a/JSDOC/Scope.js b/JSDOC/Scope.js index 41bbf10..dbb3e09 100644 --- a/JSDOC/Scope.js +++ b/JSDOC/Scope.js @@ -6,8 +6,8 @@ * // FIXME - I need this to do next() without doccomments.. */ -Identifier = imports.Identifier.Identifier -XObject = imports.XObject.XObject; +const Identifier = imports.Identifier.Identifier +const XObject = imports.XObject.XObject; function Scope(braceN, parent, startTokN, lastIdent, token) @@ -24,9 +24,9 @@ function Scope(braceN, parent, startTokN, lastIdent, token) this.hints = { }; this.ident = lastIdent; this.gid = Scope.gid++; - - print("ADD SCOPE(" + this.gid + ") TO "+ (parent ? this.parent.gid : 'TOP')) + ' : ' + - token ? token.toString() : ''); + this.token = token; + //print("ADD SCOPE(" + this.gid + ") TO "+ (parent ? this.parent.gid : 'TOP') + ' : ' + + // (token ? token.toString() : '')); if (parent) { this.parent.subScopes.push(this); @@ -53,9 +53,31 @@ Scope.prototype = { munged : false, protectedVars : {}, // only used by to parent.. - declareIdentifier : function(symbol, token) { + + /** + * dump the scope to StdOut... + * + */ + dump : function(indent) + { + indent = indent || ''; + print( + indent + "Scope: " + this.id + "\n" + + indent + "Started: " + ( this.token ? this.token.line : 'TOP' ) + "\n" + + indent + "- " + XObject.keys(this.identifiers).join(", ") + "\n" + ); + this.subScopes.forEach(function(s) { + s.dump(indent + ' '); + }); - print("SCOPE : " + this.gid + " : " + token.toString()+""); + + }, + + + declareIdentifier : function(symbol, token) + { + + //print("SCOPE : " + this.gid + " :SYM: " + symbol + " " + token.toString()+""); if (typeof(this.identifiers[symbol])== 'undefined') { @@ -70,6 +92,8 @@ Scope.prototype = { // then it's global... this.identifiers[symbol].toMunge = false; } + + this.addToParentScope(symbol); return this.identifiers[symbol]; }, @@ -79,10 +103,10 @@ Scope.prototype = { return false; } - print("SCOPE : " + this.gid +" = SYMBOL NOT FOUND?" + token.toString()); + //print("SCOPE : " + this.gid +" = SYMBOL NOT FOUND?" + token.toString()); return false; } - print("SCOPE : " + this.gid +" = FOUND:" + token.toString()); + //print("SCOPE : " + this.gid +" = FOUND:" + token.toString()); return this.identifiers[symbol]; }, @@ -239,7 +263,7 @@ Scope.prototype = { if (!repsym.length) { if (!freeSymbols.length) { - addSyms(JSDOC.Scope.twos); + addSyms(Scope.twos); } repsym = freeSymbols.shift(); // pop off beginngin??? }