summaryrefslogtreecommitdiff
path: root/struct.c
Commit message (Collapse)AuthorAgeFilesLines
* fix Data docs (#6497)Yuri Smirnov2022-10-061-3/+3
|
* Cannot `define` from defined `Data` class againNobuyoshi Nakada2022-10-031-4/+6
|
* Use the dedicated function to check arityNobuyoshi Nakada2022-10-011-2/+2
|
* Fix an out of bound accessNobuyoshi Nakada2022-10-011-0/+6
|
* Do not define the method only for RDocNobuyoshi Nakada2022-10-011-0/+2
| | | | `Data.members` fails an assertion.
* Add Data class implementation: Simple immutable value objectVictor Shepelev2022-09-301-4/+525
|
* [DOC] Update `Struct#new` behavior with `keyword_init: true`Nobuyoshi Nakada2022-09-091-3/+4
|
* Rename rb_ary_tmp_new to rb_ary_hidden_newPeter Zhu2022-07-261-2/+2
| | | | | | rb_ary_tmp_new suggests that the array is temporary in some way, but that's not true, it just creates an array that's hidden and not on the transient heap. This commit renames it to rb_ary_hidden_new.
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-179/+179
| | | | [Misc #18891]
* Don't attempt to read ivars on T_ICLASS in struct (#5664)John Hawthorn2022-05-261-7/+8
|
* [ci skip] Fix docsPeter Zhu2022-04-131-6/+6
|
* Repaired What's Here sections for Range, String, Symbol, Struct (#5735)Burdette Lamar2022-03-301-22/+22
| | | Repaired What's Here sections for Range, String, Symbol, Struct.
* A positional Hash is not keyword arguments [Bug #18632]Nobuyoshi Nakada2022-03-171-4/+4
|
* [DOC] Simplify operator method referencesNobuyoshi Nakada2022-02-121-2/+2
|
* [DOC] Use RDoc link style for links in the same class/modulePeter Zhu2022-02-071-7/+7
| | | | | | | | | | I used this regex: (?<=\[)#(?:class|module)-([A-Za-z]+)-label-([A-Za-z0-9\-\+]+) And performed a global find & replace for this: rdoc-ref:$1@$2
* [DOC] Use RDoc link style for links to other classes/modulesPeter Zhu2022-02-071-2/+2
| | | | | | | | | | I used this regex: ([A-Za-z]+)\.html#(?:class|module)-[A-Za-z]+-label-([A-Za-z0-9\-\+]+) And performed a global find & replace for this: rdoc-ref:$1@$2
* Improve links to labels in string.c and struct.c (#5531)Burdette Lamar2022-02-061-4/+4
|
* Initialize Struct by calling with keyword argumentsNobuyoshi Nakada2021-12-261-7/+16
|
* Fix typos [ci skip]Kazuhiro NISHIYAMA2021-12-251-1/+1
|
* Fix StructClass:: class method docszverok2021-12-241-3/+25
|
* `struct_pos_num` is no longer usedNobuyoshi Nakada2021-11-201-8/+0
|
* optimize `Struct` getter/setterKoichi Sasada2021-11-191-65/+5
| | | | | Introduce new optimized method type `OPTIMIZED_METHOD_TYPE_STRUCT_AREF/ASET` with index information.
* [DOC] Fix code markup [ci skip]Nobuyoshi Nakada2021-10-251-1/+1
| | | | Code markup in RDoc must not be concatenated with anothr word.
* Using NIL_P macro instead of `== Qnil`S.H2021-10-031-2/+2
|
* Enhanced RDoc for Struct (#4895)Burdette Lamar2021-09-271-18/+111
| | | | | | Revises introductory material. Adds section "What's Here". Adds previously missing documentation for method #deconstruct_keys.
* Enhanced RDoc for Struct (#4891)Burdette Lamar2021-09-241-46/+109
| | | | | | | | | | | | Treats: #values_at #select #== #hash #eql? #size #dig
* Enhanced RDoc for Struct (#4890)Burdette Lamar2021-09-241-63/+107
| | | | | | | | | | | | Treated: #each #each_pair #inspect #to_a #to_h #[] #[]=
* Enhance RDoc for Struct (#4885)Burdette Lamar2021-09-231-62/+108
| | | Treats #members and ::new.
* [DOC] Fix broken links [ci skip]Nobuyoshi Nakada2021-09-151-1/+1
| | | | | | * As the "doc/" prefix is specified by the `--page-dir` option, remove from the rdoc references. * Refer to the original .rdoc instead of the converted .html.
* Using SYMBOL_P macroS-H-GAMELINKS2021-09-111-1/+1
|
* Make Struct#keyword_init? return nil by default [Feature #18008]Nobuyoshi Nakada2021-07-151-10/+5
|
* Regularize keyword_init values not to hold the argument objectNobuyoshi Nakada2021-07-151-0/+3
|
* struct.c: Add keyword_init? singleton method for StructClass (#4609)hkdnet2021-07-151-0/+25
| | | Fixes [Feature #18008]
* Warn Struct#initialize with only keyword args (#4070)Takashi Kokubun2021-01-171-7/+15
| | | | | | | | | | | | | | | * Warn Struct#initialize with only keyword args A part of [Feature #16806] * Do not warn if `keyword_init: false` is explicitly specified * Add a NEWS entry * s/in/from/ * Make sure all fields are initialized
* RHASH_TBL: is now ext-only卜部昌平2020-08-191-2/+4
| | | | | It seems almost no internal codes use RHASH_TBL any longer. Why not just eliminate it entirely, so that the macro can be purely ext-only.
* Fix links to Dig Methods document (#3421)Burdette Lamar2020-08-141-1/+1
| | | | | * Fix links to Dig Methods document * Fix links to Dig Methods document
* Adding doc/dig_methods.rdoc and links to it (#3416)Burdette Lamar2020-08-131-8/+11
| | | | | | | Adds a full discussion of #dig, along with links from Array, Hash, Struct, and OpenStruct. CSV::Table and CSV::Row are over in ruby/csv. I'll get to them soon. The art to the thing is to figure out how much (or how little) to say at each #dig.
* precalc invokebuiltin destinations卜部昌平2020-07-131-2/+2
| | | | | | Noticed that struct rb_builtin_function is a purely compile-time constant. MJIT can eliminate some runtime calculations by statically generate dedicated C code generator for each builtin functions.
* Inline builtin struct arefTakashi Kokubun2020-07-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | We don't do this for aset because it might raise a FrozenError. ``` $ benchmark-driver -v --rbenv 'before;after;before --jit;after --jit' benchmark/mjit_struct_aref.yml --repeat-count=4 before: ruby 2.8.0dev (2020-07-06T01:47:11Z master d94ef7c6b6) [x86_64-linux] after: ruby 2.8.0dev (2020-07-06T07:11:51Z master 85425168f4) [x86_64-linux] last_commit=Inline builtin struct aref before --jit: ruby 2.8.0dev (2020-07-06T01:47:11Z master d94ef7c6b6) +JIT [x86_64-linux] after --jit: ruby 2.8.0dev (2020-07-06T07:11:51Z master 85425168f4) +JIT [x86_64-linux] last_commit=Inline builtin struct aref Calculating ------------------------------------- before after before --jit after --jit mjit_struct_aref(struct) 34.783M 34.810M 48.321M 58.378M i/s - 40.000M times in 1.149996s 1.149097s 0.827794s 0.685192s Comparison: mjit_struct_aref(struct) after --jit: 58377836.7 i/s before --jit: 48321205.7 i/s - 1.21x slower after: 34809935.5 i/s - 1.68x slower before: 34782736.5 i/s - 1.68x slower ```
* Replaced accessors of `Struct` with `invokebuiltin`Nobuyoshi Nakada2020-06-171-7/+36
|
* Revert "Replaced accessors of `Struct` with `invokebuiltin`"Nobuyoshi Nakada2020-06-161-36/+7
| | | | | This reverts commit 19cabe8b09d92d033c244f32ff622b8e513375f1, which didn't support tool/lib/iseq_loader_checker.rb.
* Replaced accessors of `Struct` with `invokebuiltin`Nobuyoshi Nakada2020-06-161-7/+36
|
* Added GC guard for splatted arrayNobuyoshi Nakada2020-05-081-1/+3
|
* Classes made from Struct should have default `new` singleton method.Marc-Andre Lafortune2020-05-081-15/+6
| | | | | | | | | | | | | | | [Bug #16465] [Bug #16801] [Fix GH-2795] [Fix GH-2944] [Fix GH-3045] [Fix GH-3093] Note: Backporting shouldn't modify object.h and instead can use struct_new_kw which is basically a duplicate implementation of rb_class_new_instance_pass_kw Co-authored-by: Yusuke Endoh <mame@ruby-lang.org> Co-authored-by: John Hawthorn <john@hawthorn.email> Co-authored-by: Adam Hess <HParker@github.com> Co-authored-by: Jose Cortinas <jacortinas@gmail.com> Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
* hash.c: Do not use the fast path (rb_yield_values) for lambda blocksYusuke Endoh2020-03-161-1/+1
| | | | | | | | | | | | | | | | | As a semantics, Hash#each yields a 2-element array (pairs of keys and values). So, `{ a: 1 }.each(&->(k, v) { })` should raise an exception due to lambda's arity check. However, the optimization that avoids Array allocation by using rb_yield_values for blocks whose arity is more than 1 (introduced at b9d29603375d17c3d1d609d9662f50beaec61fa1 and some commits), seemed to overlook the lambda case, and wrongly allowed the code above to work. This change experimentally attempts to make it strict; now the code above raises an ArgumentError. This is an incompatible change; if the compatibility issue is bigger than our expectation, it may be reverted (until Ruby 3.0 release). [Bug #12706]
* decouple internal.h headers卜部昌平2019-12-261-2/+9
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* Avoid needless object allocationKazuki Tsujimoto2019-11-191-1/+4
|
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-2/+0
| | | | | | This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby.
* Define Struct#deconstruct_keysKazuki Tsujimoto2019-11-081-0/+28
|
* Allow only one argument for keyword_init structAlan Wu2019-10-311-1/+1
| | | | | | | | | | | | | | | ``` irb(main):001:0> RUBY_VERSION => "2.6.5" irb(main):002:0> S = Struct.new(:foo, keyword_init: true) => S(keyword_init: true) irb(main):003:0> S.new({foo: 23424}, 234) # I don't think this is intentional => #<struct S foo=23424> irb(main):004:0> ``` Tightening this up should inform users when they are confused about whether a struct is `keyword_init`.