Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h5 doesn't test delegate correctly #103

Open
sake402 opened this issue Dec 10, 2024 · 0 comments
Open

h5 doesn't test delegate correctly #103

sake402 opened this issue Dec 10, 2024 · 0 comments

Comments

@sake402
Copy link

sake402 commented Dec 10, 2024

Hi

I have this piece of c# code where text is object type

public string GetText()
{
    if (text is Delegate d)
        return d?.Call()?.ToString();
    return text?.ToString();
}

Here is the generated code, that doesnt test for Delegate at all, hust checked if text is not null

GetText: function () {
                var $t;
                var d;
                if (!H5.staticEquals(((d = this.text)), null)) {
                    return !H5.staticEquals(d, null) && ($t = d.call()) != null ? H5.toString($t) : null;
                }
                return this.text != null ? H5.toString(this.text) : null;
            }

I would have expected

GetText: function () {
                var $t;
                var d;
                if (!H5.staticEquals(((d = this.text)), null) && H5.isFunction(d)) {
                    return !H5.staticEquals(d, null) && ($t = d.call()) != null ? H5.toString($t) : null;
                }
                return this.text != null ? H5.toString(this.text) : null;
            }
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

No branches or pull requests

1 participant