From 4e69bfb758ad75d4c90281236aad1f22e0868cff Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Wed, 4 Nov 2015 22:02:57 -0500 Subject: [PATCH] Fix for functions with cont and no args --- scheme/cyclone/cgen.sld | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scheme/cyclone/cgen.sld b/scheme/cyclone/cgen.sld index 69743427..c326cda1 100644 --- a/scheme/cyclone/cgen.sld +++ b/scheme/cyclone/cgen.sld @@ -674,6 +674,11 @@ symbol->string list->string substring string-append make-vector list->vector Cyc-installation-dir)))) +;; Primitive functions that pass a continuation but have no other arguments +(define (prim:cont/no-args? exp) + (and (prim? exp) + (member exp '(command-line-arguments)))) + ;; Pass an integer arg count as the function's first parameter? (define (prim:arg-count? exp) (and (prim? exp) @@ -845,7 +850,10 @@ (car (c:allocs c-fun)) (if (prim/c-var-assign fun) ;; Add a comma if there were any args to the func added by comp-prim - (if (str-ending? (car (c:allocs c-fun)) "(") "" ",") + (if (or (str-ending? (car (c:allocs c-fun)) "(") + (prim:cont/no-args? fun)) + "" + ",") ",") (c:body c-args*) ");")))) ;; Args stay with body