Skip to content

compiler: return "if-test and throw" when compiling 'assert' (beta-3.0) - #477

Merged
mortend merged 1 commit into
fuse-open:beta-3.0from
mortend:assert
May 6, 2023
Merged

mortend merged 1 commit into
fuse-open:beta-3.0from
mortend:assert

Conversation

@mortend

@mortend mortend commented May 5, 2023

Copy link
Copy Markdown
Member

'assert' statements were turned into method calls to a method that was removed in 992b515, resulting in compile errors.

'assert' is still used in a few places, and this commit turns them into "if-test and throw" in debug builds (noop in release builds) to fix the compile errors.

assert VALUE;

becomes when compiled:

if (IS_DEBUG_BUILD && !VALUE)
    throw new Uno.InvalidOperationException(
        "Assertion failed: VALUE"
    );

'assert' statements were turned into method calls to a method that was
removed in 992b515, resulting in compile errors.

'assert' is still used in a few places, and this commit turns them into
"if-test and throw" in debug builds (noop in release builds) to fix the
compile errors.

    assert VALUE;

becomes when compiled:

    if (IS_DEBUG_BUILD && !VALUE)
        throw new Uno.InvalidOperationException(
            "Assertion failed: VALUE"
        );
@mortend
mortend merged commit ec99ff1 into fuse-open:beta-3.0 May 6, 2023
@mortend
mortend deleted the assert branch May 6, 2023 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant