[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 29/99: Use scheme.frame.Prompt objects for prompts on dy
From: |
Christopher Allan Webber |
Subject: |
[Guile-commits] 29/99: Use scheme.frame.Prompt objects for prompts on dynstack |
Date: |
Sun, 10 Oct 2021 21:50:49 -0400 (EDT) |
cwebber pushed a commit to branch compile-to-js-merge
in repository guile.
commit 46597b49dcc5a3f6dfcf753c0faef1b432575bdb
Author: Ian Price <ianprice90@googlemail.com>
AuthorDate: Wed Jun 17 20:31:04 2015 +0100
Use scheme.frame.Prompt objects for prompts on dynstack
---
module/language/js-il/runtime.js | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/module/language/js-il/runtime.js b/module/language/js-il/runtime.js
index c14fbe4..ad83fa1 100644
--- a/module/language/js-il/runtime.js
+++ b/module/language/js-il/runtime.js
@@ -309,11 +309,11 @@ var abort_to_prompt = function(self, k, prompt) {
var args = Array.prototype.slice.call(arguments, 3);
var idx = find_prompt(prompt);
- var spec = scheme.dynstack[idx];
+ var frame = scheme.dynstack[idx];
var kont = undefined; // actual value doesn't matter
- if (!scheme.is_true(spec[1])) {
+ if (!scheme.is_true(frame.escape_only)) {
var f = function (self, k2) {
var args = Array.prototype.slice.call(arguments, 2);
return k.apply(k,args);
@@ -323,7 +323,7 @@ var abort_to_prompt = function(self, k, prompt) {
unwind(idx);
- var handler = spec[2];
+ var handler = frame.handler;
args.unshift(kont);
return handler.apply(handler, args);
};
@@ -383,7 +383,8 @@ scheme.primitives["unwind"] = not_implemented_yet;
// Misc
scheme.primitives["prompt"] = function(escape_only, tag, handler){
- scheme.dynstack.unshift([tag, escape_only, handler]);
+ var frame = new scheme.frame.Prompt(tag, escape_only, handler);
+ scheme.dynstack.unshift(frame);
};
var unwind = function (idx) {
@@ -397,10 +398,20 @@ var find_prompt = function(prompt) {
return scheme.is_true(eq(x,prompt)) ||
scheme.is_true(eq(x,scheme.TRUE));
};
for (idx in scheme.dynstack) {
- if (test(scheme.dynstack[idx][0])) {
+ var frame = scheme.dynstack[idx];
+ if (frame instanceof scheme.frame.Prompt && test(frame.tag)) {
return idx;
};
};
// FIXME: should error
return undefined;
};
+// Dynstack frames
+scheme.frame = {};
+
+scheme.frame.Prompt = function(tag, escape_only, handler){
+ this.tag = tag;
+ this.escape_only = escape_only;
+ this.handler = handler;
+};
+
- [Guile-commits] 12/99: Compile string constants, (continued)
- [Guile-commits] 12/99: Compile string constants, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 13/99: Mangle js identifiers, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 15/99: Handle case-lambda via a jump table, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 19/99: Simplify output Javascript, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 21/99: Primitives should return Scheme Booleans, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 23/99: Compile cps $prompt form to javascript, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 26/99: abort-to-prompt takes multiple arguments, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 34/99: Change function type representation, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 33/99: Change program type representation, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 31/99: Different types for Continuation and Variable identifiers, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 29/99: Use scheme.frame.Prompt objects for prompts on dynstack,
Christopher Allan Webber <=
- [Guile-commits] 30/99: Implement fluid primitives, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 36/99: Handle more identifier characters, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 47/99: Add some primitives to runtime.js, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 50/99: Add more variables to no-values-primitives, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 55/99: Implement immediate version of vector primitives., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 62/99: scm_struct_init skips hidden fields., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 59/99: Implement built-in string procedures., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 60/99: Implement struct built-ins., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 70/99: Add `guild jslink' to bundle JS programs, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 75/99: scheme.HashTable uses ES6 Map objects, Christopher Allan Webber, 2021/10/10