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

Adding recovery for ForStatement #1031

Merged

Conversation

m0rkeulv
Copy link
Member

Adding recovery for for loops so we don't have to display unparsable data.
Tested With:

 class HighlightTest {

    public function new() {}

    public function testForLoop()  {
        var r = ["1", "2", "3"];
        // CORRECT USE
        for(a in r)     {var f:String = "string";}
        var x = "";

        //WRONG USE
        for(a+ in -r)   {var f:String = "string";}
        var x = "";
        
        for(a : r)      {var f:String = "string";}
        var x = "";

        for(?)          {var f:String = "string";}
        var x = "";
        
        var c = ["v1" =>"V2"];

        // CORRECT USE
        for(a => b in c)     {var f:String = "string";}
        var x = "";

        //WRONG USE
        for(a => b : b)     {var f:String = "string";}
        var x = "";

        for(a => b in !)    {var f:String = "string";}
        var x = "";

        for(a ! b in c)     {var f:String = "string";}
        var x = "";

    }
}

@EricBishton
Copy link
Member

OK. I'll turn that code into a test before I pull this: A new test routine in testSrc/com/intellij/plugins/haxe/lang/parser/statements/ForTest.java. The testData directory is testData/parsing/haxe/statements/for/

@EricBishton
Copy link
Member

Rather than holding this up further, I filed #1040 so that we remember to do the test.

@EricBishton EricBishton merged commit ab25833 into HaxeFoundation:develop Oct 26, 2020
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.

2 participants