Skip to content

Commit f2241e0

Browse files
yofftausbn
andauthored
Apply suggestions from code review
Co-authored-by: Taus <tausbn@github.com>
1 parent 9b13834 commit f2241e0

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

python/ql/src/semmle/python/Function.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ class Function extends Function_, Scope, AstNode {
4040
}
4141

4242
/**
43-
* Whether this is a lambda.
44-
* We detect this by comparing its name to the one the extractor gives to lambdas.
43+
* Holds if this function represents a lambda.
44+
*
45+
* The extractor reifies each lambda expression as a (local) function with the name
46+
* "lambda". As `lambda` is a keyword in Python, it's impossible to create a function with this
47+
* name otherwise, and so it's impossible to get a non-lambda function accidentally
48+
* classified as a lambda.
4549
*/
4650
predicate isLambda() { this.getName() = "lambda" }
4751

python/ql/src/semmle/python/objects/ObjectAPI.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ abstract class FunctionValue extends CallableValue {
721721
/** Gets a class that this function may return */
722722
abstract ClassValue getAnInferredReturnType();
723723

724-
/** Wheter this is a lambda function */
724+
/** Holds if this function represents a lambda. */
725725
predicate isLambda() { this.getOrigin().getNode() instanceof Lambda }
726726
}
727727

0 commit comments

Comments
 (0)