X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=JSDOC%2FScope.js;h=dbb3e0976c9f269c0a127ae5fb16d1041e39532f;hb=b85554bcc3d6985efcf6691a161dea7c85d9d81b;hp=6b636639fe97aeeb299e37e46e9408657858c7bc;hpb=9b8f8a93d4fc39c8d75d99849dce21a0656267fa;p=gnome.introspection-doc-generator diff --git a/JSDOC/Scope.js b/JSDOC/Scope.js index 6b63663..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,7 +24,7 @@ function Scope(braceN, parent, startTokN, lastIdent, token) this.hints = { }; this.ident = lastIdent; this.gid = Scope.gid++; - + this.token = token; //print("ADD SCOPE(" + this.gid + ") TO "+ (parent ? this.parent.gid : 'TOP') + ' : ' + // (token ? token.toString() : '')); @@ -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]; },