mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-08 02:40:17 +02:00
Fix ECMAScript object creation.
* module/language/ecmascript/compile-tree-il.scm (compile-tree-il): generate correct tree-il for construction of new objects. * test-suite/tests/ecmascript.test (ecompile): Add pattern with EXPECTED omitted. ("compiler"): test whether we generate new objects correctly. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
9dfcd9e2d6
commit
8891bd1b16
2 changed files with 18 additions and 11 deletions
|
@ -366,16 +366,16 @@
|
|||
`(apply ,(@implv new-array)
|
||||
,@(map (lambda (x) (comp x e)) args)))
|
||||
((object . ,args)
|
||||
(@impl new-object
|
||||
(map (lambda (x)
|
||||
(pmatch x
|
||||
((,prop ,val)
|
||||
(-> (apply (-> (primitive 'cons))
|
||||
(-> (const prop))
|
||||
(comp val e))))
|
||||
(else
|
||||
(error "bad prop-val pair" x))))
|
||||
args)))
|
||||
`(apply (@ (language ecmascript impl) new-object)
|
||||
,@(map (lambda (x)
|
||||
(pmatch x
|
||||
((,prop ,val)
|
||||
(-> (apply (-> (primitive 'cons))
|
||||
(-> (const prop))
|
||||
(comp val e))))
|
||||
(else
|
||||
(error "bad prop-val pair" x))))
|
||||
args)))
|
||||
((pref ,obj ,prop)
|
||||
(@impl pget
|
||||
(comp obj e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue