mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 20:30:28 +02:00
Compile string constants
This commit is contained in:
parent
86fabef4ca
commit
a4003003e2
3 changed files with 12 additions and 0 deletions
|
@ -167,6 +167,9 @@
|
||||||
|
|
||||||
(define (print-const c port)
|
(define (print-const c port)
|
||||||
(cond ((string? c)
|
(cond ((string? c)
|
||||||
|
;; FIXME:
|
||||||
|
;; Scheme strings and JS Strings are different, and not just in
|
||||||
|
;; terms of mutability
|
||||||
(write c port))
|
(write c port))
|
||||||
((number? c)
|
((number? c)
|
||||||
(write c port))
|
(write c port))
|
||||||
|
|
|
@ -112,5 +112,10 @@
|
||||||
(make-call
|
(make-call
|
||||||
(make-refine *scheme* (make-const "list"))
|
(make-refine *scheme* (make-const "list"))
|
||||||
(map compile-const c)))
|
(map compile-const c)))
|
||||||
|
((string? c)
|
||||||
|
(make-new
|
||||||
|
(make-call
|
||||||
|
(make-refine *scheme* (make-const "String"))
|
||||||
|
(list (make-const c)))))
|
||||||
(else
|
(else
|
||||||
(throw 'uncompilable-const c))))
|
(throw 'uncompilable-const c))))
|
||||||
|
|
|
@ -118,6 +118,10 @@ scheme.Symbol = function(s) {
|
||||||
// Chars
|
// Chars
|
||||||
|
|
||||||
// Strings
|
// Strings
|
||||||
|
scheme.String = function(s) {
|
||||||
|
this.s = s;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
// Closures
|
// Closures
|
||||||
scheme.Closure = function(f, size) {
|
scheme.Closure = function(f, size) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue