diff --git a/ql/src/semmle/go/Types.qll b/ql/src/semmle/go/Types.qll index 9e1d68e3dd1..a4ea805120a 100644 --- a/ql/src/semmle/go/Types.qll +++ b/ql/src/semmle/go/Types.qll @@ -376,7 +376,7 @@ class StructType extends @structtype, CompositeType { } /** - * hasEmbeddedField holds if there is an embedded field at int `depth`, with either type `tp` or `tp`'s pointer type. + * Holds if there is an embedded field at `depth`, with either type `tp` or a pointer to `tp`. */ private predicate hasEmbeddedField(Type tp, int depth) { exists(Field f | this.hasFieldCand(_, f, depth, true) | @@ -386,7 +386,7 @@ class StructType extends @structtype, CompositeType { } /** - * getFieldOfEmbedded gets a field of `embeddedParent`, which is then embedded into this struct type. + * Gets a field of `embeddedParent`, which is then embedded into this struct type. */ Field getFieldOfEmbedded(Field embeddedParent, string name, int depth, boolean isEmbedded) { // embeddedParent is a field of 'this' at depth 'depth - 1' diff --git a/ql/src/semmle/go/controlflow/IR.qll b/ql/src/semmle/go/controlflow/IR.qll index 1bb7781db47..5d0e979c8e3 100644 --- a/ql/src/semmle/go/controlflow/IR.qll +++ b/ql/src/semmle/go/controlflow/IR.qll @@ -368,8 +368,16 @@ module IR { ImplicitFieldReadInstruction() { this = MkImplicitFieldSelection(e, _, implicitField) } + /** + * Gets the selector expression that requires this implicit field read. + */ SelectorExpr getSelectorExpr() { result = e } + /** + * Gets the field being read. Note this is an embedded field that is not explicitly specified + * in `getSelectorExpr()`, whereas the field `getSelectorExpr()` refers to is the promoted field + * contained within this embedded field or in turn within a field that it embeds. + */ Field getField() { result = implicitField } override predicate reads(ValueEntity v) { v = implicitField }