# HG changeset patch # User Mike Pavone # Date 1332833972 25200 # Node ID fe3533494ce987d28f58040a0e28b2e40965f223 # Parent 068d63627b1604d0878b1fe4bac528e933e76ba1 Display symbols order first by depth. Eliminate extraneous setter symbols diff -r 068d63627b16 -r fe3533494ce9 compiler.js --- a/compiler.js Mon Mar 26 21:29:03 2012 -0700 +++ b/compiler.js Tue Mar 27 00:39:32 2012 -0700 @@ -45,12 +45,22 @@ } return 'this'; } -osymbols.prototype.allSymbols = function() { - var start = this.parent ? this.parent.allSymbols() : {}; - for (var key in this.names) { - start[key] = this.names[key]; +osymbols.prototype.allSymbols = function(curlist, cursyms) { + if (curlist === undefined) { + curlist = []; + cursyms = {}; } - return start; + var keys = Object.keys(this.names).sort(); + for (var i in keys) { + if (!(keys[i] in cursyms)) { + curlist.push(keys[i]); + cursyms[keys[i]] = true; + } + } + if (this.parent) { + return this.parent.allSymbols(curlist, cursyms); + } + return curlist; } function lsymbols(parent) @@ -202,9 +212,8 @@ this.symbols = symbols; }; assignment.prototype.populateSymbolsObject = function(symbols) { - console.log('populateSymbolsObject for assignment to ' + this.symbol.name) symbols.defineMsg(this.symbol.name, this.expression); - if (!(this.expression instanceof lambda)) { + if (!(this.expression instanceof lambda) && !(this.expression instanceof funcall && this.expression.name == 'foreign:')) { symbols.defineMsg(this.symbol.name + '!', new setter(null)); } this.symbol.populateSymbols(symbols); diff -r 068d63627b16 -r fe3533494ce9 editor.tp --- a/editor.tp Mon Mar 26 21:29:03 2012 -0700 +++ b/editor.tp Tue Mar 27 00:39:32 2012 -0700 @@ -52,7 +52,7 @@ inscope innerHTML!: "" console log: astnode syms <- (astnode symbols) allSymbols - each: ((Object keys: syms) sort) :idx key { + each: syms :idx key { inscope appendChild: (newEl: "li" #{ textContent <- key })