Search in sources :

Example 6 with CallStackItem

use of php.runtime.env.CallStackItem in project jphp by jphp-compiler.

the class Generator method _next.

protected Memory _next(Environment env) {
    if (busy) {
        env.error(env.trace(), "Cannot resume an already running generator");
    }
    boolean x2 = false;
    if (callStackItem != null) {
        env.pushCall(new CallStackItem(callStackItem));
        x2 = true;
    }
    try {
        counter += 1;
        busy = true;
        return iterator.next().getValue();
    } catch (NoSuchElementException e) {
        valid = false;
        callStackItem = null;
    } finally {
        if (x2)
            env.popCall();
        busy = false;
        checkThrow();
    }
    return null;
}
Also used : CallStackItem(php.runtime.env.CallStackItem) NoSuchElementException(java.util.NoSuchElementException)

Example 7 with CallStackItem

use of php.runtime.env.CallStackItem in project jphp by jphp-compiler.

the class BaseBaseException method getProperties.

@Override
public ArrayMemory getProperties() {
    if (!init) {
        init = true;
        if (trace != null) {
            Memory m;
            m = clazz.refOfProperty(props, "file");
            if (m.isNull())
                m.assign(trace.getFileName());
            m = clazz.refOfProperty(props, "line");
            if (m.isNull())
                m.assign(trace.getStartLine() + 1);
            m = clazz.refOfProperty(props, "position");
            if (m.isNull())
                m.assign(trace.getStartPosition() + 1);
            ArrayMemory backTrace = new ArrayMemory();
            for (CallStackItem el : callStack) backTrace.add(el.toArray());
            clazz.refOfProperty(props, "trace").assign(backTrace);
        }
    }
    return props;
}
Also used : ArrayMemory(php.runtime.memory.ArrayMemory) CallStackItem(php.runtime.env.CallStackItem) Memory(php.runtime.Memory) ArrayMemory(php.runtime.memory.ArrayMemory) StringMemory(php.runtime.memory.StringMemory)

Aggregations

CallStackItem (php.runtime.env.CallStackItem)7 StringMemory (php.runtime.memory.StringMemory)3 ArrayMemory (php.runtime.memory.ArrayMemory)2 ArrayList (java.util.ArrayList)1 NoSuchElementException (java.util.NoSuchElementException)1 DebugTick (org.develnext.jphp.debug.impl.DebugTick)1 Element (org.w3c.dom.Element)1 Memory (php.runtime.Memory)1 Signature (php.runtime.annotation.Reflection.Signature)1 CallStack (php.runtime.env.CallStack)1 TraceInfo (php.runtime.env.TraceInfo)1