use of php.runtime.memory.ReferenceMemory in project jphp by jphp-compiler.
the class ObjectInvokeHelper method GetAndDecProperty.
public static Memory GetAndDecProperty(Memory object, String property, Environment env, TraceInfo trace, PropertyCallCache callCache, int cacheIndex) throws Throwable {
IObject iObject = fetchObject(object, property, env, trace);
if (iObject == null)
return Memory.NULL;
ReferenceMemory ref = new ReferenceMemory();
iObject.getReflection().minusProperty(env, trace, iObject, property, Memory.CONST_INT_1, ref);
return ref.value;
}
use of php.runtime.memory.ReferenceMemory in project jphp by jphp-compiler.
the class ObjectInvokeHelper method GetAndIncProperty.
public static Memory GetAndIncProperty(Memory object, String property, Environment env, TraceInfo trace, PropertyCallCache callCache, int cacheIndex) throws Throwable {
IObject iObject = fetchObject(object, property, env, trace);
if (iObject == null)
return Memory.NULL;
ReferenceMemory ref = new ReferenceMemory();
iObject.getReflection().plusProperty(env, trace, iObject, property, Memory.CONST_INT_1, ref);
return ref.value;
}
use of php.runtime.memory.ReferenceMemory in project jphp by jphp-compiler.
the class Closure method getOrCreateStatic.
public Memory getOrCreateStatic(String name, Memory initValue) {
if (statics == null)
statics = new HashedMap<String, ReferenceMemory>();
ReferenceMemory result = statics.get(name);
if (result == null) {
result = new ReferenceMemory(initValue);
statics.put(name, result);
}
return result;
}
use of php.runtime.memory.ReferenceMemory in project jphp by jphp-compiler.
the class Generator method setCurrent.
protected Bucket setCurrent(Memory value) {
boolean returnRef = (((GeneratorEntity) getReflection()).isReturnReference());
Bucket current = iterator.getCurrentValue();
if (value instanceof KeyValueMemory) {
if (current != null) {
current.setKey(((KeyValueMemory) value).key);
current.setValue(returnRef ? new ReferenceMemory(value) : value.toValue());
} else {
current = new Bucket(((KeyValueMemory) value).key, returnRef ? new ReferenceMemory(value) : value.toValue());
}
} else {
if (returnRef) {
value = new ReferenceMemory(value);
}
if (current != null) {
current.pushValue(value);
} else {
current = new Bucket(Memory.CONST_INT_0, value);
}
}
return current;
}
use of php.runtime.memory.ReferenceMemory in project jphp by jphp-compiler.
the class ClassEntity method getRefProperty.
public Memory getRefProperty(Environment env, TraceInfo trace, IObject object, String property, PropertyCallCache callCache, int cacheIndex) throws Throwable {
Memory value;
PropertyEntity entity = callCache == null || env instanceof ConcurrentEnvironment ? null : callCache.get(env, cacheIndex);
if (entity == null) {
ClassEntity context = env.getLastClassOnStack();
entity = isInstanceOf(context) ? context.properties.get(property) : properties.get(property);
if (callCache != null) {
callCache.put(env, cacheIndex, entity);
}
}
if (entity == null) {
PropertyEntity staticEntity = staticProperties.get(property);
if (staticEntity != null) {
invalidAccessToProperty(env, trace, staticEntity, staticEntity.canAccess(env));
env.error(trace, ErrorType.E_STRICT, Messages.ERR_ACCESSING_STATIC_PROPERTY_AS_NON_STATIC, staticEntity.getClazz().getName(), staticEntity.getName());
}
}
int accessFlag = entity == null ? 0 : entity.canAccess(env);
ArrayMemory props = object.getProperties();
value = props == null || accessFlag != 0 ? null : props.getByScalar(entity == null ? property : entity.specificName);
if (accessFlag != 0)
invalidAccessToProperty(env, trace, entity, accessFlag);
if (value == null) {
value = props == null ? new ReferenceMemory() : object.getProperties().refOfIndex(property);
if (methodMagicGet != null || methodMagicSet != null) {
env.error(trace, props == null ? ErrorType.E_ERROR : ErrorType.E_NOTICE, Messages.ERR_INDIRECT_MODIFICATION_OVERLOADED_PROPERTY, name, property);
}
}
return value;
}
Aggregations