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

Java8MapperーvisitArrayAccessメソットのコード抜け #28

Open
khlee12 opened this issue Jul 13, 2016 · 0 comments
Open

Java8MapperーvisitArrayAccessメソットのコード抜け #28

khlee12 opened this issue Jul 13, 2016 · 0 comments

Comments

@khlee12
Copy link
Contributor

khlee12 commented Jul 13, 2016

arrayAccess=>UniFieldAccess
    :   (   expressionName$receiver '[' expression$index ']'
        |   primaryNoNewArray_lfno_arrayAccess$receiver '[' expression$index ']'
        )
        (   primaryNoNewArray_lf_arrayAccess$receiver '[' expression$index ']'
        )*
    ;

アノテーションの後に生成されたメソットを見ると

override public visitArrayAccess(Java8Parser.ArrayAccessContext ctx) {
        val map = newHashMap
        val none = newArrayList
        map.put("none", none)
        val receiver = newArrayList
        map.put("receiver", receiver)
        val index = newArrayList
        map.put("index", index)
        ctx.children.forEach [
            if (it instanceof RuleContext) {
                switch it.invokingState {
                    case 2100: {
                        receiver += it.visit
                    }
                    case 2302: {
                        index += it.visit
                    }
                    case 2308: {
                        index += it.visit
                    }
                    case 2318: {
                        receiver += it.visit
                    }
                    case 2320: {
                        index += it.visit
                    }
                    default: {
                        none += it.visit
                    }
                }
            } else if (it instanceof TerminalNode) {
                switch it.symbol.type {
                    default: {
                        none += it.visit
                    }
                }
            }
        ]
        map.castTo(UniFieldAccess)
    }

case 2302からcase 2308の間にreceiverが一個抜けてます。

case 2306: {
    receiver += it.visit
}

を追加するとマッパーが正しく動きます。

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