I’d like to read the logic code of =, but can’t find it.
UPDATE:
I found the test_multi method text/ruby/test_assignment.rb. It’s Ruby code, but seems will let me to the destination.
The reason I want to check the code is find how it handles multi-assignment. Like a,b,c = [1,2,3].
UPDATE:
I found keywords “MASGN” and led me to
compile_massign(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int poped) in compile.c
http://github.com/ruby/ruby/commit/e39eb9dab50eaa681467e51145b37cdc11667830#diff-2
I don’t know what you mean by "the C source code of Ruby". Ruby is a programming language. Programming languages don’t have source code (only compilers and interpreters do), they have specifications.
The specification of multiple assignment is in section 11.3.1.3 Multiple Assignments on pages 59–62 of the current (2009-12-01) ISO Ruby Draft Specification and in
language/variables_spec.rb(search for "multiple", unfortunately the tests are a bit scattered around the file) in the executable RubySpec.A nice overview of a possible implementation can be found in the Rubinius compiler (sorry, no C source code here, either) in lines 482–607 of
lib/compiler/ast/variables.rb.