Search in sources :

Example 1 with CompileFunctionEntity

use of php.runtime.reflection.CompileFunctionEntity in project jphp by jphp-compiler.

the class ReflectionFunction method getParameters.

@Override
@Signature
public Memory getParameters(Environment env, Memory... args) {
    if (cachedParameters != null)
        return cachedParameters;
    if (functionEntity instanceof CompileFunctionEntity)
        exception(env, "Cannot get parameters for internal function %s()", functionEntity.getName());
    ParameterEntity[] parameters = closureEntity == null ? functionEntity.getParameters() : closureEntity.parameters;
    ClassEntity entity = env.fetchClass("ReflectionParameter");
    ArrayMemory result = new ArrayMemory();
    int i = 0;
    for (ParameterEntity param : parameters) {
        ReflectionParameter e = new ReflectionParameter(env, entity);
        e.setEntity(param);
        e.setFunctionEntity(functionEntity);
        e.setPosition(i);
        i++;
        result.add(new ObjectMemory(e));
    }
    return cachedParameters = result;
}
Also used : ClassEntity(php.runtime.reflection.ClassEntity) ArrayMemory(php.runtime.memory.ArrayMemory) ParameterEntity(php.runtime.reflection.ParameterEntity) ObjectMemory(php.runtime.memory.ObjectMemory) CompileFunctionEntity(php.runtime.reflection.CompileFunctionEntity)

Aggregations

ArrayMemory (php.runtime.memory.ArrayMemory)1 ObjectMemory (php.runtime.memory.ObjectMemory)1 ClassEntity (php.runtime.reflection.ClassEntity)1 CompileFunctionEntity (php.runtime.reflection.CompileFunctionEntity)1 ParameterEntity (php.runtime.reflection.ParameterEntity)1