diff options
author | Andy Wingo <wingo@pobox.com> | 2009-02-19 17:14:16 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-02-19 17:14:16 +0100 |
commit | b72880eb170ccec1177a6c93b1694014ee54a453 (patch) | |
tree | c29c5d42518c60e751cb3c0d93037dc134063515 /module/language/ecmascript/compile-ghil.scm | |
parent | 984dce236bd742083f3f284c9fe7b93c2df9f908 (diff) | |
download | guile-b72880eb170ccec1177a6c93b1694014ee54a453.tar.gz |
implement object literals
* module/language/ecmascript/impl.scm:
* module/language/ecmascript/compile-ghil.scm (comp): Object literals.
* module/language/ecmascript/parse.scm (parse-ecmascript): Fix some
object literal parsing.
Diffstat (limited to 'module/language/ecmascript/compile-ghil.scm')
-rw-r--r-- | module/language/ecmascript/compile-ghil.scm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/module/language/ecmascript/compile-ghil.scm b/module/language/ecmascript/compile-ghil.scm index 1b90f48c5..880c79e35 100644 --- a/module/language/ecmascript/compile-ghil.scm +++ b/module/language/ecmascript/compile-ghil.scm @@ -101,6 +101,17 @@ (make-ghil-inline e l 'return (list (comp expr e)))) ((array . ,args) (@impl e l new-array (map (lambda (x) (comp x e)) args))) + ((object . ,args) + (@impl e l new-object + (map (lambda (x) + (pmatch x + ((,prop ,val) + (make-ghil-inline e l 'cons + (list (make-ghil-quote e l prop) + (comp val e)))) + (else + (error "bad prop-val pair" x)))) + args))) ((pref ,obj ,prop) (@impl e l pget (list (comp obj e) (make-ghil-quote e l prop)))) ((= (ref ,name) ,val) |