Search in sources :

Example 1 with DynamicAccessAssignExprToken

use of org.develnext.jphp.core.tokenizer.token.expr.operator.DynamicAccessAssignExprToken in project jphp by jphp-compiler.

the class CallCompiler method writePushDynamicMethod.

/**
 * $var->method()
 */
public Memory writePushDynamicMethod(CallExprToken function, boolean returnValue, boolean writeOpcode, PushCallStatistic statistic) {
    expr.getMethod().getEntity().setImmutable(false);
    if (!writeOpcode)
        return null;
    DynamicAccessExprToken access = (DynamicAccessExprToken) function.getName();
    if (access instanceof DynamicAccessAssignExprToken) {
        expr.unexpectedToken(access);
    }
    expr.writeLineNumber(function);
    expr.writeDynamicAccessPrepare(access, true);
    expr.writePushParameters(function.getParameters());
    expr.writeSysStaticCall(ObjectInvokeHelper.class, "invokeMethod", Memory.class, Memory.class, String.class, String.class, Environment.class, TraceInfo.class, Memory[].class);
    if (!returnValue) {
        expr.writePopAll(1);
    }
    if (statistic != null) {
        statistic.returnType = StackItem.Type.REFERENCE;
    }
    return null;
}
Also used : Memory(php.runtime.Memory) DynamicAccessAssignExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.DynamicAccessAssignExprToken) DynamicAccessExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.DynamicAccessExprToken)

Aggregations

DynamicAccessAssignExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.DynamicAccessAssignExprToken)1 DynamicAccessExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.DynamicAccessExprToken)1 Memory (php.runtime.Memory)1