nishtahir / language-kotlin

Textmate language grammar for the Kotlin programming language
Apache License 2.0
12 stars 6 forks source link

Add `inner` keyword #63

Closed qhy040404 closed 1 year ago

qhy040404 commented 1 year ago

Support inner keyword.

A nested class marked as inner can access the members of its outer class. Inner classes carry a reference to an object of an outer class:

class Outer {
    private val bar: Int = 1
    inner class Inner {
        fun foo() = bar
    }
}

val demo = Outer().Inner().foo() // == 1
nishtahir commented 1 year ago

This change looks good however it's missing tests around the scopes (see the Testing section of the README). Would you mind adding tests for it? This is the file that would need to be updated https://github.com/nishtahir/language-kotlin/blob/master/test/Keywords.test.kt. You can update the corpus in the snapshot folder to include the keyword then run npm run snapshot to generate and inspect the scopes

qhy040404 commented 1 year ago

I don't know whether it's ok. @nishtahir review request

codecov[bot] commented 1 year ago

Codecov Report

Base: 70.37% // Head: 70.37% // No change to project coverage :thumbsup:

Coverage data is based on head (dec06c8) compared to base (0bbb091). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #63 +/- ## ======================================= Coverage 70.37% 70.37% ======================================= Files 13 13 Lines 486 486 ======================================= Hits 342 342 Misses 144 144 ``` | [Impacted Files](https://codecov.io/gh/nishtahir/language-kotlin/pull/63?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nish+Tahir) | Coverage Δ | | |---|---|---| | [src/keywords.YAML-tmLanguage](https://codecov.io/gh/nishtahir/language-kotlin/pull/63/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nish+Tahir#diff-c3JjL2tleXdvcmRzLllBTUwtdG1MYW5ndWFnZQ==) | `66.15% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nish+Tahir). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nish+Tahir)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

nishtahir commented 1 year ago

Looks great. I made a small change to the regression test syntax. Thank you for your contribution :tada:

qhy040404 commented 1 year ago

Thanks! 😄