Skip to content

Commit

Permalink
Add New LAMBDA Modifier (ShiftLeftSecurity#1746)
Browse files Browse the repository at this point in the history
New modifier for identifying methods as anonymous functions/closures.
  • Loading branch information
DavidBakerEffendi authored Nov 20, 2023
1 parent b0faab4 commit 674836a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class ModifierTypes {
/** Indicate that a method defines a module in the sense e.g. a python module does with the creation of a module object */
public static final String MODULE = "MODULE";

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


public static Set<String> ALL = new HashSet<String>() {{
add(STATIC);
Expand All @@ -58,6 +61,7 @@ public class ModifierTypes {
add(FINAL);
add(READONLY);
add(MODULE);
add(LAMBDA);
}};

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ object Ast extends SchemaBase {
fs: FileSystem.Schema
) {
implicit private val schemaInfo: SchemaInfo = SchemaInfo.forClass(getClass)
import methodSchema._
import base._
import namespaces._
import typeSchema._
import fs._
import base.*
import fs.*
import methodSchema.*
import namespaces.*
import typeSchema.*

// Base types

Expand Down Expand Up @@ -239,7 +239,14 @@ object Ast extends SchemaBase {
comment =
"Indicate that a method defines a module in the sense e.g. a python module does with the creation of a module object"
)
.protoId(12)
.protoId(12),
Constant(
name = "LAMBDA",
value = "LAMBDA",
valueType = ValueType.String,
comment = "Indicate that a method is an anonymous function, lambda, or closure"
)
.protoId(13)
)

val modifier: NodeType = builder
Expand Down

0 comments on commit 674836a

Please sign in to comment.