本文整理汇总了C++中AccessVariable::execute方法的典型用法代码示例。如果您正苦于以下问题:C++ AccessVariable::execute方法的具体用法?C++ AccessVariable::execute怎么用?C++ AccessVariable::execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccessVariable
的用法示例。
在下文中一共展示了AccessVariable::execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_access_variable
void test_access_variable() {
AccessVariable* av = AccessVariable::allocate(state);
Arguments args(state->symbol("blah"), G(object));
av->name(state, state->symbol("@blah"));
G(object)->set_ivar(state, av->name(), state->symbol("Sweet"));
Object* ret = av->execute(state, av, G(object), args);
TS_ASSERT(try_as<Symbol>(ret));
TS_ASSERT_EQUALS(std::string("Sweet"), as<Symbol>(ret)->cpp_str(state));
}
示例2: test_write_variable
void test_write_variable() {
AccessVariable* av = AccessVariable::allocate(state);
Symbol* val = state->symbol("Blah");
Object* ary[1] = {val};
Arguments args(state->symbol("blah"), G(object), 1, ary);
av->name(state, state->symbol("@blah"));
av->write(state, cTrue);
Object* ret = av->execute(state, av, G(object), args);
TS_ASSERT_EQUALS(ret, val);
Symbol* out = as<Symbol>(G(object)->get_ivar(state, av->name()));
TS_ASSERT_EQUALS(val, out);
}