swift-emacs / swift-mode

Emacs support for Apple's Swift programming language.
GNU General Public License v3.0
370 stars 47 forks source link

added guard statement #98

Closed akoaysigod closed 9 years ago

akoaysigod commented 9 years ago

Added guard statement from issue #96 it seems to be working fine. I'm still trying to figure out SMIE I figured I'd try to do what seems like the easiest of the new features in Swift 2.0.

akoaysigod commented 9 years ago

I should have ran the test first. I'm still pretty new to all this. The switch case statement tests aren't failing on my machine. I'll check if they're up to date.

ap4y commented 9 years ago

I checked your PR and it seems that else confuses smie. It kind of makes sense, since if grammar says that else is expected after if-body. I would recommend to tokenize this keyword differently in lexer, something like this.

akoaysigod commented 9 years ago

That was it. Let me know what you think. It should pass all the tests and I added a basic one for the guard statements. I ran into a bug though where one of the test is passing that shouldn't. Maybe this will pick up on it?

edit: It didn't indents-declaration-statements-in-enum/1 isn't failing but it's not working for me.

enum Test {
    case T
        var x: String {

    }
}

Is what happens to me. But the second var will indent correctly. This also is happening in the version I downloaded from elpa.

ap4y commented 9 years ago

Thanks, looks good. About test inconsistencies, I checked it and can confirm the issue with enum. Weird thing is that test is deffinitelly running and expected location is correct (checked it by moving expected location). I will try to invistigate it a bit more.

ap4y commented 9 years ago

I double checked this test and actual behaviour on master and it works for me. Not sure why I had different behaviour in your branch...