summaryrefslogtreecommitdiffhomepage
path: root/src/variable.c
AgeCommit message (Collapse)Author
2019-11-16Revert "Implement Ruby2.7's frozen strings from `Symbol#to_s`"KOBAYASHI Shuji
This feature was reverted from Ruby 2.7.
2019-10-20Use `mrb_str_cat_str` instead of `mrb_str_concat` if possibleKOBAYASHI Shuji
2019-10-16Use `mrb_sym_name_len` instead of `mrb_sym_name` in `assign_class_name`KOBAYASHI Shuji
2019-10-08Implement Ruby2.7's frozen strings from `Module#name`KOBAYASHI Shuji
2019-09-26Use type predicate macros instead of `mrb_type` if possibleKOBAYASHI Shuji
For efficiency with `MRB_WORD_BOXING` (implement type predicate macros for all `enum mrb_vtype`).
2019-09-25Rename symbol-to-string functions; close #4684Yukihiro "Matz" Matsumoto
* mrb_sym2name -> mrb_sym_name * mrb_sym2name_len -> mrb_sym_name_len * mrb_sym2str -> mrb_sym_str
2019-09-20Fix compatibility issue of class variables.Yukihiro "Matz" Matsumoto
Singleton class definition do not introduce its own class variable scope in CRuby/JRuby. So should mruby. ``` module Mod1 class << Object.new C = 1 @@cv = 1 p Module.nesting, # => [#<Class:#<Object:0x55cb16e60a50>>, Mod1] constants, # => [:C] class_variables, # => [] Mod1.class_variables # => [:@@cv] end end ```
2019-09-20Add optional argument to `Module#class_variables`.Yukihiro "Matz" Matsumoto
2019-09-09Fix `mod.constants` not to have duplicate constant names; #4698Yukihiro "Matz" Matsumoto
The fix was based on PR from @dearblue
2019-08-11Revert "Should have cleared `mrb->globals` in `mrb_gc_free_gv`; fix #4618"Yukihiro "Matz" Matsumoto
This reverts commit 3dc8d9d7b3d0be2f91fa050a13e3b422500df628.
2019-08-06Should have cleared `mrb->globals` in `mrb_gc_free_gv`; fix #4618Yukihiro "Matz" Matsumoto
2019-08-05Use new specifiers/modifiers of `mrb_vfromat()`KOBAYASHI Shuji
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in my environment than before the introduction of new specifiers/modifiers (5116789a) with this change. ------------+-------------------+-------------------+-------- BINARY | BEFORE (5116789a) | AFTER (This PR) | RATIO ------------+-------------------+-------------------+-------- mruby | 593416 bytes | 593208 bytes | -0.04% libmruby.a | 769048 bytes | 767264 bytes | -0.23% ------------+-------------------+-------------------+-------- BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613, so I put it back.
2019-06-25Fixed `mrb_iv_remove` with immediate objects; fix #4519Yukihiro "Matz" Matsumoto
The #4520 tried to address the issue, but it changes the type of `mrb_check_frozen` argument; close #4520
2019-06-16Fix cvar, ivar, const and method can be removed to frozen objectKOBAYASHI Shuji
2019-06-10`Kernel#global_variables` should not include undefined `$1`-`$9`KOBAYASHI Shuji
- They are not include in Ruby. - Appear in duplicate when `$1`-`$9` are defined.
2019-05-15Merge pull request #4400 from ↵Yukihiro "Matz" Matsumoto
shuujii/fix-name-assignment-to-frozen-anonymous-class-module Fix name assignment to frozen anonymous class/module
2019-04-24Fix modiying class variable to frozen class/moduleKOBAYASHI Shuji
2019-04-23Fix name assignment to frozen anonymous class/moduleKOBAYASHI Shuji
Fix the following issues: A = Class.new.freeze #=> FrozenError Module.new::B = Class.new.freeze #=> FrozenError String::B = Module.new.freeze #=> FrozenError
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`.