Changeset 331 for EcnlProtoTool/trunk/mruby-1.3.0/src/object.c
- Timestamp:
- Jan 21, 2018, 12:10:09 AM (6 years ago)
- Location:
- EcnlProtoTool/trunk/mruby-1.3.0
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/mruby-1.3.0/src/object.c
r321 r331 5 5 */ 6 6 7 #include "mruby.h" 8 #include "mruby/class.h" 9 #include "mruby/numeric.h" 10 #include "mruby/string.h" 7 #include <mruby.h> 8 #include <mruby/class.h> 9 #include <mruby/numeric.h> 10 #include <mruby/string.h> 11 #include <mruby/class.h> 11 12 12 13 MRB_API mrb_bool … … 266 267 267 268 mrb->nil_class = n = mrb_define_class(mrb, "NilClass", mrb->object_class); 269 MRB_SET_INSTANCE_TT(n, MRB_TT_TRUE); 268 270 mrb_undef_class_method(mrb, n, "new"); 269 271 mrb_define_method(mrb, n, "&", false_and, MRB_ARGS_REQ(1)); /* 15.2.4.3.1 */ … … 275 277 276 278 mrb->true_class = t = mrb_define_class(mrb, "TrueClass", mrb->object_class); 279 MRB_SET_INSTANCE_TT(t, MRB_TT_TRUE); 277 280 mrb_undef_class_method(mrb, t, "new"); 278 281 mrb_define_method(mrb, t, "&", true_and, MRB_ARGS_REQ(1)); /* 15.2.5.3.1 */ … … 283 286 284 287 mrb->false_class = f = mrb_define_class(mrb, "FalseClass", mrb->object_class); 288 MRB_SET_INSTANCE_TT(f, MRB_TT_TRUE); 285 289 mrb_undef_class_method(mrb, f, "new"); 286 290 mrb_define_method(mrb, f, "&", false_and, MRB_ARGS_REQ(1)); /* 15.2.6.3.1 */ … … 349 353 mrb_value v; 350 354 351 if (mrb_type(val) == type && type != MRB_TT_DATA ) return val;355 if (mrb_type(val) == type && type != MRB_TT_DATA && type != MRB_TT_ISTRUCT) return val; 352 356 v = convert_type(mrb, val, tname, method, FALSE); 353 357 if (mrb_nil_p(v) || mrb_type(v) != type) return mrb_nil_value(); … … 381 385 /* {MRB_TT_NODE, "Node"}, */ /* internal use: syntax tree node */ 382 386 /* {MRB_TT_UNDEF, "undef"}, */ /* internal use: #undef; should not happen */ 383 {-1, 0}387 {MRB_TT_MAXDEFINE, 0} 384 388 }; 385 389 … … 391 395 392 396 xt = mrb_type(x); 393 if ((xt != t) || (xt == MRB_TT_DATA) ) {397 if ((xt != t) || (xt == MRB_TT_DATA) || (xt == MRB_TT_ISTRUCT)) { 394 398 while (type->type < MRB_TT_MAXDEFINE) { 395 399 if (type->type == t) { … … 441 445 mrb_str_cat_cstr(mrb, str, cname); 442 446 mrb_str_cat_lit(mrb, str, ":"); 443 mrb_str_concat(mrb, str, mrb_ptr_to_str(mrb, mrb_ cptr(obj)));447 mrb_str_concat(mrb, str, mrb_ptr_to_str(mrb, mrb_ptr(obj))); 444 448 mrb_str_cat_lit(mrb, str, ">"); 445 449 … … 482 486 case MRB_TT_CLASS: 483 487 case MRB_TT_ICLASS: 488 case MRB_TT_SCLASS: 484 489 break; 485 490 … … 530 535 case MRB_TT_FLOAT: 531 536 if (base != 0) goto arg_error; 532 if (FIXABLE(mrb_float(val))) { 533 break; 537 else { 538 mrb_float f = mrb_float(val); 539 if (FIXABLE_FLOAT(f)) { 540 break; 541 } 534 542 } 535 543 return mrb_flo_to_fixnum(mrb, val); … … 549 557 tmp = mrb_check_string_type(mrb, val); 550 558 if (!mrb_nil_p(tmp)) { 559 val = tmp; 551 560 goto string_conv; 552 561 }
Note:
See TracChangeset
for help on using the changeset viewer.