From b254151c2a32203fe1920b4dd1db614ed2b0691b Mon Sep 17 00:00:00 2001 From: Chouser Date: Fri, 20 Feb 2015 02:52:51 -0500 Subject: forth: Fix bug in extend-protocol array insertion --- forth/types.fs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'forth/types.fs') diff --git a/forth/types.fs b/forth/types.fs index 791f327..5028bf3 100644 --- a/forth/types.fs +++ b/forth/types.fs @@ -30,8 +30,11 @@ require str.fs endif endif 2dup = until - cells a-addr + @ key = - ; + dup a-length = if + drop false + else + cells a-addr + @ key = + endif ; \ Create a new array, one cell in length, initialized the provided value : new-array { value -- array } @@ -170,7 +173,9 @@ MalType% deftype MalFalse MalFalse new constant mal-false else pxt array-find { idx found? } found? if \ overwrite - ." Warning: overwriting protocol method implementation" + ." Warning: overwriting protocol method implementation '" + pxt >name name>string safe-type ." ' on " type type-name safe-type ." , " idx . found? . cr + type MalTypeType-method-vals @ idx cells + ixt ! else \ resize type MalTypeType-methods dup @ 1+ dup rot ! ( new-count ) -- cgit v1.2.3