prebirth: Add `quote' form

* build-aux/bootstrap/prebirth.js (fnmap): Add `quote' form.
master
Mike Gerwitz 2017-09-21 02:23:05 -04:00
parent ea7425dc6d
commit a5b53fedf5
Signed by: mikegerwitz
GPG Key ID: 8C917B7F5DC51BA2
1 changed files with 8 additions and 0 deletions

View File

@ -550,6 +550,14 @@ class Compiler
const fnmap = {
'js:console': 'console.log',
// fortunately ES6+ has native symbol support :)
// we don't (yet?) need list quoting in Prebirth
'quote': ( x, stoes ) => Array.isArray( x.value )
? (function () { throw SyntaxError(
"quoting lists is not yet supported; sorry!" )
} )()
: `Symbol.for('${stoes(x)}')`,
'lambda': ( [ args, ...body ], stoes, btoes ) =>
"function(" + args.map( stoes ).join( ", " ) + "){\n" +
btoes( body ) +