• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ VariableEnvironment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中VariableEnvironment的典型用法代码示例。如果您正苦于以下问题:C++ VariableEnvironment类的具体用法?C++ VariableEnvironment怎么用?C++ VariableEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VariableEnvironment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
  }
}
开发者ID:Jostein,项目名称:hiphop-php,代码行数:32,代码来源:unary_op_expression.cpp


示例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);
}
开发者ID:param108,项目名称:hiphop-php,代码行数:7,代码来源:object_property_expression.cpp


示例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)));
}
开发者ID:brion,项目名称:hiphop-php,代码行数:31,代码来源:static_method_expression.cpp


示例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);
  }
}
开发者ID:TitoAgudelo,项目名称:hiphop-php,代码行数:8,代码来源:unset_statement.cpp


示例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");
  }
}
开发者ID:Jostein,项目名称:hiphop-php,代码行数:17,代码来源:ext.cpp


示例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));
  }
}
开发者ID:hashaash,项目名称:hiphop-php,代码行数:8,代码来源:echo_statement.cpp


示例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);
}
开发者ID:hashaash,项目名称:hiphop-php,代码行数:9,代码来源:object_property_expression.cpp


示例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;
}
开发者ID:ArPharazon,项目名称:hiphop-php,代码行数:10,代码来源:try_statement.cpp


示例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;
}
开发者ID:hashaash,项目名称:hiphop-php,代码行数:10,代码来源:object_property_expression.cpp


示例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);
    }
}
开发者ID:,项目名称:,代码行数:19,代码来源:


示例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);
  }
}
开发者ID:hashaash,项目名称:hiphop-php,代码行数:10,代码来源:object_property_expression.cpp


示例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);
}
开发者ID:ArPharazon,项目名称:hiphop-php,代码行数:10,代码来源:expr_statement.cpp


示例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;
}
开发者ID:HyeongKyu,项目名称:hiphop-php,代码行数:11,代码来源:temp_expression_list.cpp


示例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);
}
开发者ID:HyeongKyu,项目名称:hiphop-php,代码行数:41,代码来源:switch_statement.cpp


示例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:;
}
开发者ID:HyeongKyu,项目名称:hiphop-php,代码行数:21,代码来源:while_statement.cpp


示例16: eval

Variant ClosureExpression::eval(VariableEnvironment &env) const {
  m_func->eval(env);
  Array vars;
  for (unsigned int i = 0; i < m_vars.size(); i++) {
    Parameter *param = m_vars[i].get();
    String name = param->getName();
    SuperGlobal sg;
    if (!param->getSuperGlobal(sg)) {
      sg = VariableIndex::isSuperGlobal(name);
    }
    if (param->isRef()) {
      vars.append(ref(env.getVar(name, sg)));
    } else {
      vars.append(env.getVar(name, sg));
    }
  }

  // need to get at low level constructor
  return Object(NEWOBJ(c_GeneratorClosure)(
                m_func->getClosureCallInfo(), m_func.get(), vars));
}
开发者ID:ArPharazon,项目名称:hiphop-php,代码行数:21,代码来源:closure_expression.cpp


示例17: eval

Variant ThisStringPropertyExpression::eval(VariableEnvironment &env) const {
  const Variant *op = &env.currentObject();
  SET_LINE;
  if (!g_context->getDebuggerBypassCheck()) {
    return op->o_get(m_name);
  }
  Variant v = op->o_get(m_name, false);
  if (!v.isNull()) return v;
  CStrRef context = op->isObject() ?
                    op->getObjectData()->o_getClassName() :
                    null_string;
  return op->o_get(m_name, false, context);
}
开发者ID:hashaash,项目名称:hiphop-php,代码行数:13,代码来源:object_property_expression.cpp


示例18: 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 cname = m_cname->get(env);
  bool sp = m_cname->isSp();
  String name(m_name->get(env));
  Variant &vco = env.currentObject();
  Object co;
  if (!vco.isNull()) co = vco.toObject();
  bool withinClass = !co.isNull() && co->o_instanceof(cname.data());
  bool foundClass;
  const MethodStatement *ms = RequestEvalState::findMethod(cname.data(),
                                                           name.data(),
                                                           foundClass);
  if (withinClass) {
    if (m_construct) {
      String name = cname;
      while (true) {
        ClassEvalState *ces = RequestEvalState::findClassState(name.data());
        if (!ces) {
          // possibly built in
          cname = name;
          break;
        }
        // Ugly but needed to populate the method table for the parent
        ces->initializeInstance();
        ms = ces->getConstructor();
        if (ms) break;
        name = ces->getClass()->parent().c_str();
        if (name.empty()) break;
      }
    }
    if (!ms) {
      Array params = getParams(env);
      EvalFrameInjection::EvalStaticClassNameHelper helper(cname, sp);
      return ref(co->o_invoke_ex(cname, name, params));
    } else if (!(ms->getModifiers() & ClassStatement::Static)) {
      EvalFrameInjection::EvalStaticClassNameHelper helper(cname, sp);
      return ref(ms->invokeInstanceDirect(co, env, this));
    }
  }
  if (ms) {
    EvalFrameInjection::EvalStaticClassNameHelper helper(cname, sp);
    return ref(ms->invokeStaticDirect(cname.data(), env, this));
  }
  Array params = getParams(env);
  EvalFrameInjection::EvalStaticClassNameHelper helper(cname, sp);
  return ref(invoke_static_method(cname.data(), name.data(), params));
}
开发者ID:Jostein,项目名称:hiphop-php,代码行数:51,代码来源:static_method_expression.cpp


示例19: weakLval

bool ThisStringPropertyExpression::weakLval(VariableEnvironment &env,
                                        Variant* &v) const {
  Variant *obj = &env.currentObject();

  if (!obj->is(KindOfObject)) {
    SET_LINE;
    raise_error("Using $this when not in an object context");
    return false;
  }
  if (!SET_LINE_EXPR) return false;
  Variant tmp;
  v = &obj->o_unsetLval(m_name, tmp);
  return v != &tmp;
}
开发者ID:hashaash,项目名称:hiphop-php,代码行数:14,代码来源:object_property_expression.cpp


示例20: eval

void TryStatement::eval(VariableEnvironment &env) const {
  if (env.isGotoing()) return;
  ENTER_STMT;
  try {
    EVAL_STMT_HANDLE_GOTO_BEGIN(restart1);
    m_body->eval(env);
    EVAL_STMT_HANDLE_GOTO_END(restart1);
  } catch (Object e) {
    for (vector<CatchBlockPtr>::const_iterator it = m_catches.begin();
         it != m_catches.end(); ++it) {
      if ((*it)->match(e)) {
        if ((*it)->body()) {
          env.get(String((*it)->vname())) = e;
          EVAL_STMT_HANDLE_GOTO_BEGIN(restart2);
          EVAL_STMT((*it)->body(), env);
          EVAL_STMT_HANDLE_GOTO_END(restart2);
        }
        return;
      }
    }
    throw e;
  }
}
开发者ID:Jostein,项目名称:hiphop-php,代码行数:23,代码来源:try_statement.cpp



注:本文中的VariableEnvironment类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VariableExprAST类代码示例发布时间:2022-05-31
下一篇:
C++ VariableDeclaration类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap