mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
Address review comments
This commit is contained in:
@@ -27,6 +27,6 @@ module Impl {
|
||||
*/
|
||||
class CallExprBase extends Generated::CallExprBase {
|
||||
/** Gets the static target of this call, if any. */
|
||||
Callable getStaticTarget() { none() } // overridden by subclasses
|
||||
Callable getStaticTarget() { none() } // overridden by subclasses, but cannot be made abstract
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,6 +295,11 @@ abstract class ImplOrTraitItemNode extends ItemNode {
|
||||
predicate hasAssocItem(string name) { name = this.getAnAssocItem().getName() }
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
private TypeParamItemNode resolveTypeParamPathTypeRepr(PathTypeRepr ptr) {
|
||||
result = resolvePath(ptr.getPath())
|
||||
}
|
||||
|
||||
class ImplItemNode extends ImplOrTraitItemNode instanceof Impl {
|
||||
Path getSelfPath() { result = super.getSelfTy().(PathTypeRepr).getPath() }
|
||||
|
||||
@@ -310,12 +315,6 @@ class ImplItemNode extends ImplOrTraitItemNode instanceof Impl {
|
||||
this.getSelfPath().getPart().getGenericArgList().getAGenericArg().(TypeArg).getTypeRepr()
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
private TypeParamItemNode getASelfTyTypeParamArg(TypeRepr arg) {
|
||||
arg = this.getASelfTyArg() and
|
||||
result = resolvePath(arg.(PathTypeRepr).getPath())
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if this `impl` block is not fully parametric. That is, the implementing
|
||||
* type is generic and the implementation is not parametrically polymorphic in all
|
||||
@@ -340,9 +339,9 @@ class ImplItemNode extends ImplOrTraitItemNode instanceof Impl {
|
||||
pragma[nomagic]
|
||||
predicate isNotFullyParametric() {
|
||||
exists(TypeRepr arg | arg = this.getASelfTyArg() |
|
||||
not exists(this.getASelfTyTypeParamArg(arg))
|
||||
not exists(resolveTypeParamPathTypeRepr(arg))
|
||||
or
|
||||
this.getASelfTyTypeParamArg(arg).hasTraitBound()
|
||||
resolveTypeParamPathTypeRepr(arg).hasTraitBound()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -500,7 +499,7 @@ private class TypeParamItemNode extends ItemNode instanceof TypeParam {
|
||||
exists(this.getABoundPath())
|
||||
or
|
||||
exists(ItemNode declaringItem, WherePred wp |
|
||||
this = resolvePath(wp.getTypeRepr().(PathTypeRepr).getPath()) and
|
||||
this = resolveTypeParamPathTypeRepr(wp.getTypeRepr()) and
|
||||
wp = declaringItem.getADescendant() and
|
||||
this = declaringItem.getADescendant()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user