[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 28/99: Implement apply correctly
From: |
Christopher Allan Webber |
Subject: |
[Guile-commits] 28/99: Implement apply correctly |
Date: |
Sun, 10 Oct 2021 21:50:49 -0400 (EDT) |
cwebber pushed a commit to branch compile-to-js-merge
in repository guile.
commit 6f777154571480be2c01de3a7ad56e44611f4166
Author: Ian Price <ianprice90@googlemail.com>
AuthorDate: Tue Jun 16 23:19:11 2015 +0100
Implement apply correctly
---
module/language/js-il/runtime.js | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/module/language/js-il/runtime.js b/module/language/js-il/runtime.js
index c9bf8ee..c14fbe4 100644
--- a/module/language/js-il/runtime.js
+++ b/module/language/js-il/runtime.js
@@ -288,8 +288,16 @@ scheme.is_true = function (obj) {
};
// Builtins
-var apply = function(self, k, f, arg) {
- return f.fun(f.freevars, k, arg);
+var apply = function(self, k, f) {
+ var args = Array.prototype.slice.call(arguments, 3);
+ var tail = args.pop();
+
+ while (scheme.is_true(scheme.primitives["pair?"](tail))) {
+ args.push(tail.car);
+ tail = tail.cdr;
+ };
+
+ return f.fun.apply(f.fun, [f,k].concat(args));
};
var values = function(self, k) {
- [Guile-commits] 41/99: Fix build of (language cps compile-js), (continued)
- [Guile-commits] 41/99: Fix build of (language cps compile-js), Christopher Allan Webber, 2021/10/10
- [Guile-commits] 45/99: Add #:js-inline? and #:js-flatten? debugging options, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 54/99: Implement structs in runtime.js, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 25/99: Implement call-with-values, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 52/99: Add macro type in runtime.js, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 51/99: Implement cached-module-box, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 48/99: Rebuild nested scopes for js continuations, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 18/99: Add more types of constants, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 17/99: Implement Optional arguments, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 27/99: values takes multiple arguments, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 28/99: Implement apply correctly,
Christopher Allan Webber <=
- [Guile-commits] 38/99: Explicitly test for undefined arguments to handle false values like 0, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 44/99: Update primitives in no-values-primitives, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 35/99: Change local type representation and remove var type, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 42/99: compile-js uses the new cps representation, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 43/99: Handle multiple conts in a function body, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 46/99: JS-IL inliner has different count-calls for different clauses, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 40/99: Merge branch 'stable-2.2' into compile-to-js-2017, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 49/99: Compile Syntax Objects to Javascript, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 39/99: Add missing simplify.scm to Makefile, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 37/99: Fixup binop unparsing, Christopher Allan Webber, 2021/10/10