mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge branch 'master' of github.com:mruby/mruby
This commit is contained in:
@@ -156,7 +156,7 @@ the following options additionally inside of your GEM specification:
|
||||
mruby can be extended with C. This is possible by using the C API to
|
||||
integrate C libraries into mruby.
|
||||
|
||||
### Pre-Conditions
|
||||
### Preconditions
|
||||
|
||||
mrbgems expects that you have implemented a C method called
|
||||
`mrb_YOURGEMNAME_gem_init(mrb_state)`. `YOURGEMNAME` will be replaced
|
||||
|
||||
@@ -59,7 +59,7 @@ nil_to_i(mrb_state *mrb, mrb_value obj)
|
||||
* k.instance_exec(5) {|x| @secret+x } #=> 104
|
||||
*/
|
||||
|
||||
mrb_value
|
||||
mrb_value
|
||||
mrb_yield_internal(mrb_state *mrb, mrb_value b, int argc, mrb_value *argv, mrb_value self, struct RClass *c);
|
||||
|
||||
static mrb_value
|
||||
@@ -69,7 +69,7 @@ mrb_obj_instance_exec(mrb_state *mrb, mrb_value self)
|
||||
int argc;
|
||||
mrb_value blk;
|
||||
struct RClass *c;
|
||||
|
||||
|
||||
mrb_get_args(mrb, "*&", &argv, &argc, &blk);
|
||||
|
||||
if (mrb_nil_p(blk)) {
|
||||
@@ -80,7 +80,7 @@ mrb_obj_instance_exec(mrb_state *mrb, mrb_value self)
|
||||
case MRB_TT_SYMBOL:
|
||||
case MRB_TT_FIXNUM:
|
||||
case MRB_TT_FLOAT:
|
||||
c = 0;
|
||||
c = NULL;
|
||||
break;
|
||||
default:
|
||||
c = mrb_class_ptr(mrb_singleton_class(mrb, self));
|
||||
|
||||
@@ -1551,7 +1551,6 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
// variable rhs
|
||||
codegen(s, t, VAL);
|
||||
gen_vmassignment(s, tree->car, rhs, val);
|
||||
if (!val) pop();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -65,3 +65,12 @@ assert('Abbreviated variable assignment as returns') do
|
||||
end
|
||||
assert_equal Syntax4AbbrVarAsgnAsReturns::A.new.b, 1
|
||||
end
|
||||
|
||||
assert('Splat and mass assignment') do
|
||||
*a = *[1,2,3]
|
||||
b, *c = *[7,8,9]
|
||||
|
||||
assert_equal [1,2,3], a
|
||||
assert_equal 7, b
|
||||
assert_equal [8,9], c
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user