Revision: 4408 http://trac.macosforge.org/projects/ruby/changeset/4408 Author: lsansonetti@apple.com Date: 2010-08-05 13:30:53 -0700 (Thu, 05 Aug 2010) Log Message: ----------- fixed a compiler bug where it would assume that the argument of the undef keyword would always be a literal symbol Modified Paths: -------------- MacRuby/trunk/compiler.cpp MacRuby/trunk/vm.cpp Modified: MacRuby/trunk/compiler.cpp =================================================================== --- MacRuby/trunk/compiler.cpp 2010-08-05 08:12:49 UTC (rev 4407) +++ MacRuby/trunk/compiler.cpp 2010-08-05 20:30:53 UTC (rev 4408) @@ -4088,22 +4088,18 @@ case NODE_UNDEF: { if (undefFunc == NULL) { - // VALUE rb_vm_undef(VALUE klass, ID name, + // VALUE rb_vm_undef2(VALUE klass, VALUE sym, // unsigned char dynamic_class); undefFunc = cast<Function>(module->getOrInsertFunction( - "rb_vm_undef", - VoidTy, RubyObjTy, IntTy, Int8Ty, NULL)); + "rb_vm_undef2", + VoidTy, RubyObjTy, RubyObjTy, Int8Ty, NULL)); } assert(node->u2.node != NULL); - VALUE name = node->u2.node->nd_lit; - assert(TYPE(name) == T_SYMBOL); - ID name_id = SYM2ID(name); - Value *args[] = { compile_current_class(), - compile_id(name_id), + compile_node(node->u2.node), ConstantInt::get(Int8Ty, dynamic_class ? 1 : 0) }; compile_protected_call(undefFunc, args, args + 3); Modified: MacRuby/trunk/vm.cpp =================================================================== --- MacRuby/trunk/vm.cpp 2010-08-05 08:12:49 UTC (rev 4407) +++ MacRuby/trunk/vm.cpp 2010-08-05 20:30:53 UTC (rev 4408) @@ -1541,6 +1541,14 @@ } extern "C" +void +rb_vm_undef2(VALUE klass, VALUE sym, unsigned char dynamic_class) +{ + assert(TYPE(sym) == T_SYMBOL); + return rb_vm_undef(klass, SYM2ID(sym), dynamic_class); +} + +extern "C" VALUE rb_vm_defined(VALUE self, int type, VALUE what, VALUE what2) {
participants (1)
-
source_changes@macosforge.org