public static ArrayMapBytecodeExpression map(Scope scope, CachedInstanceBinder cachedInstanceBinder, Type fromElementType, Type toElementType, Variable array, String elementFunctionName, ScalarFunctionImplementation elementFunction) { return map( scope, cachedInstanceBinder.getCallSiteBinder(), fromElementType, toElementType, array, element -> invokeFunction(scope, cachedInstanceBinder, elementFunctionName, elementFunction, element)); }
public static BytecodeExpression invokeFunction(Scope scope, CachedInstanceBinder cachedInstanceBinder, String name, ScalarFunctionImplementation function, List<BytecodeExpression> parameters) { requireNonNull(scope, "scope is null"); requireNonNull(function, "function is null"); Optional<BytecodeNode> instance = Optional.empty(); if (function.getInstanceFactory().isPresent()) { FieldDefinition field = cachedInstanceBinder.getCachedInstance(function.getInstanceFactory().get()); instance = Optional.of(scope.getThis().getField(field)); } return new InvokeFunctionBytecodeExpression(scope, cachedInstanceBinder.getCallSiteBinder(), name, function, instance, parameters); }
public static ArrayMapBytecodeExpression map(Scope scope, CachedInstanceBinder cachedInstanceBinder, Type fromElementType, Type toElementType, Variable array, String elementFunctionName, ScalarFunctionImplementation elementFunction) { return map( scope, cachedInstanceBinder.getCallSiteBinder(), fromElementType, toElementType, array, element -> invokeFunction(scope, cachedInstanceBinder, elementFunctionName, elementFunction, element)); }
public static BytecodeExpression invokeFunction(Scope scope, CachedInstanceBinder cachedInstanceBinder, String name, ScalarFunctionImplementation function, List<BytecodeExpression> parameters) { requireNonNull(scope, "scope is null"); requireNonNull(function, "function is null"); Binding binding = cachedInstanceBinder.getCallSiteBinder().bind(function.getMethodHandle()); Optional<BytecodeNode> instance = Optional.empty(); if (function.getInstanceFactory().isPresent()) { FieldDefinition field = cachedInstanceBinder.getCachedInstance(function.getInstanceFactory().get()); instance = Optional.of(scope.getThis().getField(field)); } return new InvokeFunctionBytecodeExpression(scope, binding, name, function, instance, parameters); }