changeset 24:fe3533494ce9

Display symbols order first by depth. Eliminate extraneous setter symbols
author Mike Pavone <pavone@retrodev.com>
date Tue, 27 Mar 2012 00:39:32 -0700
parents 068d63627b16
children 4d87c38404d6
files compiler.js editor.tp
diffstat 2 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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
 		})