mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
make it compile
This commit is contained in:
parent
0ac1f7c6bb
commit
22519a4605
2 changed files with 21 additions and 8 deletions
|
@ -45,12 +45,15 @@ template<class DEST, class RET> class RubyValueSource {
|
|||
case T_FALSE:
|
||||
return dest.pushBool(false);
|
||||
case T_DATA:
|
||||
VALUE clsProc = rb_eval("::Proc");
|
||||
VALUE clsMethod = rb_eval("::Method");
|
||||
VALUE smartMatch = rb_intern("===");
|
||||
if (RTEST(rb_funcall(clsProc, smartMatch, value)) || RTEST(rbfuncall(clsMethod, smartMatch, value))) {
|
||||
|
||||
}
|
||||
/*
|
||||
VALUE clsProc = rb_eval_string("::Proc");
|
||||
VALUE clsMethod = rb_eval_string("::Method");
|
||||
VALUE smartMatch = rb_intern("===");
|
||||
if (RTEST(rb_funcall(clsProc, smartMatch, value)) || RTEST(rb_funcall(clsMethod, smartMatch, value))) {
|
||||
|
||||
}
|
||||
*/
|
||||
break;
|
||||
}
|
||||
return dest.pushUndefined();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
using namespace v8;
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
VALUE V8_C_Object;
|
||||
|
||||
VALUE v8_Object_New(VALUE clazz) {
|
||||
|
@ -21,9 +23,17 @@ VALUE v8_Object_Get(VALUE self, VALUE key) {
|
|||
|
||||
VALUE v8_Object_Set(VALUE self, VALUE key, VALUE value) {
|
||||
HandleScope handles;
|
||||
convert_rb_to_v8_t rb2v8;
|
||||
Local<Object> obj = V8_Ref_Get<Object>(self);
|
||||
VALUE keystr = rb_funcall(key, rb_intern("to_s"), 0);
|
||||
obj->Set(rb2v8(keystr), rb2v8(value));
|
||||
|
||||
VALUE valueClass = rb_class_of(value);
|
||||
if(valueClass == rb_cProc) {
|
||||
printf("** This is a proc! We should do something different.\n");
|
||||
}
|
||||
else if(valueClass == rb_cMethod) {
|
||||
printf("** This is a method! We should do something different.\n");
|
||||
}
|
||||
|
||||
obj->Set(RB2V8(keystr), RB2V8(value));
|
||||
return Qnil;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue