summaryrefslogtreecommitdiffhomepage
path: root/src/variable.c
AgeCommit message (Collapse)Author
2019-04-24Fix modiying class variable to frozen class/moduleKOBAYASHI Shuji
2019-04-14Fix wrong size of instance variable if occur out of memorydearblue
2019-04-14Remove pointer check after `mrb_malloc()`dearblue
2019-04-10Merge pull request #4367 from shuujii/extract-frozen-checking-to-functionYukihiro "Matz" Matsumoto
Extract frozen checking to function
2019-04-10Use the old style declaration; ref #4365Yukihiro "Matz" Matsumoto
2019-04-09Extract frozen checking to functionKOBAYASHI Shuji
2019-04-01Fix modifiable class nameKOBAYASHI Shuji
Fix the following example: Object.const_set :A, Module.new{const_set :B, Class.new} ab = A::B.to_s p ab #=> "A::B" # Good ab[0] = "x" p A::B.to_s #=> "x::B" # Bad
2019-03-26Fix missing `MRB_API` prefix for functions below; clse #4267Yukihiro "Matz" Matsumoto
Functions to add prototypes to headers: * mrb_ary_splice() * mrb_notimplement() * mrb_vformat() * mrb_cstr_to_dbl() * mrb_cstr_to_inum() Functions to be made `static` (`MRB_API` was not needed): * mrb_mod_module_function() * mrb_obj_hash() * mrb_str_len_to_inum() Functions to remove `MRB_API` from definitions (referenced from within `libmruby`): * mrb_mod_cv_defined() * mrb_mod_cv_get() * mrb_f_send()
2019-03-17Fix class/instance variable name validationKOBAYASHI Shuji
- `@@?` etc are invalid class variable name. - `@1` etc are invalid instance variable name.
2019-03-14Fix constant name validationKOBAYASHI Shuji
`X!` etc are invalid constant name.
2018-12-11Add `mrb_` prefix to `iv_foreach_func`.Yukihiro "Matz" Matsumoto
2018-12-11Add new API `mrb_iv_foreach()` to iterate over instance variables.Yukihiro "Matz" Matsumoto
2018-12-11Update `iv_foreach()` function.Yukihiro "Matz" Matsumoto
* return `void` instead of `mrb_bool'. * non zero return value from `func` breaks the loop. * no longer remove items on negative return value from `func`.
2018-09-20Renamed `is_namespace()` to `namespace_p()`.Yukihiro "Matz" Matsumoto
2018-09-20Revert "Add MRB_IMPROVE_META_PROGRAMMING configuration"Yukihiro "Matz" Matsumoto
This reverts commit 1997fcf98f596f6af2bf1d20ccde1b1abfe7324d. It became the default behavior.
2018-09-20Merge branch 'assign-anon-class-name' of https://github.com/dearblue/mruby ↵Yukihiro "Matz" Matsumoto
into dearblue-assign-anon-class-name
2018-09-07Fix to not define outer when outer is itself.dearblue
example: a = Class.new a::A = a
2018-09-07Clear terminated spacedearblue
2018-09-07Add MRB_IMPROVE_META_PROGRAMMING configurationdearblue
2018-09-07A class/module name is now defined for meta programingdearblue
2018-09-07Not set a class/module name into anonymous class/moduledearblue
2018-09-04Revert "Remove top-level constant lookup; CRuby2.5"; fix #4070Yukihiro "Matz" Matsumoto
This reverts commit c96def7c96c50f3b8e22e47ce31a6c5a37939dfd. This change was from my misunderstanding.
2018-08-06Rename ambiguous function names.Yukihiro "Matz" Matsumoto
`mrb_iv_p` -> `mrb_iv_name_sym_p` `mrb_iv_check` -> `mrb_iv_name_sym_check`
2018-08-06Remove utility functions: `mrb_vm_iv_{get,set}`.Yukihiro "Matz" Matsumoto
2018-08-06Revert 04dbbff.Yukihiro "Matz" Matsumoto
Use segment list for instance variable again to reduce memory.
2018-01-17Detect cyclic link of class path references; fix #3926Yukihiro "Matz" Matsumoto
2017-12-12Modifying frozen objects will raise `FrozenError`.Yukihiro "Matz" Matsumoto
`FrozenError` is a subclass of `RuntimeError` which used to be raised. [Ruby2.5]
2017-11-30Stop infinite recursion in `Class#to_s`; fix #3861Yukihiro "Matz" Matsumoto
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