Skip to content

Feature request: Marking a label as "global" #140

@shinymerlyn

Description

@shinymerlyn

I'd like to have a flag for labels that lets me hoist them from some inner scope to a top-level scope.

I don't think I'd necessarily write code this way, but existing assembly code often has hairy control flow, and Wiz is a pretty nice target for manual disassembly. Code that's been optimized for binary size is often especially patchy when it comes to control flow. Breaking up the code into a bunch of tiny fallthrough functions always "works", but it doesn't necessarily capture the semantics in some cases as my proposal would.

Examples of what I'd like to see working:

TestOne:
    y = 16;
    do {
        // some stuff here...
        global PartWayThroughLoop:  // inside do/while loop scope, would be hoisted to top-level scope
        // maybe some more here...
        --y;
    } while !negative;

TestTwo:
    // ...
    y = 4;
    goto PartWayThroughLoop;
func SomeFunction() {
    // some code...
    global SomeLabel:  // inside function scope, would be hoisted to top-level scope
    // some more code...
}

SomeOtherFunction:
    // ...
    goto SomeLabel;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions