use of org.develnext.jphp.core.tokenizer.token.expr.value.StaticExprToken in project jphp by jphp-compiler.
the class NewValueCompiler method write.
@Override
public void write(NewExprToken token, boolean returnValue) {
method.getEntity().setImmutable(false);
expr.writeLineNumber(token);
expr.writePushEnv();
if (token.isDynamic()) {
Memory className = expr.writeExpression(token.getExprName(), true, true, false);
if (className != null) {
expr.writePushConstString(className.toString());
expr.writePushConstString(className.toString().toLowerCase());
} else {
expr.writeExpression(token.getExprName(), true, false);
expr.writePopString();
expr.writePushDupLowerCase();
}
} else {
if (token.getName() instanceof StaticExprToken) {
expr.writePushStatic();
expr.writePushDupLowerCase();
} else if (token.getName() instanceof SelfExprToken) {
expr.writePushEnv();
expr.writeSysDynamicCall(Environment.class, "__getMacroClass", Memory.class);
expr.writePopString();
expr.writePushDupLowerCase();
} else {
FulledNameToken name = (FulledNameToken) token.getName();
expr.writePushString(name.getName());
expr.writePushString(name.getName().toLowerCase());
}
}
expr.writePushTraceInfo(token);
expr.writePushParameters(token.getParameters());
expr.writeSysDynamicCall(Environment.class, "__newObject", Memory.class, String.class, String.class, TraceInfo.class, Memory[].class);
expr.setStackPeekAsImmutable();
if (!returnValue)
expr.writePopAll(1);
}
Aggregations