use of php.runtime.reflection.ParameterEntity in project jphp by jphp-compiler.
the class ClosureDumper method load.
@Override
public ClosureEntity load(InputStream input) throws IOException {
DumpInputStream data = new DumpInputStream(input);
ClosureEntity entity = new ClosureEntity(context);
entity.setParent(env.scope.fetchUserClass(Closure.class));
entity.setInternalName(data.readName());
entity.setReturnReference(data.readBoolean());
entity.methodMagicInvoke = methodDumper.load(input);
entity.methodMagicInvoke.setClazz(entity);
entity.addMethod(entity.methodMagicInvoke, null);
int paramCount = data.readInt();
if (paramCount < 0)
throw new DumpException("Invalid param count");
entity.parameters = new ParameterEntity[paramCount];
for (int i = 0; i < paramCount; i++) {
ParameterEntity param = parameterDumper.load(input);
param.setTrace(entity.getTrace());
entity.parameters[i] = param;
}
paramCount = data.readInt();
if (paramCount < 0)
throw new DumpException("Invalid param count");
entity.uses = new ParameterEntity[paramCount];
for (int i = 0; i < paramCount; i++) {
ParameterEntity param = parameterDumper.load(input);
param.setTrace(entity.getTrace());
entity.uses[i] = param;
}
entity.setData(data.readRawData(Integer.MAX_VALUE));
return entity;
}
use of php.runtime.reflection.ParameterEntity in project jphp by jphp-compiler.
the class ClosureDumper method save.
@Override
public void save(ClosureEntity entity, OutputStream output) throws IOException {
if (!entity.isLoaded())
throw new DumpException("Closure not loaded");
DumpOutputStream data = new DumpOutputStream(output);
data.writeName(entity.getInternalName());
data.writeBoolean(entity.isReturnReference());
methodDumper.save(entity.methodMagicInvoke, output);
data.writeInt(entity.parameters == null ? 0 : entity.parameters.length);
if (entity.parameters != null)
for (ParameterEntity param : entity.parameters) {
parameterDumper.save(param, output);
}
data.writeInt(entity.uses == null ? 0 : entity.uses.length);
if (entity.uses != null)
for (ParameterEntity param : entity.uses) {
parameterDumper.save(param, output);
}
if (includeData) {
data.writeRawData(entity.getData(), Integer.MAX_VALUE);
} else {
data.writeRawData(null);
}
}
use of php.runtime.reflection.ParameterEntity in project jphp by jphp-compiler.
the class FunctionDumper method save.
@Override
public void save(FunctionEntity entity, OutputStream output) throws IOException {
DumpOutputStream data = new DumpOutputStream(output);
data.writeBoolean(entity.isStatic());
// name
data.writeName(entity.getName());
data.writeName(entity.getInternalName());
data.writeBoolean(entity.isReturnReference());
data.writeBoolean(entity.isUsesStackTrace());
data.writeBoolean(entity.isImmutable());
data.writeMemory(entity.getImmutableResult());
data.writeBoolean(entity.isEmpty());
// trace
data.writeTrace(debugInformation ? entity.getTrace() : null);
data.writeInt(entity.getParameters() == null ? 0 : entity.getParameters().length);
if (entity.getParameters() != null)
for (ParameterEntity param : entity.getParameters()) {
parameterDumper.save(param, output);
}
if (includeData) {
data.writeRawData(entity.getData());
} else {
data.writeRawData(null);
}
data.writeRawData(null);
}
use of php.runtime.reflection.ParameterEntity in project jphp by jphp-compiler.
the class FunctionDumper method load.
@Override
public FunctionEntity load(InputStream input) throws IOException {
DumpInputStream data = new DumpInputStream(input);
FunctionEntity entity = new FunctionEntity(context);
entity.setStatic(data.readBoolean());
entity.setName(data.readName());
entity.setInternalName(data.readName());
entity.setReturnReference(data.readBoolean());
entity.setUsesStackTrace(data.readBoolean());
entity.setImmutable(data.readBoolean());
entity.setResult(data.readMemory());
entity.setEmpty(data.readBoolean());
entity.setTrace(data.readTrace(context));
int paramCount = data.readInt();
if (paramCount < 0)
throw new DumpException("Invalid param count");
entity.setParameters(new ParameterEntity[paramCount]);
for (int i = 0; i < paramCount; i++) {
ParameterEntity param = parameterDumper.load(input);
param.setTrace(entity.getTrace());
entity.getParameters()[i] = param;
}
entity.setData(data.readRawData(Integer.MAX_VALUE));
data.readRawData();
return entity;
}
use of php.runtime.reflection.ParameterEntity in project jphp by jphp-compiler.
the class GeneratorDumper method save.
@Override
public void save(GeneratorEntity entity, OutputStream output) throws IOException {
classDumper.save(entity, output);
DumpOutputStream printer = new DumpOutputStream(output);
printer.writeBoolean(entity.isReturnReference());
printer.writeInt(entity.parameters == null ? 0 : entity.parameters.length);
if (entity.parameters != null) {
for (ParameterEntity param : entity.parameters) {
parameterDumper.save(param, output);
}
}
}
Aggregations