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

关于CodeField中的TypeValue与TypeKey的含义 #20

Closed
wuwen5 opened this issue Aug 24, 2022 · 2 comments · Fixed by #21
Closed

关于CodeField中的TypeValue与TypeKey的含义 #20

wuwen5 opened this issue Aug 24, 2022 · 2 comments · Fixed by #21

Comments

@wuwen5
Copy link
Contributor

wuwen5 commented Aug 24, 2022

open class CodeField(
    var TypeType: String = "",
    var TypeValue: String = "",
    var TypeKey: String = "",
    var Annotations: Array<CodeAnnotation> = arrayOf(),
    var Modifiers: Array<String> = arrayOf(),
    // for TypeScript and JavaScript only, examples: `export default sample = createHello() `
    var Calls: Array<CodeCall> = arrayOf()
)

例如code如下

class Demo {
    private String name = "abc";
}

解析后,TypeType=StringTypeValue=nameTypeKey=""
TypeKey到底是指的什么呢?

我理解是否应该 TypeKey=nameTypeValue="abc" ?

看下了,chapi-ast-kotlinchapi-ast-typescript中 是正确的
是否为 chapi-ast-java 的bug?

@phodal
Copy link
Owner

phodal commented Aug 24, 2022

啊,应该是个 bug 了。第一个版本写的时候是 Java,所以只有 Key 和 Type,没有记录值("abc")。好像是,后来引入 TypeScript 和 Kotlin 的时候,新加了一个 Value,可以根据 Value 做一些简单的类型推断。

要来个 PR 吗?

@wuwen5
Copy link
Contributor Author

wuwen5 commented Aug 24, 2022

ok, 确认为bug,我尝试下解决.

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 a pull request may close this issue.

2 participants