public function getResolvedParamsAsExpr($parameters, CompilationContext $compilationContext, $expression, $readOnly = false)
    {
        if (!$this->resolvedParams) {
            $hasParametersByName = false;
            foreach ($parameters as $parameter) {
                if (isset($parameter['name'])) {
                    $hasParametersByName = true;
                    break;
                }
            }

            /*
             * All parameters must be passed by name
             */
            if ($hasParametersByName) {
                foreach ($parameters as $parameter) {
                    if (!isset($parameter['name'])) {
                        throw new CompilerException('All parameters must use named', $parameter);
                    }
                }
            }

            if ($hasParametersByName) {
                if ($this->reflection) {
                    $positionalParameters = [];
                    foreach ($this->reflection->getParameters() as $position => $reflectionParameter) {
                        if (\is_object($reflectionParameter)) {
                            $positionalParameters[$reflectionParameter->getName()] = $position;
                        } else {
                            $positionalParameters[$reflectionParameter['name']] = $position;
                        }
                    }
                    $orderedParameters = [];
                    foreach ($parameters as $parameter) {
                        if (isset($positionalParameters[$parameter['name']])) {
                            $orderedParameters[$positionalParameters[$parameter['name']]] = $parameter;
                        } else {
                            throw new CompilerException('Named parameter "'.$parameter['name'].'" is not a valid parameter name, available: '.implode(', ', array_keys($positionalParameters)), $parameter['parameter']);
                        }
                    }
                    $parameters_count = \count($parameters);
                    for ($i = 0; $i < $parameters_count; ++$i) {
                        if (!isset($orderedParameters[$i])) {
                            $orderedParameters[$i] = ['parameter' => ['type' => 'null']];
                        }
                    }
                    $parameters = $orderedParameters;
                }
            }

            $params = [];
            foreach ($parameters as $parameter) {
                if (\is_array($parameter['parameter'])) {
                    $paramExpr = new Expression($parameter['parameter']);

                    switch ($parameter['parameter']['type']) {
                        case 'property-access':
                        case 'array-access':
                        case 'static-property-access':
                            $paramExpr->setReadOnly(true);
                            break;

                        default:
                            $paramExpr->setReadOnly($readOnly);
                            break;
                    }

                    $params[] = $paramExpr->compile($compilationContext);
                    continue;
                }

                if ($parameter['parameter'] instanceof CompiledExpression) {
                    $params[] = $parameter['parameter'];
                    continue;
                }

                throw new CompilerException('Invalid expression ', $expression);
            }
            $this->resolvedParams = $params;
        }

        return $this->resolvedParams;
    }