Mercurial > repos > tabletprog
diff compiler.js @ 273:0dc7322590da
Make import:from actually work. Fix some macro bugs. Add a cpointer primitive type for storing an opaque pointer to a C object.
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 20 Jul 2014 00:12:43 -0700 |
parents | d6a4c9e7716e |
children | d4df33596e7d |
line wrap: on
line diff
--- a/compiler.js Sat Jul 19 20:18:34 2014 -0700 +++ b/compiler.js Sun Jul 20 00:12:43 2014 -0700 @@ -380,6 +380,13 @@ } else { throw new Error("Unexpected AST type for foreign:"); } + } else if (this.name == 'import:from:' && symbols instanceof osymbols && this.args.length == 2) { + each(this.args[0].val, function(i, el) { + if (!(el instanceof symbol)) { + throw new Error('Names in import:from statement must be symbols'); + } + symbols.defineMsg(el.name, new lambda([], [])); + }); } else if (this.name == 'llProperty:withType:') { if (this.args[0] instanceof symbol) { if ((this.args[1] instanceof symbol) || (this.args[1] instanceof funcall)) { @@ -391,10 +398,11 @@ } else { throw new Error("First argument to llProperty:withType: must be a symbol or string"); } - } else if (this.name == 'llMessage:withVars:andCode:') { + } else if (this.name == 'llMessage:withVars:andCode:' && symbols instanceof osymbols) { if (this.args[0] instanceof symbol || this.args[0] instanceof strlit) { if (this.args[1] instanceof lambda) { if (this.args[2] instanceof lambda) { + symbols.defineMsg(this.args[0].name, this.args[2]); isll = true; } else {