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

[analyzer] Block-terminators in value-places #4969

Closed
Simn opened this issue Mar 22, 2016 · 0 comments
Closed

[analyzer] Block-terminators in value-places #4969

Simn opened this issue Mar 22, 2016 · 0 comments
Assignees
Labels
feature-analyzer Static analyzer
Milestone

Comments

@Simn
Copy link
Member

Simn commented Mar 22, 2016

Currently the analyzer rejects terminators in value-places:

class Main {
    static function main() {}

    static function test1() {
        var __return = function(x:Dynamic) { return 1; }
        __return(throw null); // Cannot use this expression as value
    }

    static function test2() {
        var __return = function(x:Dynamic) { return 1; }
         __return(return null); // Cannot use this expression as value
    }

    static function test3() {
        var __return = function(x:Dynamic) { return 1; }
        while (true) {
            __return(break); // Cannot use this expression as value
        }
    }

    static function test4() {
        var __return = function(x:Dynamic) { return 1; }
        while (true) {
            __return(continue); // Cannot use this expression as value
        }
    }
}

Instead of erroring we can simply add them as a block-element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-analyzer Static analyzer
Projects
None yet
Development

No branches or pull requests

1 participant