File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
chapi-ast-rust/src/main/kotlin/chapi/ast/rustast Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import chapi.ast.antlr.RustParser
4
4
import chapi.ast.antlr.RustParser.ItemContext
5
5
import chapi.ast.antlr.RustParser.SimplePathContext
6
6
import chapi.ast.antlr.RustParser.TypePathSegmentContext
7
+ import chapi.ast.antlr.RustParser.Type_Context
7
8
import chapi.ast.antlr.RustParserBaseListener
8
9
import chapi.domain.core.*
9
10
import org.antlr.v4.runtime.ParserRuleContext
@@ -161,13 +162,18 @@ open class RustAstBaseListener(private val fileName: String) : RustParserBaseLis
161
162
private fun buildFields (structFields : RustParser .StructFieldsContext ? ): List <CodeField > {
162
163
return structFields?.structField()?.map {
163
164
CodeField (
164
- TypeType = lookupByType (it.type_()?.text ),
165
+ TypeType = lookupType (it.type_()),
165
166
Annotations = buildAttribute(it.outerAttribute()),
166
167
TypeValue = it.identifier()?.text ? : " " ,
167
168
)
168
169
} ? : emptyList()
169
170
}
170
171
172
+ private fun lookupType (type_ : Type_Context ? ): String {
173
+ val typeText = type_?.text
174
+ return lookupByType(typeText)
175
+ }
176
+
171
177
open fun lookupByType (typeText : String? ): String {
172
178
if (typeText == null ) return " "
173
179
val text = if (typeText.contains(" ::" )) {
You can’t perform that action at this time.
0 commit comments