Commit Graph

346 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 2550edd570 remove origin member to implement prepend from struct RClass; ref #2885
instead origin is saved in ICLASS with MRB_FLAG_IS_ORIGIN set.
2015-09-05 02:01:02 +09:00
Yukihiro "Matz" Matsumoto 8bb7962eb8 Merge branch 'module-prepend' of https://github.com/polyfox/mruby into polyfox-module-prepend 2015-09-04 04:01:49 +09:00
Corey Powell ae1ece7228 Make include_module_at static
Since I can't forsee any reason to use it directly inplace of using
prepend/include
2015-07-16 15:25:14 -05:00
cremno 938ed044f4 use mrb_str_cat_str() instead of mrb_str_append()
If the argument is always a string, then mrb_str_cat_str() can be
directly called instead of indirectly by mrb_str_append().

mrb_any_to_s(), mrb_obj_as_string(), mrb_inspect() always return a
string.
2015-07-16 03:56:31 +02:00
Corey Powell dbbf2e2623 Remove non-applicable "hack" comment 2015-07-14 14:12:23 -05:00
Corey Powell eb172c28d7 Applied gc patch to fix ORIGIN ICLASS method table leak
Based on the gc patch by ko1

https://github.com/ruby/ruby/commit/5922c954614e5947a548780bb3b894626affe6dd
2015-07-14 09:44:04 -05:00
Corey Powell f0e920baf0 Renamed parameters in include_module_at 2015-07-14 08:55:53 -05:00
Yukihiro "Matz" Matsumoto 53a81da0fa mrb_get_args: improve function description about ! 2015-07-14 13:35:06 +09:00
Yukihiro "Matz" Matsumoto 4e7050fe0c mrb_get_args: allow d! 2015-07-14 13:34:21 +09:00
Yukihiro "Matz" Matsumoto a075498613 mrb_get_args: allow A,H,s,z,a,d specifiers to take ! to accept nil.
S,A,H gives nil, s,z,a,d gives NULL for nil argument. ref 02474da
2015-07-14 13:22:42 +09:00
Corey Powell 81a2b3431c included_modules, origin fix
Prepended modules would include their origin ICLASS
2015-07-13 09:49:51 -05:00
Corey Powell 199a808e36 Bugfix, included_modules would include classes 2015-07-13 09:49:18 -05:00
Corey Powell 1f678a4ace Removed comment beside method_removed
Not sure if this apart of the ISO standard, so make sure its not misrepresented
2015-07-13 09:40:40 -05:00
Corey Powell 668153092f Added Module#method_removed hook 2015-07-13 09:38:24 -05:00
Corey Powell d4b009b394 Fixed Modules not being fully initialized before #initialize was called 2015-07-13 14:04:42 +02:00
Corey Powell 40f48034d5 Added changed check to the mrb_include_module 2015-07-13 14:04:42 +02:00
Corey Powell ce66727177 Remove some remnant debug code 2015-07-13 14:04:42 +02:00
Corey Powell 005cacf18b Additional patches to make this work 2015-07-13 14:04:42 +02:00
Blaž Hrastnik 97529c2a9a Comment in a refactor to match MRI, but that fails 320 tests. 2015-07-13 14:04:42 +02:00
Blaž Hrastnik 2e617e37e1 origin must be initialized 2015-07-13 14:04:42 +02:00
Blaž Hrastnik ad9f32c5a8 Expose insert position, which should be at origin for include and klass for
prepend.
2015-07-13 14:04:42 +02:00
Blaž Hrastnik f962890a92 Implement Module#prepend. 2015-07-13 14:04:42 +02:00
Yukihiro "Matz" Matsumoto 02474daa14 allow '!' after 'S' specifier of mrb_get_args() that allow nil.
thus "S!" means String|nil type. you have to check nil before
dereferencing the value.  this is added to address #2882 while
keeping code simplicity. besides that current #2882 fix lose
polymorphism provided by mrb_get_args().
2015-07-13 11:14:50 +09:00
Yukihiro "Matz" Matsumoto 9c311ddc93 refactor mrb_bob_missing to share raising NoMethodError code; fix #2878
Note: arguments of mrb_no_method_error() has changed. You need to replace
3rd and 4th argument (say n, argv) to mrb_ary_new_from_values(mrb, n, argv).
2015-07-13 11:07:59 +09:00
Franck Verrot 2588507285 Remove unnecessary backticks.
Dr Markus Kuhn published in 1999 an article [1] explaining in details
why we shouldn't use the ASCII grave accent (0x60) as a left quotation.

