diff options
| author | Chouser <chouser@n01se.net> | 2015-02-20 02:52:51 -0500 |
|---|---|---|
| committer | Chouser <chouser@n01se.net> | 2015-02-21 13:22:44 -0500 |
| commit | b254151c2a32203fe1920b4dd1db614ed2b0691b (patch) | |
| tree | e9799a7b01f6ab5280d7e745265f37b6ca994b9f /forth/types.fs | |
| parent | 45c1894b9690b1156ffdc2caeb726bbc9526597a (diff) | |
| download | mal-b254151c2a32203fe1920b4dd1db614ed2b0691b.tar.gz mal-b254151c2a32203fe1920b4dd1db614ed2b0691b.zip | |
forth: Fix bug in extend-protocol array insertion
Diffstat (limited to 'forth/types.fs')
| -rw-r--r-- | forth/types.fs | 11 |
1 files changed, 8 insertions, 3 deletions
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 ) |
