summaryrefslogtreecommitdiffhomepage
path: root/src/variable.c
AgeCommit message (Collapse)Author
2017-11-17Removed useless conditionUkrainskiy Sergey
2017-11-17Changed the assignment of a variable in variable.cUkrainskiy Sergey
2017-11-17Changed numbers to TRUE and FALSE for mrb_bool in variable.cUkrainskiy Sergey
2017-10-31Fixed constant (and class variable) reference bug; fix #3839Yukihiro "Matz" Matsumoto
Unlike method definition, constant reference should start from `MRB_PROC_TARGET_CLASS(ci->proc)`, not `ci->target_class`. In addition, `MRB_PROC_TARGET_CLASS(ci->proc)` is always set.
2017-10-28Heavily refactored how lexical scope links are implemented; fix #3821Yukihiro "Matz" Matsumoto
Instead of `irep` links, we added a `upper` link to `struct RProc`. To make a space for the `upper` link, we moved `target_class` reference. If a `Proc` does not have `env`, `target_class` is saved in an `union` shared with `env` (if a `Proc` has env, you can tell it by `MRB_PROC_ENV_P()). Otherwise `target_class` is referenced from `env->c`. We removed links in `env` as well. This change removes 2 members from `mrb_irep` struct, thus saving 2 words per method/proc/block. This also fixes potential memory leaks due to the circular references caused by a link from `mrb_irep`.
2017-10-17Remove top-level constant lookup; CRuby2.5Yukihiro "Matz" Matsumoto
2017-09-04Restructure `irep->outer` chain; fix #3804Yukihiro "Matz" Matsumoto
Instead of `irep -> proc` chain, we use `irep -> irep` chain to avoid GC bugs like #3804. We added `target_class` reference to `mrb_irep` struct. That means one more word consumption per `irep`.
2017-08-26Remove unused `mrb_obj_iv_ifnone()` from API.Yukihiro "Matz" Matsumoto
2017-08-26Add checks if `iv_tbl` is NULL.Yukihiro "Matz" Matsumoto
2017-08-26Use `khash` for instance variables tables instead of segment list.Yukihiro "Matz" Matsumoto
For performance reason. Segmented list consumes slightly less memory but takes a lot of time especially when there are many slots in the segment lists (e.g. class constants).
2017-08-19Type check before traversing `irep->outer`; fix #3782Yukihiro "Matz" Matsumoto
2017-08-18`capacify' for `mrb_str_new_capa` should not be `0`.Yukihiro "Matz" Matsumoto
2017-08-18Separate `mrb_str_buf_new` and `mrb_str_new_capa`.Yukihiro "Matz" Matsumoto
`mrb_str_buf_new` is an old function that ensures capacity size of `MRB_STR_BUF_MIN_SIZE` minimum. Usually one need to use `mrb_str_new_capa` instead.
2017-08-01Better class name management.Yukihiro "Matz" Matsumoto
The change removes several internal instance variables used by class name management. The variables `__classid__` and `__classpath__` are no longer available. `__outer__` is used only for unnamed outer classes/modules (and will be removed after they are named). [Important note] Along with this change we removed several public functions. - mrb_class_outer_module() - mrb_class_sym() We believe no one have used those functions, but if you do, please ask us for the workaround.
2017-08-01Move naming unnamed classes/modulesYukihiro "Matz" Matsumoto
From `mrb_mod_const_set` to `mrb_const_set`.
2017-08-01Reimplement constant look-up rule to follow lexical scoping.Yukihiro "Matz" Matsumoto
This update fix CRuby scoping incompatibility; close #600; close #3200
2017-07-27Rename `MRB_SEGMENT_SIZE` to `MRB_IV_SEGMENT_SIZE`.Yukihiro "Matz" Matsumoto
2017-07-27Always use `MRB_USE_IV_SEGLIST`.Yukihiro "Matz" Matsumoto
2017-04-12Use while statement instead of for statementKouichi Nakanishi
2017-04-12Find Class/Module in nested singleton class; fix #3598Kouichi Nakanishi
2017-04-10An object attached to a singleton class may not be a class; fix #3587Yukihiro "Matz" Matsumoto
The fix for #3539 was incomplete.
2017-03-31Modify to get constant of parent module in singleton class; fix #3568Kouichi Nakanishi
2017-03-30small cosmetic change; ref #3570Yukihiro "Matz" Matsumoto
2017-03-30Modify class variable definition in singleton class; fix #3539Kouichi Nakanishi
2017-03-18Small cosmetic change ("* " -> "*").Yukihiro "Matz" Matsumoto
2016-12-12freeze instance variables; ref #3340Yukihiro "Matz" Matsumoto
2016-11-24Add pointer casting from mrb_malloc(); ref #3267Yukihiro "Matz" Matsumoto
2016-11-08class variables in higher order have a priority; fix #3235Yukihiro "Matz" Matsumoto
2016-01-11Fix class variable reference in moduleKouhei Sutou
Fix #3079
2015-11-27include changed from by quotes ("") to by brackets (<>); close #3032Yukihiro "Matz" Matsumoto
2015-11-07PR #2521 did not work for singleton classes for non-class objects; fix #3003Yukihiro "Matz" Matsumoto
2015-07-16use mrb_str_cat_str() instead of mrb_str_append()cremno
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-06-24Remove unnecessary backticks.Franck Verrot
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-05-28remove unnecessary including of <ctype.h>cremno
Not needed anymore since 85075bef7583edd0a48cfbdfaa632cbdacf78f2c
2014-09-19change class argument of mrb_const_defined_at from `struct RClass*` to ↵Yukihiro "Matz" Matsumoto
`mrb_value` to make it consistent with mrb_const_defined; ref #2593
2014-09-19const_defined? to check superclasses; ref #2593Yukihiro "Matz" Matsumoto
2014-09-04instance variable name validation based on <ctype.h>; fix #2584Yukihiro "Matz" Matsumoto
2014-09-02refactor valid instance variable name checkYukihiro "Matz" Matsumoto
2014-08-29Fix mismatches for MRB_API declarations.Tatsuhiko Kubo
2014-08-13add write barrier when iv is copiedYukihiro "Matz" Matsumoto
2014-08-04add MRB_API modifiers to mruby API functionsYukihiro "Matz" Matsumoto
2014-08-02Use Boolean macro in variable.cJun Hiroe
2014-07-21Use MRB_TT_EXCEPTION in exception object.take_cheeze
2014-07-14Use `mrb_bool` as return type of `mrb_const_defined_at`.take_cheeze
2014-06-16[minor-fix]Minor cleanups on variable.c commentskatmutua
2014-05-18Add a space aftre bracket.yui-knk
2014-05-04Fix typo.yui-knk
2014-04-26Class.constants to take optional argument; close #2133Yukihiro "Matz" Matsumoto
2014-04-14reduce RSTRING_PTR usagecremno
2014-04-10revert b45e99 since a bug in khash.h was fixedYukihiro "Matz" Matsumoto