Skip to content

Commit 674836a

Browse files
Add New LAMBDA Modifier (#1746)
New modifier for identifying methods as anonymous functions/closures.
1 parent b0faab4 commit 674836a

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

  • domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated
  • schema/src/main/scala/io/shiftleft/codepropertygraph/schema

domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/ModifierTypes.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public class ModifierTypes {
4444
/** Indicate that a method defines a module in the sense e.g. a python module does with the creation of a module object */
4545
public static final String MODULE = "MODULE";
4646

47+
/** Indicate that a method is an anonymous function, lambda, or closure */
48+
public static final String LAMBDA = "LAMBDA";
49+
4750

4851
public static Set<String> ALL = new HashSet<String>() {{
4952
add(STATIC);
@@ -58,6 +61,7 @@ public class ModifierTypes {
5861
add(FINAL);
5962
add(READONLY);
6063
add(MODULE);
64+
add(LAMBDA);
6165
}};
6266

6367
}

schema/src/main/scala/io/shiftleft/codepropertygraph/schema/Ast.scala

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ object Ast extends SchemaBase {
4747
fs: FileSystem.Schema
4848
) {
4949
implicit private val schemaInfo: SchemaInfo = SchemaInfo.forClass(getClass)
50-
import methodSchema._
51-
import base._
52-
import namespaces._
53-
import typeSchema._
54-
import fs._
50+
import base.*
51+
import fs.*
52+
import methodSchema.*
53+
import namespaces.*
54+
import typeSchema.*
5555

5656
// Base types
5757

@@ -239,7 +239,14 @@ object Ast extends SchemaBase {
239239
comment =
240240
"Indicate that a method defines a module in the sense e.g. a python module does with the creation of a module object"
241241
)
242-
.protoId(12)
242+
.protoId(12),
243+
Constant(
244+
name = "LAMBDA",
245+
value = "LAMBDA",
246+
valueType = ValueType.String,
247+
comment = "Indicate that a method is an anonymous function, lambda, or closure"
248+
)
249+
.protoId(13)
243250
)
244251

245252
val modifier: NodeType = builder

0 commit comments

Comments
 (0)