本文整理汇总了C++中VariableEnvironment类的典型用法代码示例。如果您正苦于以下问题:C++ VariableEnvironment类的具体用法?C++ VariableEnvironment怎么用?C++ VariableEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VariableEnvironment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eval
Variant UnaryOpExpression::eval(VariableEnvironment &env) const {
if (m_op == '@') {
Silencer s;
s.enable();
return m_exp->eval(env);
} else if (m_op == T_ISSET || m_op == T_EMPTY) {
return m_exp->exist(env, m_op);
}
Variant exp(m_exp ? m_exp->eval(env) : null_variant);
SET_LINE;
switch (m_op) {
case T_CLONE: return f_clone(exp);
case '+': return +exp;
case '-': return negate(exp);
case '!': return !exp;
case '~': return ~exp;
case T_INT_CAST: return toInt64(exp);
case T_DOUBLE_CAST: return toDouble(exp);
case T_STRING_CAST: return toString(exp);
case T_ARRAY_CAST: return toArray(exp);
case T_OBJECT_CAST: return toObject(exp);
case T_BOOL_CAST: return toBoolean(exp);
case T_UNSET_CAST: return unset(exp);
case T_EXIT: return f_exit(exp);
case T_PRINT: return print(exp.toString());
case T_EVAL: return HPHP::eval(&env, env.currentObject(), exp);
default:
ASSERT(false);
return Variant();
}
}
示例2: eval
Variant ObjectPropertyExpression::eval(VariableEnvironment &env) const {
Variant obj(m_obj->eval(env));
String name(m_name->get(env));
env.setThis(false);
SET_LINE;
return obj.o_get(name);
}
示例3: eval
Variant StaticMethodExpression::eval(VariableEnvironment &env) const {
SET_LINE;
// Static method expressions can be object method expressions inside
// of a method when an object is available and the object's class inherits.
// Super slow.
String name(m_name->get(env));
Object co(env.currentObject());
bool withinClass = !co.isNull() && co->o_instanceof(m_cname.data());
bool foundClass;
const MethodStatement *ms = RequestEvalState::findMethod(m_cname.data(),
name.data(),
foundClass);
if (withinClass) {
if (m_construct && !ms) {
// In a class method doing __construct will go to the name constructor
ms = RequestEvalState::findMethod(m_cname.data(),
m_cname.data(),
foundClass);
}
if (ms) {
return ref(ms->invokeInstanceDirect(co, env, this));
}
return ref(co->o_invoke_ex(m_cname.data(), name.data(), getParams(env),
m_name->hashLwr()));
}
if (ms) {
return ref(ms->invokeStaticDirect(m_cname.data(), env, this));
}
return ref(invoke_static_method(m_cname.data(), name.data(), getParams(env)));
}
示例4: eval
void UnsetStatement::eval(VariableEnvironment &env) const {
if (env.isGotoing()) return;
ENTER_STMT;
for (std::vector<LvalExpressionPtr>::const_iterator it = m_vals.begin();
it != m_vals.end(); ++it) {
(*it)->unset(env);
}
}
示例5: InvokeImpl
Variant EvalFuncGetArgs::InvokeImpl(VariableEnvironment &env,
CArrRef params) {
int size = params.size();
switch (size) {
case 0: {
if (ObjectData *cont = env.getContinuation()) {
return cont->o_invoke("get_args", Array::Create());
}
Array res = Array::Create();
for (ArrayIter iter(env.getParams()); !iter.end(); iter.next()) {
res.append(iter.second());
}
return res;
}
default: return invalid_function_call("func_get_args");
}
}
示例6: eval
void EchoStatement::eval(VariableEnvironment &env) const {
if (env.isGotoing()) return;
ENTER_STMT;
for (vector<ExpressionPtr>::const_iterator it = m_args.begin();
it != m_args.end(); ++it) {
echo((*it)->eval(env));
}
}
示例7: unset
void ThisStringPropertyExpression::unset(VariableEnvironment &env) const {
Variant *obj = &env.currentObject();
if (!obj->is(KindOfObject)) {
SET_LINE_VOID;
raise_error("Using $this when not in an object context");
}
obj->o_unset(m_name);
}
示例8: proc
bool CatchBlock::proc(CObjRef exn, VariableEnvironment &env) const {
if (exn.instanceof(m_ename.c_str())) {
if (m_body) {
env.getVar(m_vname, m_sg) = exn;
m_body->eval(env);
}
return true;
}
return false;
}
示例9: setRef
Variant ThisStringPropertyExpression::setRef(VariableEnvironment &env,
CVarRef val) const {
Variant &lv = env.currentObject();
SET_LINE;
if (!lv.is(KindOfObject)) {
raise_error("Using $this when not in an object context");
}
lv.o_setRef(m_name, val);
return val;
}
示例10: collectClosureVariablesUnderTDZ
void JSScope::collectClosureVariablesUnderTDZ(JSScope* scope, VariableEnvironment& result)
{
for (; scope; scope = scope->next()) {
if (!scope->isLexicalScope() && !scope->isCatchScope())
continue;
if (scope->isModuleScope()) {
AbstractModuleRecord* moduleRecord = jsCast<JSModuleEnvironment*>(scope)->moduleRecord();
for (const auto& pair : moduleRecord->importEntries())
result.add(pair.key);
}
SymbolTable* symbolTable = jsCast<JSSymbolTableObject*>(scope)->symbolTable();
ASSERT(symbolTable->scopeType() == SymbolTable::ScopeType::LexicalScope || symbolTable->scopeType() == SymbolTable::ScopeType::CatchScope);
ConcurrentJSLocker locker(symbolTable->m_lock);
for (auto end = symbolTable->end(locker), iter = symbolTable->begin(locker); iter != end; ++iter)
result.add(iter->key);
}
}
示例11: exist
bool ThisStringPropertyExpression::exist(VariableEnvironment &env, int op)
const {
Variant *obj = &env.currentObject();
SET_LINE;
if (op == T_ISSET) {
return obj->o_isset(m_name);
} else {
return obj->o_empty(m_name);
}
}
示例12: eval
void ExprStatement::eval(VariableEnvironment &env) const {
if (env.isGotoing()) return;
// if m_exp hasn't set the line yet, set it, otherwise, we can skip
// so to avoid annoying double-stay with debugger's "step" command.
if (loc()->line1 != ThreadInfo::s_threadInfo->m_top->getLine()) {
ENTER_STMT;
}
m_exp->eval(env);
}
示例13: evalOffsets
bool TempExpressionList::evalOffsets(VariableEnvironment &env) const {
if (!m_offsets.empty()) {
vector<Variant> &temps = env.createTempVariables();
temps.reserve(m_offsets.size());
for (unsigned int i = 0; i < m_offsets.size(); i++) {
temps.push_back(m_offsets[i]->eval(env));
}
return true;
}
return false;
}
示例14: eval
void SwitchStatement::eval(VariableEnvironment &env) const {
bool gotoing = false;
if (env.isGotoing()) {
if (env.isLimitedGoto()) return;
gotoing = true;
}
ENTER_STMT;
Variant source, *srcPtr;
if (!gotoing) {
if (!m_simpleVar) {
source = m_source->eval(env);
srcPtr = &source;
} else {
m_source->cast<VariableExpression>()->weakLval(env, srcPtr);
}
}
bool matched = false;
vector<CaseStatementPtr>::const_iterator defaultPos = m_cases.end();
EVAL_STMT_HANDLE_GOTO_BEGIN(restart);
for (vector<CaseStatementPtr>::const_iterator iter = m_cases.begin();
iter != m_cases.end(); ++iter) {
if (!gotoing) {
if ((*iter)->isDefault()) {
defaultPos = iter;
} else if (!matched && (*iter)->match(env, *srcPtr)) {
matched = true;
}
}
if (gotoing || matched) {
EVAL_STMT_HANDLE_BREAK_CONT(*iter, env);
}
}
if (!gotoing && !matched && defaultPos != m_cases.end()) {
for (; defaultPos != m_cases.end(); ++defaultPos) {
EVAL_STMT_HANDLE_BREAK_CONT(*defaultPos, env);
}
}
EVAL_STMT_HANDLE_GOTO_END(restart);
}
示例15: eval
void WhileStatement::eval(VariableEnvironment &env) const {
DECLARE_THREAD_INFO;
if (env.isGotoing()) {
if (env.isLimitedGoto()) return;
goto body;
}
ENTER_STMT;
LOOP_COUNTER(1);
begin:
if (m_cond->eval(env)) {
body:
LOOP_COUNTER_CHECK_INFO(1);
EVAL_STMT_HANDLE_GOTO_BEGIN(restart);
if (m_body) EVAL_STMT_HANDLE_GOTO(m_body, env);
EVAL_STMT_HANDLE_GOTO_END(restart);
goto begin;
}
end:;
}