comparison compiler.js @ 25:4d87c38404d6

List literals, fixes to implicit self property lookup, import statement and editor improvements
author Mike Pavone <pavone@retrodev.com>
date Mon, 02 Apr 2012 22:28:48 -0700
parents fe3533494ce9
children 608eb70fe261
comparison
equal deleted inserted replaced
24:fe3533494ce9 25:4d87c38404d6
128 return mainModule.snumber(val); 128 return mainModule.snumber(val);
129 } 129 }
130 throw new Error("can't make val into object"); 130 throw new Error("can't make val into object");
131 } 131 }
132 132
133 function setP(o, p, val)
134 {
135 o[p] = val;
136 return o;
137 }
138
139 function getP(o, p)
140 {
141 return o[p];
142 }
143
144 op.prototype.populateSymbols = function(symbols, isReceiver) { 133 op.prototype.populateSymbols = function(symbols, isReceiver) {
145 this.left.populateSymbols(symbols); 134 this.left.populateSymbols(symbols);
146 this.right.populateSymbols(symbols); 135 this.right.populateSymbols(symbols);
147 }; 136 };
148 137
157 } 146 }
158 147
159 strlit.prototype.populateSymbols = function(symbols) { 148 strlit.prototype.populateSymbols = function(symbols) {
160 } 149 }
161 150
151 listlit.prototype.populateSymbols = function(symbols) {
152 each(this.val, function(i,el) {
153 el.populateSymbols(symbols);
154 });
155 }
156
162 funcall.prototype.populateSymbols = function(symbols) { 157 funcall.prototype.populateSymbols = function(symbols) {
163 if(this.name == 'q:') { console.log('populateSymbols', this); }
164 if (this.name == 'foreign:') { 158 if (this.name == 'foreign:') {
165 if ((this.args[0] instanceof lambda) || (this.args[0] instanceof object) || (this.args[0] instanceof symbol)) { 159 if ((this.args[0] instanceof lambda) || (this.args[0] instanceof object) || (this.args[0] instanceof symbol)) {
166 return; 160 return;
167 } else { 161 } else {
168 throw new Error("Unexpected AST type for foreign:"); 162 throw new Error("Unexpected AST type for foreign:");
175 if (this.receiver) { 169 if (this.receiver) {
176 this.receiver.populateSymbols(symbols); 170 this.receiver.populateSymbols(symbols);
177 } 171 }
178 } 172 }
179 173
174 funcall.prototype.populateSymbolsObject = function(symbols) {
175 this.populateSymbols(symbols.parent);
176 }
177
180 object.prototype.populateSymbols = function(symbols) { 178 object.prototype.populateSymbols = function(symbols) {
181 symbols = new osymbols(symbols); 179 symbols = new osymbols(symbols);
182 for (var i in this.messages) { 180 for (var i in this.messages) {
183 this.messages[i].populateSymbolsObject(symbols); 181 this.messages[i].populateSymbolsObject(symbols);
184 } 182 }