# HG changeset patch
# User Westerbly Snaydley <westerbly@gmail.com>
# Date 1607926470 18000
# Mon Dec 14 01:14:30 2020 -0500
# Node ID c8b28f01678c8685fbbd773ad09ffa3312c46580
# Parent 7c4d7e4ebbfe8e4bfb91225cc39d763b4201cf2b
core: countof constant string is constant
diff -r 7c4d7e4ebbfe -r c8b28f01678c lib/scopes/core.sc
--- a/lib/scopes/core.sc Fri Dec 11 15:31:09 2020 +0100
+++ b/lib/scopes/core.sc Mon Dec 14 01:14:30 2020 -0500
@@ -2018,7 +2018,6 @@
'define-symbols string
buffer = sc_string_buffer
- __countof = sc_string_count
__@ = string@
__lslice = sc_string_lslice
__rslice = sc_string_rslice
@@ -2032,6 +2031,19 @@
__<= = (box-pointer (simple-binary-op (inline (a b) (icmp<=s (sc_string_compare a b) 0))))
__> = (box-pointer (simple-binary-op (inline (a b) (icmp>s (sc_string_compare a b) 0))))
__>= = (box-pointer (simple-binary-op (inline (a b) (icmp>=s (sc_string_compare a b) 0))))
+ __countof =
+ box-pointer
+ spice-macro
+ fn (args)
+ let argc = (sc_argcount args)
+ verify-count argc 1 1
+ let self = (sc_getarg args 0)
+ if ('constant? self)
+ let count =
+ sc_string_count (unbox self string)
+ `count
+ else
+ `(sc_string_count self)
'define-symbols list
__typecall = list-constructor