Search in sources :

Example 26 with ParameterEntity

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

the class MethodDumper method save.

@Override
public void save(MethodEntity entity, OutputStream output) throws IOException {
    DumpOutputStream print = new DumpOutputStream(output);
    DocumentComment docComment = entity.getDocComment();
    if (docComment != null) {
        print.writeUTF(docComment.toString());
    } else {
        print.writeUTF("");
    }
    // static
    print.writeBoolean(entity.isStatic());
    // final
    print.writeBoolean(entity.isFinal());
    // abstract
    print.writeBoolean(entity.isAbstract());
    // abstractable
    print.writeBoolean(entity.isAbstractable());
    // immutable
    print.writeBoolean(entity.isImmutable());
    print.writeMemory(entity.getImmutableResult());
    print.writeBoolean(entity.isEmpty());
    // ref
    print.writeBoolean(entity.isReturnReference());
    // uses stack trace
    print.writeBoolean(entity.isUsesStackTrace());
    // modifier
    print.writeEnum(entity.getModifier());
    // name
    print.writeName(entity.getName());
    print.writeName(entity.getInternalName());
    // trace
    print.writeTrace(debugInformation ? entity.getTrace() : null);
    print.writeInt(entity.getParameters() == null ? 0 : entity.getParameters().length);
    if (entity.getParameters() != null)
        for (ParameterEntity param : entity.getParameters()) {
            parameterDumper.save(param, output);
        }
    // raw data
    print.writeRawData(null);
}
Also used : DocumentComment(php.runtime.reflection.DocumentComment) ParameterEntity(php.runtime.reflection.ParameterEntity) DumpOutputStream(php.runtime.loader.dump.io.DumpOutputStream)

Example 27 with ParameterEntity

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

the class ParameterDumper method load.

@Override
public ParameterEntity load(InputStream input) throws IOException {
    DumpInputStream data = new DumpInputStream(input);
    ParameterEntity entity = new ParameterEntity(context);
    entity.setType(data.readHintType());
    String typeClass = data.readName();
    if (typeClass != null && !typeClass.isEmpty()) {
        entity.setTypeClass(typeClass);
    }
    entity.setReference(data.readBoolean());
    entity.setMutable(data.readBoolean());
    entity.setUsed(data.readBoolean());
    entity.setVariadic(data.readBoolean());
    entity.setNullable(data.readBoolean());
    entity.setName(data.readName());
    entity.setTrace(data.readTrace(context));
    entity.setDefaultValue(data.readMemory());
    entity.setDefaultValueConstName(data.readName());
    byte[] raw = data.readRawData();
    return entity;
}
Also used : DumpInputStream(php.runtime.loader.dump.io.DumpInputStream) ParameterEntity(php.runtime.reflection.ParameterEntity)

Aggregations

ParameterEntity (php.runtime.reflection.ParameterEntity)27 Test (org.junit.Test)8 ObjectMemory (php.runtime.memory.ObjectMemory)7 ArrayMemory (php.runtime.memory.ArrayMemory)6 Memory (php.runtime.Memory)5 DumpException (php.runtime.loader.dump.io.DumpException)5 DumpInputStream (php.runtime.loader.dump.io.DumpInputStream)5 DumpOutputStream (php.runtime.loader.dump.io.DumpOutputStream)4 ReferenceMemory (php.runtime.memory.ReferenceMemory)3 VariadicMemory (php.runtime.memory.helper.VariadicMemory)3 DocumentComment (php.runtime.reflection.DocumentComment)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 ForeachIterator (php.runtime.lang.ForeachIterator)2 ClassEntity (php.runtime.reflection.ClassEntity)2 FunctionEntity (php.runtime.reflection.FunctionEntity)2 MethodEntity (php.runtime.reflection.MethodEntity)2 ClosureEntity (php.runtime.reflection.helper.ClosureEntity)2 Constructor (java.lang.reflect.Constructor)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1