[macruby-changes] [1086] MacRuby/branches/experimental
source_changes at macosforge.org
source_changes at macosforge.org
Sun Mar 22 23:47:43 PDT 2009
Revision: 1086
http://trac.macosforge.org/projects/ruby/changeset/1086
Author: lsansonetti at apple.com
Date: 2009-03-22 23:47:43 -0700 (Sun, 22 Mar 2009)
Log Message:
-----------
fixed class/module definition using a given cpath (like class Foo::Bar; end)
Modified Paths:
--------------
MacRuby/branches/experimental/roxor.cpp
MacRuby/branches/experimental/variable.c
Modified: MacRuby/branches/experimental/roxor.cpp
===================================================================
--- MacRuby/branches/experimental/roxor.cpp 2009-03-23 05:36:11 UTC (rev 1085)
+++ MacRuby/branches/experimental/roxor.cpp 2009-03-23 06:47:43 UTC (rev 1086)
@@ -2798,19 +2798,23 @@
NODE *super = node->nd_super;
if (defineClassFunc == NULL) {
- // VALUE rb_vm_define_class(ID path, VALUE outer, VALUE super, unsigned char is_module);
- defineClassFunc = cast<Function>(module->getOrInsertFunction("rb_vm_define_class",
- RubyObjTy, IntTy, RubyObjTy, RubyObjTy, Type::Int8Ty, NULL));
+ // VALUE rb_vm_define_class(ID path, VALUE outer, VALUE super,
+ // unsigned char is_module);
+ defineClassFunc = cast<Function>(module->getOrInsertFunction(
+ "rb_vm_define_class",
+ RubyObjTy, IntTy, RubyObjTy, RubyObjTy,
+ Type::Int8Ty, NULL));
}
std::vector<Value *> params;
params.push_back(ConstantInt::get(IntTy, (long)path));
- params.push_back(compile_current_class());
+ params.push_back(compile_class_path(node->nd_cpath));
params.push_back(super == NULL ? zeroVal : compile_node(super));
- params.push_back(ConstantInt::get(Type::Int8Ty, nd_type(node) == NODE_MODULE ? 1 : 0));
+ params.push_back(ConstantInt::get(Type::Int8Ty,
+ nd_type(node) == NODE_MODULE ? 1 : 0));
- classVal = CallInst::Create(defineClassFunc, params.begin(), params.end(), "", bb);
+ classVal = compile_protected_call(defineClassFunc, params);
}
NODE *body = node->nd_body;
Modified: MacRuby/branches/experimental/variable.c
===================================================================
--- MacRuby/branches/experimental/variable.c 2009-03-23 05:36:11 UTC (rev 1085)
+++ MacRuby/branches/experimental/variable.c 2009-03-23 06:47:43 UTC (rev 1086)
@@ -1,4 +1,3 @@
-/*
* This file is covered by the Ruby license. See COPYING for more details.
*
* Copyright (C) 2007-2008, Apple Inc. All rights reserved.
@@ -225,7 +224,9 @@
{
VALUE path = classname(mod);
- if (!NIL_P(path)) return rb_str_dup(path);
+ if (!NIL_P(path)) {
+ return rb_str_dup(path);
+ }
return path;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090322/2b3c6398/attachment.html>
More information about the macruby-changes
mailing list