From 9807d2dced107aecfb85502e9264e63f74214499 Mon Sep 17 00:00:00 2001 From: Julian Graham Date: Tue, 13 Sep 2016 08:39:43 -0400 Subject: Fix tree-il code generation for ECMAscript `new' expression. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The compiler was producing `((toplevel foo))' instead of `(toplevel foo)'. Changed to use `call' form with target type and spliced constructor arguments. * module/language/ecmascript/compile-tree-il.scm (comp): Replace `@impl' shorthand with `call' + `@implv' for better control over resulting tree-il. * test-suite/tests/ecmascript.test (compiler): Add test for "new Object();" Signed-off-by: Ludovic Courtès --- module/language/ecmascript/compile-tree-il.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module') diff --git a/module/language/ecmascript/compile-tree-il.scm b/module/language/ecmascript/compile-tree-il.scm index a9ac3e0cd..d61f7120d 100644 --- a/module/language/ecmascript/compile-tree-il.scm +++ b/module/language/ecmascript/compile-tree-il.scm @@ -1,6 +1,6 @@ ;;; ECMAScript for Guile -;; Copyright (C) 2009, 2011 Free Software Foundation, Inc. +;; Copyright (C) 2009, 2011, 2016 Free Software Foundation, Inc. ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -437,9 +437,9 @@ ((^= ,what ,val) (comp `(= ,what (^ ,what ,val)) e)) ((new ,what ,args) - (@impl new - (map (lambda (x) (comp x e)) - (cons what args)))) + `(call ,(@implv new) + ,(comp what e) + ,@(map (lambda (x) (comp x e)) args))) ((delete (pref ,obj ,prop)) (@impl pdel (comp obj e) -- cgit v1.2.3