feat(ui): ludic.ui grows toward HTML, CSS and React (Phase 0.U1-U4)
- Natives: ui_native(tag, measure, draw) makes an element the program draws itself; ui_fire runs its on-<event> with event.value. input, select and textarea have simple defaults. - React: - keyed <each>, <let>, <provide> context through components, <fragment>; - named slots, default props on <component>; - on-mount / on-unmount; - inline text inside text elements. - CSS: - custom properties and var(); - position relative/absolute/fixed with insets and z-index; - em/rem/vw/vh and @media; - wrapping text and ellipsis, overflow; - + and ~ combinators, :nth-child(an+b), :checked, :active. - Developing: errors with file:line, ui_errors(), ui_reload() keeping state, and an inspector-style ui_dump. - view fields infer the type of a literal or a named function's result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
66a2bc2214
commit
637d07400e
39 changed files with 42012 additions and 40795 deletions
|
|
@ -35,13 +35,21 @@ function vw_finish(v: int) -> void {
|
|||
vw_parse(model, head.file, head.line, head.vis)
|
||||
vw_parse(vw_call_src(v, px, head), head.file, head.line, head.vis)
|
||||
}
|
||||
# a field written `name = some_global` has that global's declared type
|
||||
# a field's type when it is not said: a global's, a literal's, or a named function's result
|
||||
function vw_infer(v: int, g: Node, fname: pointer) -> pointer {
|
||||
let e = g.a.kids[0].a
|
||||
if e.kind == E_ID {
|
||||
let d = find_global(e.s)
|
||||
if d != null and d.ty != null { return d.ty }
|
||||
}
|
||||
if e.kind == E_INT { return "int" }
|
||||
if e.kind == E_FLOAT { return "float" }
|
||||
if e.kind == E_BOOL { return "bool" }
|
||||
if e.kind == E_STR { return "string" }
|
||||
if e.kind == E_CALL and e.a != null and e.a.kind == E_ID {
|
||||
let f = find_fn(e.a.s)
|
||||
if f != null and f.ty != null and not (f.ty == "void") { return f.ty }
|
||||
}
|
||||
g_vw_node[v].line = g.line
|
||||
vw_err(v, `say what type {fname} is - {fname}: int = ...`)
|
||||
return "int"
|
||||
|
|
|
|||
40828
selfhost/ludicc.seed.ll
40828
selfhost/ludicc.seed.ll
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue