Yukihiro "Matz" Matsumoto
9cef265402
should not try to set classpath for frozen classes; ref #3340
2016-12-12 10:34:21 +09:00
Yukihiro "Matz" Matsumoto
1164463a7c
freeze classes/modules; ref #3340
2016-12-12 01:05:07 +09:00
Yukihiro "Matz" Matsumoto
ac561a52f5
Add symbol type check for Module#undef_method
2016-12-04 10:41:01 +09:00
Yukihiro "Matz" Matsumoto
2bb47addad
Prohibit instantiation of immediate objects
2016-11-30 10:36:17 +09:00
Bouke van der Bijl
22f5504054
Fix segfault on remove_method with invalid argument
...
Reported by https://hackerone.com/jpenalbae
2016-11-24 10:13:47 -05:00
Yukihiro "Matz" Matsumoto
8438792d27
renamed "inline" to "istruct" to represent inline struct; ref #3251
2016-11-17 17:19:49 +09:00
Tomasz Dąbrowski
4cca8bac6b
inline structures data type for mruby (MRB_TT_INLINE) ( fix #3237 )
...
Inline structures have no instance variables, no finalizer, and offer as much space as possible in RBASIC object. This means 24 bytes on 64-bit platforms and 12 bytes on 32-bit platforms.
mruby-inline-struct gem is only provided for testing.
2016-11-17 17:19:49 +09:00
Tomasz Dąbrowski
8e0dc6fa8d
Correct argument specifications for few methods:
...
- Struct#values_at
- Module#define_method
- String#chop
- String#chop!
2016-11-16 15:46:28 +01:00
Yukihiro "Matz" Matsumoto
4f6cce059b
class/module statement should re-open; fix #3225
2016-11-15 04:15:24 +09:00
Yukihiro "Matz" Matsumoto
1422e57630
move mrb_str_dup() to mrb_class_path; ref #2470
...
Class#to_s used to return same string repeatedly,
that mean you can modify "class name" by modifying
the return value from Class#to_s.
2016-11-13 16:17:44 +09:00
Yukihiro "Matz" Matsumoto
feb9b3debd
Merge pull request #3224 from ksss/define_method
...
Module#define_method supports proc argument
2016-11-11 22:57:52 +09:00
Felix Jones
e3c8092ccd
Renamed class_under_defined to class_defined_under
2016-11-10 19:51:56 +00:00
Felix Jones
8d6aa06548
Added mrb_class_under_defined
2016-11-06 13:01:21 +00:00
ksss
efe4f30b39
Module#define_method supports proc argument
2016-10-12 22:19:54 +09:00
Yukihiro "Matz" Matsumoto
ff3e4b91f2
Move Module#include and #prepend to class.c; ref #3197
...
To avoid VM nesting with mrb_funcall()
2016-08-20 00:03:30 +09:00
Malizia R
52aba8a706
Avoid Error when Compiling with -std=c99 flag
2016-02-24 16:39:38 -03:00
Kouhei Sutou
c77123d20a
Fix SEGV by stack extension in mrb_get_args()
...
mrb_get_args() keeps pointer of the current stack. But address of the
current stack maybe changed by method call.
'i' format character calls #to_i when the argument isn't integer but
has #to_i.
Here is a code that may call #to_i in mrb_get_args():
case 'i':
// ...
default:
*p = mrb_fixnum(mrb_Integer(mrb, ARGV[arg_i]));
break;
// ...
Here is a code #to_i is called:
class X
def initialize(i)
@i = i
end
def to_i
@i
end
end
[][X.new(0), 0] # X#to_i is called
So, mrb_get_args() shouldn't keep pointer and use it. mrb_get_args()
should always refer mrb->ci->stack to use valid address of the current
stack.
2016-01-22 00:20:00 +09:00
Yukihiro "Matz" Matsumoto
5c405dea3d
include changed from by quotes ("") to by brackets (<>); close #3032
2015-11-27 17:48:23 +09:00
Yukihiro "Matz" Matsumoto
8bad1954a4
mrb_get_args should consume argument even when type specifier with bang get nil; fix #3002
2015-10-28 09:36:48 +09:00
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