object, not table: fix user-facing terminology
The language is OOP with a single compound value, the object (an
anonymous `{...}` or a class instance); it is not Lua and has no
"tables". The visible type name was already `object`; this fixes the
remaining user-facing wording:
- error messages: "object has no member 'x'", "object is not callable".
- README: drop the "Lua-like" phrasing; describe member objects, not
tables.
- self-hosted front-end AST node `t="object"` (was "table"), updated
across parser/compiler/checker.
- test comments/expected output aligned ("object:").
The internal C symbols keep the cat_types_table_* naming convention.
Suite stays 130 green.
This commit is contained in:
1 parent
a73600e221
commit
7cdf388bf4
10 files changed
+18
-18
No files matched your search
@@ -39,7 +39,7 @@ static int table_get_attribute(CAT_VALUE_Value *self, const char *name,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return (cat_error_raise(err, "table has no key '%s'", name), -1);
|
||||
return (cat_error_raise(err, "object has no member '%s'", name), -1);
|
||||
}
|
||||
|
||||
static int table_set_attribute(CAT_VALUE_Value *self, const char *name,
|
||||
@@ -62,7 +62,7 @@ static int table_call(CAT_VALUE_Value *self, CAT_VALUE_Value **args, int nargs,
|
||||
cat_error_clear(&e);
|
||||
if (cat_value_get_attribute(self, "new", &ctor, &e) != 0 || ctor == NULL)
|
||||
return (cat_error_raise(err,
|
||||
"table is not callable (no 'new')"), -1);
|
||||
"object is not callable (no 'new')"), -1);
|
||||
callargs[0] = self;
|
||||
for (i = 0; i < nargs && i < 257; i++)
|
||||
callargs[i + 1] = args[i];
|
||||
@@ -156,7 +156,7 @@ int cat_types_table_get(CAT_VALUE_Value *tbl, const char *key,
|
||||
*out = t->pairs[idx].value;
|
||||
return 0;
|
||||
}
|
||||
return (cat_error_raise(err, "table has no key '%s'", key), -1);
|
||||
return (cat_error_raise(err, "object has no member '%s'", key), -1);
|
||||
}
|
||||
|
||||
int cat_types_table_count(CAT_VALUE_Value *tbl)
|
||||
|
||||
Reference in new issue
Block a user