mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Java: Add proper types for capture nodes.
This commit is contained in:
@@ -503,14 +503,21 @@ module Private {
|
||||
* captured variables.
|
||||
*/
|
||||
class CaptureNode extends Node, TCaptureNode {
|
||||
CaptureFlow::SynthesizedCaptureNode getSynthesizedCaptureNode() { this = TCaptureNode(result) }
|
||||
private CaptureFlow::SynthesizedCaptureNode cn;
|
||||
|
||||
override Location getLocation() { result = this.getSynthesizedCaptureNode().getLocation() }
|
||||
CaptureNode() { this = TCaptureNode(cn) }
|
||||
|
||||
override string toString() { result = this.getSynthesizedCaptureNode().toString() }
|
||||
CaptureFlow::SynthesizedCaptureNode getSynthesizedCaptureNode() { result = cn }
|
||||
|
||||
// TODO: expose hasTypeProxy(var / callable)
|
||||
Type getTypeImpl() { result instanceof TypeObject }
|
||||
override Location getLocation() { result = cn.getLocation() }
|
||||
|
||||
override string toString() { result = cn.toString() }
|
||||
|
||||
Type getTypeImpl() {
|
||||
exists(Variable v | cn.isVariableAccess(v) and result = v.getType())
|
||||
or
|
||||
cn.isInstanceAccess() and result = cn.getEnclosingCallable().getDeclaringType()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user