[macruby-changes] [1535] MacRuby/branches/experimental
source_changes at macosforge.org
source_changes at macosforge.org
Mon May 4 21:44:48 PDT 2009
Revision: 1535
http://trac.macosforge.org/projects/ruby/changeset/1535
Author: vincent.isambart at gmail.com
Date: 2009-05-04 21:44:48 -0700 (Mon, 04 May 2009)
Log Message:
-----------
added a missing node (yes, there was at least one left) and the test for it
Modified Paths:
--------------
MacRuby/branches/experimental/roxor.cpp
MacRuby/branches/experimental/test_vm/assign.rb
Modified: MacRuby/branches/experimental/roxor.cpp
===================================================================
--- MacRuby/branches/experimental/roxor.cpp 2009-05-05 04:35:36 UTC (rev 1534)
+++ MacRuby/branches/experimental/roxor.cpp 2009-05-05 04:44:48 UTC (rev 1535)
@@ -350,6 +350,7 @@
Value *compile_ivar_read(ID vid);
Value *compile_ivar_assignment(ID vid, Value *val);
Value *compile_cvar_assignment(ID vid, Value *val);
+ Value *compile_gvar_assignment(struct global_entry *entry, Value *val);
Value *compile_multiple_assignment(NODE *node, Value *val);
void compile_multiple_assignment_element(NODE *node, Value *val);
Value *compile_current_class(void);
@@ -1108,6 +1109,10 @@
compile_cvar_assignment(node->nd_vid, val);
break;
+ case NODE_GASGN:
+ compile_gvar_assignment(node->nd_entry, val);
+ break;
+
case NODE_ATTRASGN:
compile_attribute_assign(node, val);
break;
@@ -1388,6 +1393,25 @@
params.end(), "", bb);
}
+Value *
+RoxorCompiler::compile_gvar_assignment(struct global_entry *entry, Value *val)
+{
+ if (gvarSetFunc == NULL) {
+ // VALUE rb_gvar_set(struct global_entry *entry, VALUE val);
+ gvarSetFunc = cast<Function>(module->getOrInsertFunction(
+ "rb_gvar_set",
+ RubyObjTy, PtrTy, RubyObjTy, NULL));
+ }
+
+ std::vector<Value *> params;
+
+ params.push_back(compile_const_pointer(entry));
+ params.push_back(val);
+
+ return CallInst::Create(gvarSetFunc, params.begin(),
+ params.end(), "", bb);
+}
+
inline Value *
RoxorCompiler::compile_current_class(void)
{
@@ -3233,20 +3257,9 @@
assert(node->nd_value != NULL);
assert(node->nd_entry != NULL);
- if (gvarSetFunc == NULL) {
- // VALUE rb_gvar_set(struct global_entry *entry, VALUE val);
- gvarSetFunc = cast<Function>(module->getOrInsertFunction(
- "rb_gvar_set",
- RubyObjTy, PtrTy, RubyObjTy, NULL));
- }
-
- std::vector<Value *> params;
-
- params.push_back(compile_const_pointer(node->nd_entry));
- params.push_back(compile_node(node->nd_value));
-
- return CallInst::Create(gvarSetFunc, params.begin(),
- params.end(), "", bb);
+ return compile_gvar_assignment(
+ node->nd_entry,
+ compile_node(node->nd_value));
}
break;
Modified: MacRuby/branches/experimental/test_vm/assign.rb
===================================================================
--- MacRuby/branches/experimental/test_vm/assign.rb 2009-05-05 04:35:36 UTC (rev 1534)
+++ MacRuby/branches/experimental/test_vm/assign.rb 2009-05-05 04:44:48 UTC (rev 1535)
@@ -92,4 +92,6 @@
class A; def to_ary; [1, 2, 3, 4]; end; end
a, b, *, c = A.new
p [a, b, c]
-}
\ No newline at end of file
+}
+
+assert ':ok', '$a, x = :ok, :ko; p $a'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090504/b625fb35/attachment-0001.html>
More information about the macruby-changes
mailing list