feat(lang): a component's event may be called set, a string prop reads a number, one name per component
- An action whose first word is `set` or `emit` followed by `(` is a call, so a component's
`on set(v: int)` is pressed as `set(4)`; `set x = ...` is still the action.
- A `string` prop (or state, or parameter) given a number in a template reads it as text through
ludic.ui's new `ui_val_text`; `label="{3}"` used to arrive as "".
- Two components of one name (or of names that differ only in case, which share their functions'
names) are an error at the second declaration that names the first's file and line, instead of a
"function cmp_x_def_y is defined twice".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
584e455f2d
commit
9ad6347044
7 changed files with 42113 additions and 41882 deletions
|
|
@ -76,3 +76,14 @@ function cm_import_of(line: pointer) -> pointer {
|
|||
while b < len(line) and line[b] != q { b += 1 }
|
||||
return line[a + 1..b]
|
||||
}
|
||||
# a component is used by its name as a tag, so two of one name (or of names that differ only in case,
|
||||
# which would share their functions' names) are an error naming both files
|
||||
function cm_unique(name: pointer) -> void {
|
||||
var i = 0
|
||||
while i < len(g_cm_name) {
|
||||
if (cm_prefix(g_cm_name[i]) == cm_prefix(name)) {
|
||||
perr(`component {name} is declared twice: here and in {g_cm_file[i]}:{g_cm_line[i]} - a component is used by its name as a tag, so each needs a name of its own`)
|
||||
}
|
||||
i += 1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue