File tree Expand file tree Collapse file tree
joern-cli/frontends/rust2cpg/src
scala/io/joern/rust2cpg/astcreation
test/scala/io/joern/rust2cpg/passes/ast Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ RUBYSRC2CPG_ASTGEN_VERSION = "0.59.6"
132132
133133RUBYSRC2CPG_TYPE_STUBS_VERSION = "0.6.0"
134134
135- RUST2CPG_ASTGEN_VERSION = "0.19.0 "
135+ RUST2CPG_ASTGEN_VERSION = "0.19.1 "
136136
137137PHP_PARSER_VERSION = "4.15.10"
138138
Original file line number Diff line number Diff line change 11rust2cpg {
2- rust_ast_gen_version: "0.19.0 "
2+ rust_ast_gen_version: "0.19.1 "
33}
Original file line number Diff line number Diff line change @@ -160,7 +160,9 @@ trait RustFullNames { this: AstCreator =>
160160 case tuplePat : RustNodeSyntax .TuplePat =>
161161 val childTypes = tuplePat.pat.map(typeFullNameForPat)
162162 s " ( ${childTypes.mkString(" , " )}) "
163- case _ => Defines .Any
163+ case recordPat : RustNodeSyntax .RecordPat => typeFullNameForPath(recordPat.path)
164+ case tupleStructPat : RustNodeSyntax .TupleStructPat => typeFullNameForPath(tupleStructPat.path)
165+ case _ => Defines .Any
164166 }
165167 }
166168 }
Original file line number Diff line number Diff line change @@ -1119,6 +1119,31 @@ class DeclarationTests extends Rust2CpgSuite(noSysRoot = true) {
11191119 endAssign.code shouldBe " end = <tmp>0.end"
11201120 }
11211121 }
1122+
1123+ " have correct field accesses" in {
1124+ inside(cpg.assignment.where(_.target.isIdentifier.nameExact(" x" )).source.l) { case (fieldAccess : Call ) :: Nil =>
1125+ fieldAccess.name shouldBe Operators .fieldAccess
1126+ fieldAccess.typeFullName shouldBe " i32"
1127+ inside(fieldAccess.argument.sortBy(_.argumentIndex).l) {
1128+ case (startFieldAccess : Call ) :: (field : FieldIdentifier ) :: Nil =>
1129+ field.canonicalName shouldBe " x"
1130+ startFieldAccess.name shouldBe Operators .fieldAccess
1131+ startFieldAccess.code shouldBe " <tmp>0.start"
1132+ startFieldAccess.typeFullName shouldBe " rust2cpgtest::Point"
1133+ }
1134+ }
1135+ inside(cpg.assignment.where(_.target.isIdentifier.nameExact(" y" )).source.l) { case (fieldAccess : Call ) :: Nil =>
1136+ fieldAccess.name shouldBe Operators .fieldAccess
1137+ fieldAccess.typeFullName shouldBe " i64"
1138+ inside(fieldAccess.argument.sortBy(_.argumentIndex).l) {
1139+ case (startFieldAccess : Call ) :: (field : FieldIdentifier ) :: Nil =>
1140+ field.canonicalName shouldBe " y"
1141+ startFieldAccess.name shouldBe Operators .fieldAccess
1142+ startFieldAccess.code shouldBe " <tmp>0.start"
1143+ startFieldAccess.typeFullName shouldBe " rust2cpgtest::Point"
1144+ }
1145+ }
1146+ }
11221147 }
11231148
11241149 " let with a record pattern in a tuple pattern" should {
Original file line number Diff line number Diff line change @@ -259,8 +259,7 @@ class ForTestsWithSysroot extends Rust2CpgSuite(noSysRoot = false) {
259259 " have correct locals" in {
260260 inside(cpg.whileBlock.astChildren.isBlock.astChildren.isLocal.l) { case tmp :: xLocal :: yLocal :: Nil =>
261261 tmp.name shouldBe " <tmp>1"
262- // TODO(rust_ast_gen): typeFullName for patterns.
263- pendingUntilFixed(tmp.typeFullName shouldBe " rust2cpgtest::Point" )
262+ tmp.typeFullName shouldBe " rust2cpgtest::Point"
264263 xLocal.name shouldBe " x"
265264 xLocal.typeFullName shouldBe " i32"
266265 yLocal.name shouldBe " y"
You can’t perform that action at this time.
0 commit comments