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
@@ -60,7 +60,7 @@ function chk_expr(e)
|
||||
chk_expr(e.idx)
|
||||
elseif t == "attr" then
|
||||
chk_expr(e.obj)
|
||||
elseif t == "table" then
|
||||
elseif t == "object" then
|
||||
local i = 1
|
||||
while i <= len(e.fields) do
|
||||
chk_expr(e.fields[i].v)
|
||||
|
||||
@@ -145,7 +145,7 @@ function cmp_expr(e)
|
||||
elseif t == "attr" then
|
||||
cmp_expr(e.obj)
|
||||
cmp_emit(22, cmp_addstr(e.name), 0, 0)
|
||||
elseif t == "table" then
|
||||
elseif t == "object" then
|
||||
cmp_emit(24, 0, 0, 0)
|
||||
local pos = 1
|
||||
local i = 1
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@
|
||||
-- { t="method", obj=O, name="m", args={...} }
|
||||
-- { t="index", obj=O, idx=I }
|
||||
-- { t="attr", obj=O, name="a" }
|
||||
-- { t="table", fields={ {k=..., v=...}, ... } } -- positional k is empty
|
||||
-- { t="object", fields={ {k=..., v=...}, ... } } -- positional k is empty
|
||||
-- { t="func", name=..., params={...}, body={stats} }
|
||||
--
|
||||
-- Statements:
|
||||
@@ -125,7 +125,7 @@ function par_table()
|
||||
par_advance()
|
||||
end
|
||||
par_expect("}", "'}'")
|
||||
return { t = "table", fields = fields }
|
||||
return { t = "object", fields = fields }
|
||||
end
|
||||
|
||||
function par_args()
|
||||
|
||||
Reference in new issue
Block a user