mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Add comments noting methods from embedded interfaces are already included
This commit is contained in:
@@ -1618,6 +1618,9 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
|
||||
case *types.Interface:
|
||||
kind = dbscheme.InterfaceType.Index()
|
||||
for i := 0; i < tp.NumMethods(); i++ {
|
||||
// Note that methods coming from embedded interfaces can be
|
||||
// accessed through `Method(i)`, so there is no need to
|
||||
// deal with them separately.
|
||||
meth := tp.Method(i)
|
||||
|
||||
// Note that methods do not have a parent scope, so they are
|
||||
|
||||
@@ -737,12 +737,17 @@ class TypeSetLiteralType extends @typesetliteraltype, CompositeType {
|
||||
override string toString() { result = "type set literal type" }
|
||||
}
|
||||
|
||||
predicate foo(NamedType t, string name, Type mt) {
|
||||
t.getUnderlyingType().(InterfaceType).getMethodType(name) = mt
|
||||
}
|
||||
|
||||
/** An interface type. */
|
||||
class InterfaceType extends @interfacetype, CompositeType {
|
||||
/** Gets the type of method `name` of this interface type. */
|
||||
Type getMethodType(string name) {
|
||||
// Note that negative indices correspond to embedded interfaces and type
|
||||
// set literals.
|
||||
// set literals. Note also that methods coming from embedded interfaces
|
||||
// have already been included in `component_types`.
|
||||
exists(int i | i >= 0 | component_types(this, i, name, result))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user