Skip to content

Aviator 4.2.0 released

Compare
Choose a tag to compare
@killme2008 killme2008 released this 26 May 09:42
· 591 commits to master since this release

Main features:

  1. Fixed closured over wrong variable in nested lambda #134
  2. Adds a new opiton Options.ALWAYS_PARSE_INTEGRAL_NUMBER_INTO_DECIMAL that will parse all integral numbers into big decimal, thanks to @aliiohs #124
  3. Adds seq.contains_key(map, key) to check if the key object is exists in a map and fixed Env#contains_key #122
  4. Adds a new feature: capture function invocation arguments into env, for example:
List<FunctionArgument> args = (List<FunctionArgument>) AviatorEvaluator
		  .execute("f = lambda(a,bc, d) -> __args__ end; f(1,2,100+2)");

The args list is retrieved from env as __args__ var,and it's a list of FunctionArgument:

[
 FunctionArgument [index=0, expression=1],  
 FunctionArgument [index=1, expression=2],
 FunctionArgument [index=2, expression=100+2]
]

This feature is useful for function invocation caching or parameter vailidation, and it's optional, if you want it, you can enable it by setting Options.CAPTURE_FUNCTION_ARGS to be true, default is false.

The argument list can also be captured in custom functions, you can get it through FunctionUtils.getFunctionArguments(env) or env.get("__args__").