comparison compiler.js @ 314:d4df33596e7d

Make modules in earlier module directories take precedence over ones in later directories
author Michael Pavone <pavone@retrodev.com>
date Sat, 14 Mar 2015 12:10:40 -0700
parents 0dc7322590da
children eef8a5cea812
comparison
equal deleted inserted replaced
313:f2aff12d8e87 314:d4df33596e7d
76 for (var dirnum in moduledirs) { 76 for (var dirnum in moduledirs) {
77 var results = os.system("ls", [moduledirs[dirnum]]).split('\n'); 77 var results = os.system("ls", [moduledirs[dirnum]]).split('\n');
78 for (var i in results) { 78 for (var i in results) {
79 var tpidx = results[i].indexOf('.tp') 79 var tpidx = results[i].indexOf('.tp')
80 if (tpidx > 0 && tpidx == results[i].length - 3) { 80 if (tpidx > 0 && tpidx == results[i].length - 3) {
81 this.names[results[i].substr(0, tpidx)] = new modulefile(moduledirs[dirnum], results[i]); 81 var moduleName = results[i].substr(0, tpidx);
82 if (!(moduleName in this.names)) {
83 this.names[moduleName] = new modulefile(moduledirs[dirnum], results[i]);
84 }
82 } 85 }
83 } 86 }
84 } 87 }
85 } 88 }
86 } 89 }
400 } 403 }
401 } else if (this.name == 'llMessage:withVars:andCode:' && symbols instanceof osymbols) { 404 } else if (this.name == 'llMessage:withVars:andCode:' && symbols instanceof osymbols) {
402 if (this.args[0] instanceof symbol || this.args[0] instanceof strlit) { 405 if (this.args[0] instanceof symbol || this.args[0] instanceof strlit) {
403 if (this.args[1] instanceof lambda) { 406 if (this.args[1] instanceof lambda) {
404 if (this.args[2] instanceof lambda) { 407 if (this.args[2] instanceof lambda) {
405 408
406 symbols.defineMsg(this.args[0].name, this.args[2]); 409 symbols.defineMsg(this.args[0].name, this.args[2]);
407 isll = true; 410 isll = true;
408 } else { 411 } else {
409 throw new Error("Third argument to llMessage:withVars:andCode: must be a lambda"); 412 throw new Error("Third argument to llMessage:withVars:andCode: must be a lambda");
410 } 413 }