File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
rust/ql/lib/codeql/rust/internal Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -133,26 +133,32 @@ class DataType extends Type, TDataType {
133133
134134/** A struct type. */
135135class StructType extends DataType {
136- StructType ( ) { super .getTypeItem ( ) instanceof Struct }
136+ private Struct struct ;
137+
138+ StructType ( ) { struct = super .getTypeItem ( ) }
137139
138140 /** Gets the struct that this struct type represents. */
139- override Struct getTypeItem ( ) { result = super . getTypeItem ( ) }
141+ override Struct getTypeItem ( ) { result = struct }
140142}
141143
142144/** An enum type. */
143145class EnumType extends DataType {
144- EnumType ( ) { super .getTypeItem ( ) instanceof Enum }
146+ private Enum enum ;
147+
148+ EnumType ( ) { enum = super .getTypeItem ( ) }
145149
146150 /** Gets the enum that this enum type represents. */
147- override Enum getTypeItem ( ) { result = super . getTypeItem ( ) }
151+ override Enum getTypeItem ( ) { result = enum }
148152}
149153
150154/** A union type. */
151155class UnionType extends DataType {
152- UnionType ( ) { super .getTypeItem ( ) instanceof Union }
156+ private Union union ;
157+
158+ UnionType ( ) { union = super .getTypeItem ( ) }
153159
154160 /** Gets the union that this union type represents. */
155- override Union getTypeItem ( ) { result = super . getTypeItem ( ) }
161+ override Union getTypeItem ( ) { result = union }
156162}
157163
158164/** A trait type. */
Original file line number Diff line number Diff line change @@ -907,7 +907,7 @@ private module StructExprMatchingInput implements MatchingInputSig {
907907 result = this .getTypeParameter ( _) and
908908 path = TypePath:: singleton ( result )
909909 or
910- // type of the struct itself
910+ // type of the struct or enum itself
911911 dpos .isStructPos ( ) and
912912 path .isEmpty ( ) and
913913 result = TDataType ( this .getTypeItem ( ) )
@@ -2860,15 +2860,15 @@ private class TupleLikeStruct extends TupleLikeConstructor instanceof Struct {
28602860
28612861 override TypeItem getTypeItem ( ) { result = this }
28622862
2863- override TupleField getTupleField ( int i ) { result = this . ( Struct ) .getTupleField ( i ) }
2863+ override TupleField getTupleField ( int i ) { result = Struct . super .getTupleField ( i ) }
28642864}
28652865
28662866private class TupleLikeVariant extends TupleLikeConstructor instanceof Variant {
28672867 TupleLikeVariant ( ) { this .isTuple ( ) }
28682868
28692869 override TypeItem getTypeItem ( ) { result = super .getEnum ( ) }
28702870
2871- override TupleField getTupleField ( int i ) { result = this . ( Variant ) .getTupleField ( i ) }
2871+ override TupleField getTupleField ( int i ) { result = Variant . super .getTupleField ( i ) }
28722872}
28732873
28742874/**
You can’t perform that action at this time.
0 commit comments