Skip to content

Parameter substitution in template extras are broken #99

@nicopap

Description

@nicopap

Variable scoping is still flaky.

Reproducible example chirp file

In the following code, width in green_row should be replaced by

fn button(width_rule, button_text) {
    Button(focus row rules(width_rule, 30px)) {
        ButtonText(text(button_text))
    }
}

fn long_button(text) { button!(80%, text) }

fn green_row(name, width, neg_width) {
    Entity(row rules(99%, 35px)) {
        long_button!(Go to right menu)(rules(width, 30px) named(name))
        Entity(row menu(name) bg(#FFFFFF20) rules(neg_width, 100%) main_margin(3.)) {
            Entity(width(0%))
            square_button!(1)
            square_button!(2)
            square_button!(3)
            Entity(width(0%))
        }
    }
}

RootRoot(column screen_root) {
    green_row!(green_1, 50%, 49%)
}

I get this error:

Error:   × Rule format was not recognized: 'width', rules end with '%', '*' or 'px'. Examples:
  │ '53%', '0.35*' and '1024px'
    ╭─[ultimate_menu.chirp:35:1]
 35 │ fn green_row(name, width, neg_width) {
 36 │     Entity(row rules(99%, 35px)) {
 37 │         long_button!(Go to right menu)(rules(width, 30px) named(name))
    ·                                              ───────────
 38 │         Entity(row menu(name) bg(#FFFFFF20) rules(neg_width, 100%) main_margin(3.)) {
 39 │             Entity(width(0%))
    ╰────
  help: The error comes from the ParseDsl implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-chirprelates to the cuicui_chirp file format crate specificallyT-bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions