本文整理汇总了C++中CompiledMethod::exceptions方法的典型用法代码示例。如果您正苦于以下问题:C++ CompiledMethod::exceptions方法的具体用法?C++ CompiledMethod::exceptions怎么用?C++ CompiledMethod::exceptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompiledMethod
的用法示例。
在下文中一共展示了CompiledMethod::exceptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_cmethod
void test_cmethod() {
std::string str = "M\n1\nn\nx\n12\nobject_equal\nx\n4\ntest\ni\n1\n0\nI\n10\nI\n0\nI\n0\nI\n0\nn\np\n2\nI\n1\nI\n2\nn\np\n1\np\n3\nI\n0\nI\n1\nI\n1\nx\n8\nnot_real\np\n1\nx\n4\nblah\n";
mar->sstream.str(str);
Object* obj = mar->unmarshal();
TS_ASSERT(kind_of<CompiledMethod>(obj));
CompiledMethod* cm = as<CompiledMethod>(obj);
TS_ASSERT_EQUALS(cm->ivars(), Qnil);
TS_ASSERT_EQUALS(cm->primitive(), state->symbol("object_equal"));
TS_ASSERT_EQUALS(cm->name(), state->symbol("test"));
TS_ASSERT(tuple_equals(cm->iseq()->opcodes(), Tuple::from(state, 1, Fixnum::from(0))));
TS_ASSERT_EQUALS(cm->stack_size(), Fixnum::from(10));
TS_ASSERT_EQUALS(cm->local_count(), Fixnum::from(0));
TS_ASSERT_EQUALS(cm->required_args(), Fixnum::from(0));
TS_ASSERT_EQUALS(cm->total_args(), Fixnum::from(0));
TS_ASSERT_EQUALS(cm->splat(), Qnil);
TS_ASSERT(tuple_equals(cm->literals(), Tuple::from(state, 2, Fixnum::from(1), Fixnum::from(2))));
TS_ASSERT_EQUALS(cm->exceptions(), Qnil);
TS_ASSERT(tuple_equals(cm->lines(), Tuple::from(state, 1,
Tuple::from(state, 3, Fixnum::from(0), Fixnum::from(1), Fixnum::from(1)))));
TS_ASSERT_EQUALS(cm->file(), state->symbol("not_real"));
TS_ASSERT(tuple_equals(cm->local_names(), Tuple::from(state, 1, state->symbol("blah"))));
}
示例2: get_cmethod
CompiledMethod* UnMarshaller::get_cmethod() {
size_t ver;
stream >> ver;
CompiledMethod* cm = CompiledMethod::create(state);
cm->ivars(state, unmarshal());
cm->primitive(state, (Symbol*)unmarshal());
cm->name(state, (Symbol*)unmarshal());
cm->iseq(state, (InstructionSequence*)unmarshal());
cm->stack_size(state, (Fixnum*)unmarshal());
cm->local_count(state, (Fixnum*)unmarshal());
cm->required_args(state, (Fixnum*)unmarshal());
cm->total_args(state, (Fixnum*)unmarshal());
cm->splat(state, unmarshal());
cm->literals(state, (Tuple*)unmarshal());
cm->exceptions(state, (Tuple*)unmarshal());
cm->lines(state, (Tuple*)unmarshal());
cm->file(state, (Symbol*)unmarshal());
cm->local_names(state, (Tuple*)unmarshal());
cm->post_marshal(state);
return cm;
}
示例3:
void CompiledMethod::Info::show(STATE, Object* self, int level) {
CompiledMethod* cm = as<CompiledMethod>(self);
class_header(state, self);
indent_attribute(++level, "exceptions"); cm->exceptions()->show_simple(state, level);
indent_attribute(level, "file"); cm->file()->show(state, level);
indent_attribute(level, "iseq"); cm->iseq()->show(state, level);
indent_attribute(level, "lines"); cm->lines()->show_simple(state, level);
indent_attribute(level, "literals"); cm->literals()->show_simple(state, level);
indent_attribute(level, "local_count"); cm->local_count()->show(state, level);
indent_attribute(level, "local_names"); cm->local_names()->show_simple(state, level);
indent_attribute(level, "name"); cm->name()->show(state, level);
indent_attribute(level, "required_args"); cm->required_args()->show(state, level);
indent_attribute(level, "scope"); cm->scope()->show(state, level);
indent_attribute(level, "splat"); cm->splat()->show(state, level);
indent_attribute(level, "stack_size"); cm->stack_size()->show(state, level);
indent_attribute(level, "total_args"); cm->total_args()->show(state, level);
close_body(level);
}