mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 07:33:01 +00:00 
			
		
		
		
	Fix some keyword related issues.
This commit is contained in:
		| @@ -389,6 +389,7 @@ static const JanetReg cfuns[] = { | ||||
|         "\t:string\n" | ||||
|         "\t:buffer\n" | ||||
|         "\t:symbol\n" | ||||
|         "\t:keyword\n" | ||||
|         "\t:function\n" | ||||
|         "\t:cfunction\n\n" | ||||
|         "or another symbol for an abstract type." | ||||
|   | ||||
| @@ -253,8 +253,6 @@ static int varleaf( | ||||
|         const uint8_t *sym, | ||||
|         JanetSlot s, | ||||
|         JanetTable *attr) { | ||||
|     if (sym[0] == ':') | ||||
|         janetc_cerror(c, "cannot create binding to keyword symbol"); | ||||
|     if (c->scope->flags & JANET_SCOPE_TOP) { | ||||
|         /* Global var, generate var */ | ||||
|         JanetSlot refslot; | ||||
| @@ -289,8 +287,6 @@ static int defleaf( | ||||
|         const uint8_t *sym, | ||||
|         JanetSlot s, | ||||
|         JanetTable *attr) { | ||||
|     if (sym[0] == ':') | ||||
|         janetc_cerror(c, "cannot create binding to keyword symbol"); | ||||
|     if (c->scope->flags & JANET_SCOPE_TOP) { | ||||
|         JanetTable *tab = janet_table(2); | ||||
|         janet_table_put(tab, janet_ckeywordv("source-map"), | ||||
|   | ||||
| @@ -370,7 +370,7 @@ static const char *typestr(JanetArgs args, int32_t n) { | ||||
|     JanetType actual = n < args.n ? janet_type(args.v[n]) : JANET_NIL; | ||||
|     return ((actual == JANET_ABSTRACT) | ||||
|         ? janet_abstract_type(janet_unwrap_abstract(args.v[n]))->name | ||||
|         : janet_type_names[actual]) + 1; | ||||
|         : janet_type_names[actual]); | ||||
| } | ||||
|  | ||||
| int janet_type_err(JanetArgs args, int32_t n, JanetType expected) { | ||||
| @@ -392,7 +392,7 @@ void janet_buffer_push_types(JanetBuffer *buffer, int types) { | ||||
|             } else { | ||||
|                 janet_buffer_push_u8(buffer, '|'); | ||||
|             } | ||||
|             janet_buffer_push_cstring(buffer, janet_type_names[i] + 1); | ||||
|             janet_buffer_push_cstring(buffer, janet_type_names[i]); | ||||
|         } | ||||
|         i++; | ||||
|         types >>= 1; | ||||
|   | ||||
| @@ -925,7 +925,7 @@ static void *op_lookup[255] = { | ||||
|         janet_buffer_push_cstring(&errbuf, "expected "); | ||||
|         janet_buffer_push_types(&errbuf, expected_types); | ||||
|         janet_buffer_push_cstring(&errbuf, ", got "); | ||||
|         janet_buffer_push_cstring(&errbuf, janet_type_names[janet_type(retreg)] + 1); | ||||
|         janet_buffer_push_cstring(&errbuf, janet_type_names[janet_type(retreg)]); | ||||
|         retreg = janet_stringv(errbuf.data, errbuf.count); | ||||
|         janet_buffer_deinit(&errbuf); | ||||
|         signal = JANET_SIGNAL_ERROR; | ||||
|   | ||||
| @@ -151,6 +151,7 @@ Janet janet_wrap_##NAME(TYPE x) {\ | ||||
| JANET_WRAP_DEFINE(number, double, JANET_NUMBER, number) | ||||
| JANET_WRAP_DEFINE(string, const uint8_t *, JANET_STRING, cpointer) | ||||
| JANET_WRAP_DEFINE(symbol, const uint8_t *, JANET_SYMBOL, cpointer) | ||||
| JANET_WRAP_DEFINE(keyword, const uint8_t *, JANET_KEYWORD, cpointer) | ||||
| JANET_WRAP_DEFINE(array, JanetArray *, JANET_ARRAY, pointer) | ||||
| JANET_WRAP_DEFINE(tuple, const Janet *, JANET_TUPLE, cpointer) | ||||
| JANET_WRAP_DEFINE(struct, const JanetKV *, JANET_STRUCT, cpointer) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose