mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge remote-tracking branch 'upstream/master' into mrbgems
This commit is contained in:
+4
-3
@@ -587,8 +587,7 @@ mrb_value
|
||||
mrb_ary_splice(mrb_state *mrb, mrb_value ary, mrb_int head, mrb_int len, mrb_value rpl)
|
||||
{
|
||||
struct RArray *a = mrb_ary_ptr(ary);
|
||||
mrb_int tail;
|
||||
int size;
|
||||
int tail, size;
|
||||
mrb_value *argv;
|
||||
int i, argc;
|
||||
|
||||
@@ -600,6 +599,9 @@ mrb_ary_splice(mrb_state *mrb, mrb_value ary, mrb_int head, mrb_int len, mrb_val
|
||||
mrb_raise(mrb, E_INDEX_ERROR, "index is out of array");
|
||||
}
|
||||
}
|
||||
if (a->len < len || a->len < head + len) {
|
||||
len = a->len - head;
|
||||
}
|
||||
tail = head + len;
|
||||
|
||||
/* size check */
|
||||
@@ -614,7 +616,6 @@ mrb_ary_splice(mrb_state *mrb, mrb_value ary, mrb_int head, mrb_int len, mrb_val
|
||||
size = head + argc;
|
||||
|
||||
if (tail < a->len) size += a->len - tail;
|
||||
|
||||
if (size > a->aux.capa)
|
||||
ary_expand_capa(mrb, a, size);
|
||||
|
||||
|
||||
+1
-2
@@ -4850,7 +4850,6 @@ load_exec(mrb_state *mrb, parser_state *p, mrbc_context *c)
|
||||
mrb_value v;
|
||||
|
||||
if (!p) {
|
||||
mrb_parser_free(p);
|
||||
return mrb_undef_value();
|
||||
}
|
||||
if (!p->tree || p->nerr) {
|
||||
@@ -4867,7 +4866,7 @@ load_exec(mrb_state *mrb, parser_state *p, mrbc_context *c)
|
||||
static const char msg[] = "syntax error";
|
||||
mrb->exc = (struct RObject*)mrb_object(mrb_exc_new(mrb, E_SYNTAX_ERROR, msg, sizeof(msg) - 1));
|
||||
mrb_parser_free(p);
|
||||
return mrb_nil_value();
|
||||
return mrb_undef_value();
|
||||
}
|
||||
}
|
||||
n = mrb_generate_code(mrb, p);
|
||||
|
||||
Reference in New Issue
Block a user