X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=JSDOC%2FScope.js;h=dbb3e0976c9f269c0a127ae5fb16d1041e39532f;hb=35ddfbdfc0fb33aab65d6722db3948ca210ede7f;hp=59a362e92f68e1c911e27284c03f300b8b3f7497;hpb=a7a945ed9123ac3d29dad1eb2693b95cee3bcc71;p=gnome.introspection-doc-generator diff --git a/JSDOC/Scope.js b/JSDOC/Scope.js index 59a362e..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 + ' '); + }); + + + }, + + + declareIdentifier : function(symbol, token) + { - print("SCOPE : " + this.gid + " :SYM: " + symbol + " " + token.toString()+""); + //print("SCOPE : " + this.gid + " :SYM: " + symbol + " " + token.toString()+""); if (typeof(this.identifiers[symbol])== 'undefined') {