Backticks have been used most notably to produce nice-looking LaTeX
documents but it doesn't seem to be an issue on modern platforms and
for the oldest ones, there are workarounds as mentioned by Dr Kuhn.

[1]: https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
2015-06-24 13:07:07 +02:00
Jared Breeden 9781580c71 Fixes #912 2015-06-22 23:19:58 -07:00
cremno 59ea323976 check if outer is a class or module
For modules this check didn't exist yet. Also call #inspect.
2015-05-29 14:58:53 +02:00
cremno 2ee84eb3df remove unnecessary including of <ctype.h>
Not needed anymore since 85075bef75
2015-05-28 10:44:20 +02:00
cremno 2106d4d446 remove mrb_define_method_vm() function
It isn't needed as it's very similar to mrb_define_method_raw() and also
there's only one place where mrb_proc_ptr() actually has to be called.

Inspired by @furunkel's method cache patch (#2764).
2015-05-15 13:04:55 +02:00
sdottaka fe01ce5b02 Fix crash if #inspect does not return a string value
case 1
~~~
class A; def inspect; 1; end; end
A.new.a
~~~

case 2

~~~
class A
  def self.inspect
    1
  end
  alias_method :a, :b
end
~~~
2014-12-12 23:05:22 +09:00
Yukihiro "Matz" Matsumoto 5c6d6309b6 separate mrb_notimplement() and mrb_notimplement_m(); ref #2636 2014-11-19 01:03:19 +09:00
Robert Mosolgo 8dc4d9d973 fix mrb_notimplement typo 2014-11-17 12:13:19 -08:00
ksss 9a06cfa9d8 Implement C API mrb_notimplement 2014-11-17 17:42:20 +09:00
take_cheeze 524c9152d3 Fix mrb_get_args arguments types found by mruby-clang-plugin. 2014-09-21 22:43:13 +09:00
Yukihiro "Matz" Matsumoto 5f7b0580b7 code reduce by using mrb_get_args("n") 2014-09-19 03:03:53 +09:00
Yukihiro "Matz" Matsumoto 147fbf1c12 Module#const_defined? to take second optional argument as CRuby; fix #2593 2014-09-19 03:02:07 +09:00
Yukihiro "Matz" Matsumoto 95c7f570e1 change class argument of mrb_const_defined_at from struct RClass* to mrb_value to make it consistent with mrb_const_defined; ref #2593 2014-09-19 02:51:52 +09:00
Yukihiro "Matz" Matsumoto 1fdf47d71a Merge pull request #2582 from iij/pr-attr-accessor-save-arena
save and restore arena index to prevent arena overflow.
2014-09-03 11:02:52 +09:00
Tomoyuki Sahara 2fd49b2b9f save and restore arena index to prevent arena overflow. 2014-09-03 10:44:38 +09:00
Tatsuhiko Kubo b9acd20aef Use mrb_str_cat_lit() instead of mrb_str_cat_cstr() for string-literals. 2014-09-03 01:43:46 +09:00
Yukihiro "Matz" Matsumoto 90ba47ccfe implement attr_reader and attr_writer in C; use cfunc closure to speed-up 2014-09-02 16:41:38 +09:00
Tatsuhiko Kubo 5fa30aeaea Fix mismatches for MRB_API declarations. 2014-08-29 01:06:22 +09:00
kkkkkt d94469ac23 changed to call check_cv_name_str in check_cv_name_sym and adjust indent 2014-08-21 13:56:43 +09:00
Tatsuhiko Kubo 2b283393c6 Remove empty lines. 2014-08-20 12:07:36 +09:00
Tatsuhiko Kubo ae306793f2 Use specified macro(NULL) instead of magic-number. 2014-08-20 04:34:03 +09:00
go kikuta 14c36f9f21 use mrb_false_value instead of mrb_bool_value 2014-08-16 02:08:51 +09:00
go kikuta 1c3d05b5b6 refactor class.c methods (fix indent, remove unneed temp value. ) 2014-08-16 02:06:05 +09:00
Yukihiro "Matz" Matsumoto 206f89e209 add MRB_API modifiers to mruby API functions 2014-08-04 00:47:08 +09:00
dreamedge 0b8a0f4bb4 add Module#module_function 2014-07-18 09:50:54 +09:00
Yukihiro "Matz" Matsumoto 1dc6a8c872 avoid infinite recursion when error was happened in #inspect; fix #2474 2014-07-17 01:42:03 +09:00