Skip to content

Commit 7b3ba3c

Browse files
committed
C#: Modify database schema to allow lambda expression to be attributable and extract the lambda expression attributes.
1 parent f412d49 commit 7b3ba3c

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Lambda.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ private Lambda(ExpressionNodeInfo info, CSharpSyntaxNode body, IEnumerable<Param
2828
if (Context.GetModel(info.Node).GetSymbolInfo(info.Node).Symbol is IMethodSymbol symbol)
2929
{
3030
Modifier.ExtractModifiers(Context, info.Context.TrapWriter.Writer, this, symbol);
31+
Attribute.ExtractAttributes(Context, symbol, this);
3132
}
3233
else
3334
{

csharp/ql/lib/semmle/code/csharp/Attribute.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ private import TypeRef
1010
* An element that can have attributes. Either an assembly (`Assembly`), a field (`Field`),
1111
* a parameter (`Parameter`), an operator (`Operator`), a method (`Method`), a constructor (`Constructor`),
1212
* a destructor (`Destructor`), a callable accessor (`CallableAccessor`), a value or reference type
13-
* (`ValueOrRefType`), a declaration with accessors (`DeclarationWithAccessors`), or a local function
14-
* (`LocalFunction`).
13+
* (`ValueOrRefType`), a declaration with accessors (`DeclarationWithAccessors`), a local function
14+
* (`LocalFunction`) or a lambda expression (`LambdaExp`).
1515
*/
1616
class Attributable extends @attributable {
1717
/** Gets an attribute attached to this element, if any. */

csharp/ql/lib/semmlecode.csharp.dbscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ sourceLocationPrefix(
191191

192192
@attributable = @assembly | @field | @parameter | @operator | @method | @constructor
193193
| @destructor | @callable_accessor | @value_or_ref_type | @declaration_with_accessors
194-
| @local_function;
194+
| @local_function | @lambda_expr;
195195

196196
/** LOCATIONS, ASEMMBLIES, MODULES, FILES and FOLDERS **/
197197

0 commit comments

Comments
 (0)