@@ -545,15 +545,7 @@ class StructType extends @structtype, CompositeType {
545
545
predicate hasField ( string name , Type tp ) {
546
546
exists ( int mindepth |
547
547
mindepth = min ( int depth | this .hasFieldCand ( name , _, depth , _) ) and
548
- tp = unique( Field f | f = this .getFieldCand ( name , mindepth , _) ) .getType ( )
549
- )
550
- }
551
-
552
- private Field getFieldCand ( string name , int depth , boolean isEmbedded ) {
553
- result = this .getOwnField ( name , isEmbedded ) and depth = 0
554
- or
555
- exists ( Type embedded | this .hasEmbeddedField ( embedded , depth - 1 ) |
556
- result = embedded .getUnderlyingType ( ) .( StructType ) .getOwnField ( name , isEmbedded )
548
+ tp = unique( Field f | this .hasFieldCand ( name , f , mindepth , _) ) .getType ( )
557
549
)
558
550
}
559
551
@@ -568,9 +560,9 @@ class StructType extends @structtype, CompositeType {
568
560
* The depth of a field `f` declared in this type is zero.
569
561
*/
570
562
Field getFieldAtDepth ( string name , int depth ) {
571
- depth = min ( int depthCand | exists ( this .getFieldCand ( name , depthCand , _) ) ) and
572
- result = this .getFieldCand ( name , depth , _) and
573
- strictcount ( this .getFieldCand ( name , depth , _) ) = 1
563
+ depth = min ( int depthCand | exists ( Field f | this .hasFieldCand ( name , f , depthCand , _) ) ) and
564
+ this .hasFieldCand ( name , result , depth , _) and
565
+ strictcount ( Field f | this .hasFieldCand ( name , f , depth , _) ) = 1
574
566
}
575
567
576
568
Method getMethodAtDepth ( string name , int depth ) {
0 commit comments