ruby-internal 0.7.3 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/ruby-internal-node-dump +1 -1
- data/bin/ruby-internal-obfuscate +1 -1
- data/ext/cached/ruby-1.8.4/internal/method/{method.h → internal_method.h} +12 -0
- data/ext/cached/ruby-1.8.4/internal/module/getcfp.h +13 -0
- data/ext/cached/ruby-1.8.4/internal/node/global_entry.h +94 -0
- data/ext/cached/ruby-1.8.4/internal/node/node_type_descrip.c +41 -41
- data/ext/cached/ruby-1.8.4/internal/node/nodeinfo.c +288 -273
- data/ext/cached/ruby-1.8.4/internal/vm/instruction/insns_info.c +3 -0
- data/ext/cached/ruby-1.8.4/internal/vm/iseq/iseq_load.inc +21 -2
- data/ext/cached/{ruby-1.8.3/internal/method/method.h → ruby-1.8.5/internal/method/internal_method.h} +12 -0
- data/ext/cached/ruby-1.8.5/internal/module/getcfp.h +13 -0
- data/ext/cached/ruby-1.8.5/internal/node/global_entry.h +94 -0
- data/ext/cached/ruby-1.8.5/internal/node/node_type_descrip.c +45 -45
- data/ext/cached/ruby-1.8.5/internal/node/nodeinfo.c +310 -295
- data/ext/cached/ruby-1.8.5/internal/vm/instruction/insns_info.c +3 -0
- data/ext/cached/ruby-1.8.5/internal/vm/iseq/iseq_load.inc +21 -2
- data/ext/cached/{ruby-1.8.5/internal/method/method.h → ruby-1.8.6/internal/method/internal_method.h} +12 -0
- data/ext/cached/ruby-1.8.6/internal/module/getcfp.h +13 -0
- data/ext/cached/ruby-1.8.6/internal/node/global_entry.h +94 -0
- data/ext/cached/ruby-1.8.6/internal/node/node_type_descrip.c +48 -48
- data/ext/cached/ruby-1.8.6/internal/node/nodeinfo.c +323 -308
- data/ext/cached/ruby-1.8.6/internal/vm/instruction/insns_info.c +3 -0
- data/ext/cached/ruby-1.8.6/internal/vm/iseq/iseq_load.inc +21 -2
- data/ext/cached/{ruby-1.8.6/internal/method/method.h → ruby-1.8.7/internal/method/internal_method.h} +12 -0
- data/ext/cached/ruby-1.8.7/internal/module/getcfp.h +13 -0
- data/ext/cached/ruby-1.8.7/internal/node/global_entry.h +98 -0
- data/ext/cached/ruby-1.8.7/internal/node/node_type_descrip.c +42 -42
- data/ext/cached/ruby-1.8.7/internal/node/nodeinfo.c +276 -261
- data/ext/cached/ruby-1.8.7/internal/vm/instruction/insns_info.c +3 -0
- data/ext/cached/ruby-1.8.7/internal/vm/iseq/iseq_load.inc +21 -2
- data/ext/cached/{ruby-1.9.0/internal/method/method.h → ruby-1.9.1/internal/method/internal_method.h} +12 -0
- data/ext/cached/ruby-1.9.1/internal/module/classpath.c +12 -14
- data/ext/cached/ruby-1.9.1/internal/module/getcfp.h +25 -0
- data/ext/cached/ruby-1.9.1/internal/node/global_entry.h +86 -0
- data/ext/cached/ruby-1.9.1/internal/node/node_type_descrip.c +46 -48
- data/ext/cached/ruby-1.9.1/internal/node/nodeinfo.c +311 -412
- data/ext/cached/ruby-1.9.1/internal/vm/instruction/insns_info.c +3 -0
- data/ext/cached/ruby-1.9.1/internal/vm/iseq/iseq_load.inc +28 -6
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/iseq.h +1 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/parse.h +6 -6
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/revision.h +1 -1
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/version.h +6 -5
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_core.h +3 -2
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_insnhelper.h +1 -0
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/binding/block.h +0 -0
- data/ext/cached/{ruby-1.9.1/internal/method/method.h → ruby-1.9.2/internal/method/internal_method.h} +16 -5
- data/ext/cached/ruby-1.9.2/internal/module/classpath.c +40 -0
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/module/classpath.h +0 -0
- data/ext/cached/ruby-1.9.2/internal/module/getcfp.h +25 -0
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/node/block.h +0 -0
- data/ext/cached/ruby-1.9.2/internal/node/global_entry.h +93 -0
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/node/node_type_descrip.c +44 -48
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/node/nodeinfo.c +291 -439
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/node/nodeinfo.h +0 -0
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/proc/block.h +0 -0
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/tag/tag.h +0 -0
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/vm/instruction/insns_info.c +141 -64
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/vm/instruction/insns_info.h +88 -80
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/vm/iseq/insns_info.inc +77 -70
- data/ext/cached/ruby-1.9.2/internal/vm/iseq/iseq_load.inc +426 -0
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/debug.h +1 -1
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/dln.h +3 -3
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/encdb.h +18 -2
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/eval_intern.h +39 -28
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/gc.h +7 -5
- data/ext/cached/ruby-1.9.2/internal/yarv-headers/id.h +170 -0
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/iseq.h +20 -10
- data/ext/cached/ruby-1.9.2/internal/yarv-headers/method.h +103 -0
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/node.h +14 -47
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/parse.h +31 -148
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/regenc.h +7 -3
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/regint.h +16 -17
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/regparse.h +4 -1
- data/ext/cached/ruby-1.9.2/internal/yarv-headers/revision.h +1 -0
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/thread_pthread.h +4 -1
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/thread_win32.h +1 -1
- data/ext/cached/ruby-1.9.2/internal/yarv-headers/timev.h +21 -0
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/transcode_data.h +20 -10
- data/ext/cached/ruby-1.9.2/internal/yarv-headers/transdb.h +179 -0
- data/ext/cached/ruby-1.9.2/internal/yarv-headers/version.h +55 -0
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/vm_core.h +127 -84
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/vm_exec.h +4 -7
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/vm_insnhelper.h +53 -36
- data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/vm_opts.h +1 -1
- data/ext/cached/ruby-1.9.3/internal/binding/block.h +12 -0
- data/ext/cached/ruby-1.9.3/internal/method/internal_method.h +32 -0
- data/ext/cached/ruby-1.9.3/internal/module/classpath.c +40 -0
- data/ext/cached/{ruby-1.8.0 → ruby-1.9.3}/internal/module/classpath.h +5 -2
- data/ext/cached/ruby-1.9.3/internal/module/getcfp.h +25 -0
- data/ext/cached/ruby-1.9.3/internal/node/block.h +12 -0
- data/ext/cached/ruby-1.9.3/internal/node/global_entry.h +93 -0
- data/ext/cached/{ruby-1.8.3 → ruby-1.9.3}/internal/node/node_type_descrip.c +48 -57
- data/ext/cached/{ruby-1.6.8 → ruby-1.9.3}/internal/node/nodeinfo.c +589 -740
- data/ext/cached/{ruby-1.8.0 → ruby-1.9.3}/internal/node/nodeinfo.h +4 -3
- data/ext/cached/ruby-1.9.3/internal/proc/block.h +12 -0
- data/ext/cached/ruby-1.9.3/internal/tag/tag.h +6 -0
- data/ext/cached/ruby-1.9.3/internal/vm/instruction/insns_info.c +6013 -0
- data/ext/cached/ruby-1.9.3/internal/vm/instruction/insns_info.h +899 -0
- data/ext/cached/ruby-1.9.3/internal/vm/iseq/insns_info.inc +707 -0
- data/ext/cached/ruby-1.9.3/internal/vm/iseq/iseq_load.inc +423 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/addr2line.h +21 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/atomic.h +56 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/constant.h +34 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/debug.h +41 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/dln.h +50 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/encdb.h +167 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/eval_intern.h +234 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/gc.h +98 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/id.h +175 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/internal.h +232 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/iseq.h +125 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/method.h +105 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/node.h +503 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/parse.h +186 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/regenc.h +219 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/regint.h +850 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/regparse.h +362 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/revision.h +1 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/thread_pthread.h +51 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/thread_win32.h +40 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/timev.h +21 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/transcode_data.h +117 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/transdb.h +189 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/version.h +52 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/vm_core.h +756 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/vm_exec.h +184 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/vm_insnhelper.h +220 -0
- data/ext/cached/ruby-1.9.3/internal/yarv-headers/vm_opts.h +51 -0
- data/ext/internal/binding/block.h +20 -0
- data/ext/internal/method/internal_method.h +5 -38
- data/ext/internal/method/internal_method.h.rpp +0 -7
- data/ext/internal/method/method.c +52 -32
- data/ext/internal/module/classpath.c +18 -13
- data/ext/internal/module/classpath.h +3 -3
- data/ext/internal/module/extconf.rb +3 -2
- data/ext/internal/module/getcfp.h +13 -0
- data/ext/internal/module/getcfp.h.rpp +44 -0
- data/ext/internal/module/module.c +58 -21
- data/ext/internal/node/block.h +20 -0
- data/ext/internal/node/extconf.rb +2 -0
- data/ext/internal/node/global_entry.h +69 -13
- data/ext/internal/node/global_entry.h.rpp +11 -2
- data/ext/internal/node/node.c +30 -3
- data/ext/internal/node/node_type_descrip.c +47 -38
- data/ext/internal/node/nodeinfo.c +622 -306
- data/ext/internal/node/nodeinfo.h +1 -4
- data/ext/internal/proc/block.h +20 -0
- data/ext/internal/tag/tag.h +10 -0
- data/ext/internal/thread/thread.c +9 -3
- data/ext/internal/vm/extconf.rb +1 -0
- data/ext/internal/vm/instruction/insns_info.c +3 -5974
- data/ext/internal/vm/instruction/insns_info.h +0 -878
- data/ext/internal/vm/iseq/extconf.rb +1 -0
- data/ext/internal/vm/iseq/iseq.c +38 -4
- data/ext/internal/vm/iseq/iseq_load.inc.rpp +23 -5
- data/ext/internal/vm/vm.c +28 -0
- data/lib/internal/classtree.rb +28 -0
- data/lib/internal/debug.rb +10 -2
- data/lib/internal/method/as_code.rb +25 -0
- data/lib/internal/method/as_expression.rb +2 -3
- data/lib/internal/method/origin.rb +29 -0
- data/lib/internal/method/signature.rb +5 -300
- data/lib/internal/method/signature/argument.rb +102 -0
- data/lib/internal/method/signature/iseq.rb +52 -0
- data/lib/internal/method/signature/node.rb +160 -0
- data/lib/internal/method/signature/signature.rb +23 -0
- data/lib/internal/proc/as_code.rb +2 -0
- data/lib/internal/proc/as_expression.rb +2 -0
- data/lib/internal/vm/bytedecoder.rb +5 -5
- data/lib/internal/vm/iseq/as_code.rb +2 -2
- data/lib/internal/vm/iseq/as_expression.rb +2 -2
- data/test/test_dump_method.rb +1 -1
- data/test/test_method.rb +21 -3
- data/test/test_node.rb +20 -4
- metadata +152 -155
- data/ext/cached/ruby-1.6.8/internal/binding/block.h +0 -35
- data/ext/cached/ruby-1.6.8/internal/method/method.h +0 -19
- data/ext/cached/ruby-1.6.8/internal/module/classpath.c +0 -3
- data/ext/cached/ruby-1.6.8/internal/module/classpath.h +0 -8
- data/ext/cached/ruby-1.6.8/internal/node/block.h +0 -35
- data/ext/cached/ruby-1.6.8/internal/node/global_entry.h +0 -15
- data/ext/cached/ruby-1.6.8/internal/node/node_type_descrip.c +0 -149
- data/ext/cached/ruby-1.6.8/internal/node/nodeinfo.h +0 -69
- data/ext/cached/ruby-1.6.8/internal/proc/block.h +0 -35
- data/ext/cached/ruby-1.6.8/internal/tag/tag.h +0 -15
- data/ext/cached/ruby-1.6.8/internal/vm/instruction/insns_info.c +0 -39
- data/ext/cached/ruby-1.6.8/internal/vm/instruction/insns_info.h +0 -21
- data/ext/cached/ruby-1.6.8/internal/vm/iseq/insns_info.inc +0 -12
- data/ext/cached/ruby-1.6.8/internal/vm/iseq/iseq_load.inc +0 -9
- data/ext/cached/ruby-1.8.0/internal/binding/block.h +0 -37
- data/ext/cached/ruby-1.8.0/internal/method/method.h +0 -19
- data/ext/cached/ruby-1.8.0/internal/module/classpath.c +0 -27
- data/ext/cached/ruby-1.8.0/internal/node/block.h +0 -37
- data/ext/cached/ruby-1.8.0/internal/node/global_entry.h +0 -10
- data/ext/cached/ruby-1.8.0/internal/node/node_type_descrip.c +0 -155
- data/ext/cached/ruby-1.8.0/internal/node/nodeinfo.c +0 -5744
- data/ext/cached/ruby-1.8.0/internal/proc/block.h +0 -37
- data/ext/cached/ruby-1.8.0/internal/tag/tag.h +0 -15
- data/ext/cached/ruby-1.8.0/internal/vm/instruction/insns_info.c +0 -39
- data/ext/cached/ruby-1.8.0/internal/vm/instruction/insns_info.h +0 -21
- data/ext/cached/ruby-1.8.0/internal/vm/iseq/insns_info.inc +0 -12
- data/ext/cached/ruby-1.8.0/internal/vm/iseq/iseq_load.inc +0 -9
- data/ext/cached/ruby-1.8.1/internal/binding/block.h +0 -31
- data/ext/cached/ruby-1.8.1/internal/method/method.h +0 -19
- data/ext/cached/ruby-1.8.1/internal/module/classpath.c +0 -27
- data/ext/cached/ruby-1.8.1/internal/module/classpath.h +0 -14
- data/ext/cached/ruby-1.8.1/internal/node/block.h +0 -31
- data/ext/cached/ruby-1.8.1/internal/node/global_entry.h +0 -10
- data/ext/cached/ruby-1.8.1/internal/node/node_type_descrip.c +0 -154
- data/ext/cached/ruby-1.8.1/internal/node/nodeinfo.c +0 -5736
- data/ext/cached/ruby-1.8.1/internal/node/nodeinfo.h +0 -69
- data/ext/cached/ruby-1.8.1/internal/proc/block.h +0 -31
- data/ext/cached/ruby-1.8.1/internal/tag/tag.h +0 -16
- data/ext/cached/ruby-1.8.1/internal/vm/instruction/insns_info.c +0 -39
- data/ext/cached/ruby-1.8.1/internal/vm/instruction/insns_info.h +0 -21
- data/ext/cached/ruby-1.8.1/internal/vm/iseq/insns_info.inc +0 -12
- data/ext/cached/ruby-1.8.1/internal/vm/iseq/iseq_load.inc +0 -9
- data/ext/cached/ruby-1.8.2/internal/binding/block.h +0 -32
- data/ext/cached/ruby-1.8.2/internal/method/method.h +0 -19
- data/ext/cached/ruby-1.8.2/internal/module/classpath.c +0 -45
- data/ext/cached/ruby-1.8.2/internal/module/classpath.h +0 -17
- data/ext/cached/ruby-1.8.2/internal/node/block.h +0 -32
- data/ext/cached/ruby-1.8.2/internal/node/global_entry.h +0 -10
- data/ext/cached/ruby-1.8.2/internal/node/node_type_descrip.c +0 -154
- data/ext/cached/ruby-1.8.2/internal/node/nodeinfo.c +0 -5736
- data/ext/cached/ruby-1.8.2/internal/node/nodeinfo.h +0 -69
- data/ext/cached/ruby-1.8.2/internal/proc/block.h +0 -32
- data/ext/cached/ruby-1.8.2/internal/tag/tag.h +0 -16
- data/ext/cached/ruby-1.8.2/internal/vm/instruction/insns_info.c +0 -39
- data/ext/cached/ruby-1.8.2/internal/vm/instruction/insns_info.h +0 -21
- data/ext/cached/ruby-1.8.2/internal/vm/iseq/insns_info.inc +0 -12
- data/ext/cached/ruby-1.8.2/internal/vm/iseq/iseq_load.inc +0 -9
- data/ext/cached/ruby-1.8.3/internal/binding/block.h +0 -32
- data/ext/cached/ruby-1.8.3/internal/module/classpath.c +0 -45
- data/ext/cached/ruby-1.8.3/internal/module/classpath.h +0 -17
- data/ext/cached/ruby-1.8.3/internal/node/block.h +0 -32
- data/ext/cached/ruby-1.8.3/internal/node/global_entry.h +0 -10
- data/ext/cached/ruby-1.8.3/internal/node/nodeinfo.c +0 -5736
- data/ext/cached/ruby-1.8.3/internal/node/nodeinfo.h +0 -69
- data/ext/cached/ruby-1.8.3/internal/proc/block.h +0 -32
- data/ext/cached/ruby-1.8.3/internal/tag/tag.h +0 -16
- data/ext/cached/ruby-1.8.3/internal/vm/instruction/insns_info.c +0 -39
- data/ext/cached/ruby-1.8.3/internal/vm/instruction/insns_info.h +0 -21
- data/ext/cached/ruby-1.8.3/internal/vm/iseq/insns_info.inc +0 -12
- data/ext/cached/ruby-1.8.3/internal/vm/iseq/iseq_load.inc +0 -9
- data/ext/cached/ruby-1.8.7/internal/method/method.h +0 -20
- data/ext/cached/ruby-1.9.0/internal/module/classpath.c +0 -42
- data/ext/cached/ruby-1.9.0/internal/node/global_entry.h +0 -10
- data/ext/cached/ruby-1.9.0/internal/vm/iseq/iseq_load.inc +0 -13
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/id.h +0 -83
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/revision.h +0 -1
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/transdb.h +0 -67
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/version.h +0 -57
- data/ext/internal/module/cfp.h +0 -13
data/ext/internal/node/block.h
CHANGED
|
@@ -7,6 +7,26 @@
|
|
|
7
7
|
#include "env.h"
|
|
8
8
|
#endif
|
|
9
9
|
|
|
10
|
+
struct BLOCK {
|
|
11
|
+
NODE *var;
|
|
12
|
+
NODE *body;
|
|
13
|
+
VALUE self;
|
|
14
|
+
struct FRAME frame;
|
|
15
|
+
struct SCOPE *scope;
|
|
16
|
+
VALUE klass;
|
|
17
|
+
NODE *cref;
|
|
18
|
+
int iter;
|
|
19
|
+
int vmode;
|
|
20
|
+
int flags;
|
|
21
|
+
int uniq;
|
|
22
|
+
struct RVarmap *dyna_vars;
|
|
23
|
+
VALUE orig_thread;
|
|
24
|
+
VALUE wrapper;
|
|
25
|
+
VALUE block_obj;
|
|
26
|
+
struct BLOCK *outer;
|
|
27
|
+
struct BLOCK *prev;
|
|
28
|
+
};
|
|
29
|
+
|
|
10
30
|
|
|
11
31
|
#endif
|
|
12
32
|
|
|
@@ -3,30 +3,39 @@
|
|
|
3
3
|
|
|
4
4
|
st_table * rb_global_tbl;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
struct trace_var {
|
|
7
|
+
int removed;
|
|
8
|
+
void (*func)();
|
|
9
|
+
VALUE data;
|
|
10
|
+
struct trace_var *next;
|
|
11
|
+
};
|
|
11
12
|
struct global_variable {
|
|
12
13
|
int counter;
|
|
13
14
|
void *data;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
VALUE (*getter)();
|
|
16
|
+
void (*setter)();
|
|
17
|
+
void (*marker)();
|
|
17
18
|
int block_trace;
|
|
18
19
|
struct trace_var *trace;
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
struct global_entry {
|
|
22
|
+
struct global_variable *var;
|
|
23
|
+
ID id;
|
|
24
|
+
};
|
|
25
|
+
static VALUE undef_getter();
|
|
26
|
+
static void undef_setter();
|
|
27
|
+
static void undef_marker();
|
|
28
|
+
static VALUE val_getter();
|
|
29
|
+
static void val_setter();
|
|
30
|
+
static void val_marker();
|
|
23
31
|
struct global_entry*
|
|
24
|
-
rb_global_entry(
|
|
32
|
+
rb_global_entry(id)
|
|
33
|
+
ID id;
|
|
25
34
|
{
|
|
26
35
|
struct global_entry *entry;
|
|
27
36
|
st_data_t data;
|
|
28
37
|
|
|
29
|
-
if (!st_lookup(rb_global_tbl,
|
|
38
|
+
if (!st_lookup(rb_global_tbl, id, &data)) {
|
|
30
39
|
struct global_variable *var;
|
|
31
40
|
entry = ALLOC(struct global_entry);
|
|
32
41
|
var = ALLOC(struct global_variable);
|
|
@@ -47,6 +56,53 @@ rb_global_entry(ID id)
|
|
|
47
56
|
}
|
|
48
57
|
return entry;
|
|
49
58
|
}
|
|
59
|
+
static VALUE
|
|
60
|
+
undef_getter(id)
|
|
61
|
+
ID id;
|
|
62
|
+
{
|
|
63
|
+
rb_warning("global variable `%s' not initialized", rb_id2name(id));
|
|
64
|
+
|
|
65
|
+
return Qnil;
|
|
66
|
+
}
|
|
67
|
+
static void
|
|
68
|
+
undef_setter(val, id, data, var)
|
|
69
|
+
VALUE val;
|
|
70
|
+
ID id;
|
|
71
|
+
void *data;
|
|
72
|
+
struct global_variable *var;
|
|
73
|
+
{
|
|
74
|
+
var->getter = val_getter;
|
|
75
|
+
var->setter = val_setter;
|
|
76
|
+
var->marker = val_marker;
|
|
77
|
+
|
|
78
|
+
var->data = (void*)val;
|
|
79
|
+
}
|
|
80
|
+
static void
|
|
81
|
+
undef_marker()
|
|
82
|
+
{
|
|
83
|
+
}
|
|
84
|
+
static VALUE
|
|
85
|
+
val_getter(id, val)
|
|
86
|
+
ID id;
|
|
87
|
+
VALUE val;
|
|
88
|
+
{
|
|
89
|
+
return val;
|
|
90
|
+
}
|
|
91
|
+
static void
|
|
92
|
+
val_setter(val, id, data, var)
|
|
93
|
+
VALUE val;
|
|
94
|
+
ID id;
|
|
95
|
+
void *data;
|
|
96
|
+
struct global_variable *var;
|
|
97
|
+
{
|
|
98
|
+
var->data = (void*)val;
|
|
99
|
+
}
|
|
100
|
+
static void
|
|
101
|
+
val_marker(data)
|
|
102
|
+
VALUE data;
|
|
103
|
+
{
|
|
104
|
+
if (data) rb_gc_mark_maybe(data);
|
|
105
|
+
}
|
|
50
106
|
|
|
51
107
|
#endif
|
|
52
108
|
|
|
@@ -14,8 +14,17 @@ st_table * rb_global_tbl;
|
|
|
14
14
|
prev_line = ''
|
|
15
15
|
while (line = variable_c.gets) != nil do
|
|
16
16
|
case line
|
|
17
|
-
when /^
|
|
18
|
-
|
|
17
|
+
when /^struct (global_entry|global_variable|trace_var)\s*\{/
|
|
18
|
+
write = true
|
|
19
|
+
stopwrite = false
|
|
20
|
+
when /^static\s+(VALUE|void)\s+(undef_getter|undef_setter|undef_marker)\(\)/,
|
|
21
|
+
/^static\s+(VALUE|void)\s+(val_getter|val_setter|val_marker)\(\)/
|
|
22
|
+
write = true
|
|
23
|
+
stopwrite = true
|
|
24
|
+
when /^(rb_global_entry)\(.*\)/,
|
|
25
|
+
/^(undef_getter|undef_setter|undef_marker)\(.*\)/,
|
|
26
|
+
/^(val_getter|val_setter|val_marker)\(.*\)/,
|
|
27
|
+
/^struct global_variable \{/
|
|
19
28
|
puts prev_line
|
|
20
29
|
write = true
|
|
21
30
|
stopwrite = false
|
data/ext/internal/node/node.c
CHANGED
|
@@ -32,6 +32,22 @@
|
|
|
32
32
|
#define RARRAY_PTR(a) RARRAY(a)->ptr
|
|
33
33
|
#endif
|
|
34
34
|
|
|
35
|
+
#ifdef HAVE_TYPE_STRUCT_RTYPEDDATA
|
|
36
|
+
|
|
37
|
+
# undef GetThreadPtr
|
|
38
|
+
# define GetThreadPtr(obj, ptr) \
|
|
39
|
+
TypedData_Get_Struct((obj), rb_thread_t, p_ruby_threadptr_data_type, (ptr))
|
|
40
|
+
|
|
41
|
+
static rb_data_type_t const * p_ruby_threadptr_data_type;
|
|
42
|
+
|
|
43
|
+
static void init_ruby_threadptr_data_type()
|
|
44
|
+
{
|
|
45
|
+
VALUE thread = rb_thread_current();
|
|
46
|
+
p_ruby_threadptr_data_type = RTYPEDDATA_TYPE(thread);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#endif
|
|
50
|
+
|
|
35
51
|
static VALUE rb_cNode = Qnil;
|
|
36
52
|
static VALUE rb_cNodeType = Qnil;
|
|
37
53
|
VALUE rb_cNodeSubclass[NODE_LAST];
|
|
@@ -524,8 +540,12 @@ VALUE eval_ruby_node(NODE * node, VALUE self, VALUE cref)
|
|
|
524
540
|
if(nd_type(node) != NODE_SCOPE)
|
|
525
541
|
{
|
|
526
542
|
/* TODO: This is kinda hokey */
|
|
527
|
-
|
|
528
|
-
|
|
543
|
+
VALUE thread = rb_thread_current();
|
|
544
|
+
rb_thread_t * th;
|
|
545
|
+
ID * local_tbl;
|
|
546
|
+
GetThreadPtr(thread, th);
|
|
547
|
+
local_tbl = th->cfp->iseq
|
|
548
|
+
? th->cfp->iseq->local_table
|
|
529
549
|
: 0;
|
|
530
550
|
node = NEW_NODE(NODE_SCOPE, local_tbl, node, 0);
|
|
531
551
|
}
|
|
@@ -784,7 +804,10 @@ static VALUE node_compile_string(int argc, VALUE * argv, VALUE self)
|
|
|
784
804
|
#ifdef RUBY_VM
|
|
785
805
|
if(!node)
|
|
786
806
|
{
|
|
787
|
-
|
|
807
|
+
VALUE thread = rb_thread_current();
|
|
808
|
+
rb_thread_t * th;
|
|
809
|
+
GetThreadPtr(thread, th);
|
|
810
|
+
rb_exc_raise(th->errinfo);
|
|
788
811
|
}
|
|
789
812
|
#else
|
|
790
813
|
if(ruby_nerrs > 0)
|
|
@@ -1170,5 +1193,9 @@ void Init_node(void)
|
|
|
1170
1193
|
ruby_cref_getter,
|
|
1171
1194
|
ruby_cref_setter);
|
|
1172
1195
|
#endif
|
|
1196
|
+
|
|
1197
|
+
#ifdef HAVE_TYPE_STRUCT_RTYPEDDATA
|
|
1198
|
+
init_ruby_threadptr_data_type();
|
|
1199
|
+
#endif
|
|
1173
1200
|
}
|
|
1174
1201
|
|
|
@@ -2,100 +2,109 @@
|
|
|
2
2
|
#include "version.h"
|
|
3
3
|
|
|
4
4
|
Node_Type_Descrip node_type_descrips_unsorted[] = {
|
|
5
|
-
{ NODE_ALIAS,
|
|
5
|
+
{ NODE_ALIAS, NEN_2ND, NEN_1ST, NEN_NONE, "ALIAS" },
|
|
6
6
|
#ifdef HAVE_NODE_ALLOCA
|
|
7
|
-
{ NODE_ALLOCA, NEN_CFNC, NEN_VALUE,
|
|
7
|
+
{ NODE_ALLOCA, NEN_CNT, NEN_CFNC, NEN_VALUE, "ALLOCA" },
|
|
8
8
|
#endif
|
|
9
9
|
{ NODE_AND, NEN_2ND, NEN_1ST, NEN_NONE, "AND" },
|
|
10
|
-
{ NODE_ARGS, NEN_REST,
|
|
10
|
+
{ NODE_ARGS, NEN_REST, NEN_CNT, NEN_OPT, "ARGS" },
|
|
11
11
|
{ NODE_ARGSCAT, NEN_HEAD, NEN_BODY, NEN_NONE, "ARGSCAT" },
|
|
12
12
|
{ NODE_ARGSPUSH, NEN_HEAD, NEN_BODY, NEN_NONE, "ARGSPUSH" },
|
|
13
|
-
{ NODE_ARRAY,
|
|
14
|
-
{ NODE_ATTRASGN,
|
|
15
|
-
{
|
|
13
|
+
{ NODE_ARRAY, NEN_NEXT, NEN_HEAD, NEN_ALEN, "ARRAY" },
|
|
14
|
+
{ NODE_ATTRASGN, NEN_ARGS, NEN_RECV, NEN_MID, "ATTRASGN" },
|
|
15
|
+
{ NODE_ATTRSET, NEN_VID, NEN_NONE, NEN_NONE, "ATTRSET" },
|
|
16
|
+
{ NODE_BACK_REF, NEN_CNT, NEN_NTH, NEN_NONE, "BACK_REF" },
|
|
16
17
|
{ NODE_BEGIN, NEN_BODY, NEN_NONE, NEN_NONE, "BEGIN" },
|
|
17
|
-
{ NODE_BLOCK,
|
|
18
|
+
{ NODE_BLOCK, NEN_NEXT, NEN_HEAD, NEN_NONE, "BLOCK" },
|
|
18
19
|
{ NODE_BLOCK_ARG, NEN_CNT, NEN_NONE, NEN_NONE, "BLOCK_ARG" },
|
|
19
|
-
{ NODE_BLOCK_PASS,
|
|
20
|
+
{ NODE_BLOCK_PASS, NEN_ITER, NEN_BODY, NEN_NONE, "BLOCK_PASS" },
|
|
20
21
|
{ NODE_BMETHOD, NEN_CVAL, NEN_NONE, NEN_NONE, "BMETHOD" },
|
|
21
22
|
{ NODE_BREAK, NEN_STTS, NEN_NONE, NEN_NONE, "BREAK" },
|
|
22
23
|
{ NODE_CALL, NEN_ARGS, NEN_MID, NEN_RECV, "CALL" },
|
|
23
|
-
{ NODE_CASE, NEN_HEAD, NEN_BODY,
|
|
24
|
+
{ NODE_CASE, NEN_NEXT, NEN_HEAD, NEN_BODY, "CASE" },
|
|
24
25
|
{ NODE_CDECL, NEN_VALUE, NEN_VID, NEN_NONE, "CDECL" },
|
|
26
|
+
{ NODE_CFUNC, NEN_ARGC, NEN_CFNC, NEN_NONE, "CFUNC" },
|
|
25
27
|
{ NODE_CLASS, NEN_SUPER, NEN_CPATH, NEN_BODY, "CLASS" },
|
|
26
28
|
{ NODE_COLON2, NEN_HEAD, NEN_MID, NEN_NONE, "COLON2" },
|
|
27
29
|
{ NODE_COLON3, NEN_MID, NEN_NONE, NEN_NONE, "COLON3" },
|
|
28
30
|
{ NODE_CONST, NEN_VID, NEN_NONE, NEN_NONE, "CONST" },
|
|
31
|
+
{ NODE_CREF, NEN_NEXT, NEN_BODY, NEN_CLSS, "CREF" },
|
|
29
32
|
{ NODE_CVAR, NEN_VID, NEN_NONE, NEN_NONE, "CVAR" },
|
|
30
33
|
{ NODE_CVASGN, NEN_VALUE, NEN_VID, NEN_NONE, "CVASGN" },
|
|
31
34
|
{ NODE_CVDECL, NEN_VALUE, NEN_VID, NEN_NONE, "CVDECL" },
|
|
32
35
|
{ NODE_DASGN, NEN_VALUE, NEN_VID, NEN_NONE, "DASGN" },
|
|
33
36
|
{ NODE_DASGN_CURR, NEN_VALUE, NEN_VID, NEN_NONE, "DASGN_CURR" },
|
|
34
37
|
{ NODE_DEFINED, NEN_HEAD, NEN_NONE, NEN_NONE, "DEFINED" },
|
|
35
|
-
{ NODE_DEFN,
|
|
36
|
-
{ NODE_DEFS,
|
|
37
|
-
{
|
|
38
|
-
{
|
|
39
|
-
{
|
|
40
|
-
{
|
|
41
|
-
{
|
|
42
|
-
{
|
|
38
|
+
{ NODE_DEFN, NEN_MID, NEN_NOEX, NEN_DEFN, "DEFN" },
|
|
39
|
+
{ NODE_DEFS, NEN_RECV, NEN_MID, NEN_DEFN, "DEFS" },
|
|
40
|
+
{ NODE_DMETHOD, NEN_CVAL, NEN_NONE, NEN_NONE, "DMETHOD" },
|
|
41
|
+
{ NODE_DOT2, NEN_END, NEN_STATE, NEN_BEG, "DOT2" },
|
|
42
|
+
{ NODE_DOT3, NEN_END, NEN_STATE, NEN_BEG, "DOT3" },
|
|
43
|
+
{ NODE_DREGX, NEN_NEXT, NEN_LIT, NEN_CFLAG, "DREGX" },
|
|
44
|
+
{ NODE_DREGX_ONCE, NEN_NEXT, NEN_LIT, NEN_CFLAG, "DREGX_ONCE" },
|
|
45
|
+
{ NODE_DSTR, NEN_NEXT, NEN_LIT, NEN_NONE, "DSTR" },
|
|
46
|
+
{ NODE_DSYM, NEN_NEXT, NEN_LIT, NEN_NONE, "DSYM" },
|
|
43
47
|
{ NODE_DVAR, NEN_VID, NEN_NONE, NEN_NONE, "DVAR" },
|
|
44
|
-
{ NODE_DXSTR,
|
|
48
|
+
{ NODE_DXSTR, NEN_NEXT, NEN_LIT, NEN_NONE, "DXSTR" },
|
|
45
49
|
{ NODE_ENSURE, NEN_HEAD, NEN_ENSR, NEN_NONE, "ENSURE" },
|
|
46
50
|
{ NODE_EVSTR, NEN_BODY, NEN_NONE, NEN_NONE, "EVSTR" },
|
|
47
51
|
{ NODE_FALSE, NEN_NONE, NEN_NONE, NEN_NONE, "FALSE" },
|
|
52
|
+
{ NODE_FBODY, NEN_ORIG, NEN_HEAD, NEN_MID, "FBODY" },
|
|
48
53
|
{ NODE_FCALL, NEN_ARGS, NEN_MID, NEN_NONE, "FCALL" },
|
|
49
|
-
{ NODE_FLIP2, NEN_CNT,
|
|
50
|
-
{ NODE_FLIP3, NEN_CNT,
|
|
51
|
-
{ NODE_FOR,
|
|
52
|
-
{ NODE_GASGN, NEN_VALUE, NEN_VID,
|
|
53
|
-
{ NODE_GVAR,
|
|
54
|
+
{ NODE_FLIP2, NEN_CNT, NEN_END, NEN_BEG, "FLIP2" },
|
|
55
|
+
{ NODE_FLIP3, NEN_CNT, NEN_END, NEN_BEG, "FLIP3" },
|
|
56
|
+
{ NODE_FOR, NEN_ITER, NEN_BODY, NEN_VAR, "FOR" },
|
|
57
|
+
{ NODE_GASGN, NEN_ENTRY, NEN_VALUE, NEN_VID, "GASGN" },
|
|
58
|
+
{ NODE_GVAR, NEN_ENTRY, NEN_VID, NEN_NONE, "GVAR" },
|
|
54
59
|
{ NODE_HASH, NEN_HEAD, NEN_NONE, NEN_NONE, "HASH" },
|
|
55
60
|
{ NODE_IASGN, NEN_VALUE, NEN_VID, NEN_NONE, "IASGN" },
|
|
56
|
-
{ NODE_IF,
|
|
57
|
-
{ NODE_IFUNC,
|
|
58
|
-
{ NODE_ITER,
|
|
61
|
+
{ NODE_IF, NEN_ELSE, NEN_BODY, NEN_COND, "IF" },
|
|
62
|
+
{ NODE_IFUNC, NEN_TVAL, NEN_CFNC, NEN_STATE, "IFUNC" },
|
|
63
|
+
{ NODE_ITER, NEN_ITER, NEN_BODY, NEN_VAR, "ITER" },
|
|
59
64
|
{ NODE_IVAR, NEN_VID, NEN_NONE, NEN_NONE, "IVAR" },
|
|
60
|
-
{ NODE_LASGN, NEN_VALUE, NEN_VID,
|
|
65
|
+
{ NODE_LASGN, NEN_CNT, NEN_VALUE, NEN_VID, "LASGN" },
|
|
61
66
|
{ NODE_LIT, NEN_LIT, NEN_NONE, NEN_NONE, "LIT" },
|
|
62
|
-
{ NODE_LVAR,
|
|
67
|
+
{ NODE_LVAR, NEN_CNT, NEN_VID, NEN_NONE, "LVAR" },
|
|
63
68
|
{ NODE_MASGN, NEN_ARGS, NEN_HEAD, NEN_VALUE, "MASGN" },
|
|
64
69
|
{ NODE_MATCH, NEN_LIT, NEN_VALUE, NEN_NONE, "MATCH" },
|
|
65
70
|
{ NODE_MATCH2, NEN_RECV, NEN_VALUE, NEN_NONE, "MATCH2" },
|
|
66
71
|
{ NODE_MATCH3, NEN_RECV, NEN_VALUE, NEN_NONE, "MATCH3" },
|
|
67
72
|
{ NODE_MEMO, NEN_NONE, NEN_NONE, NEN_NONE, "MEMO" },
|
|
73
|
+
{ NODE_METHOD, NEN_BODY, NEN_NOEX, NEN_NONE, "METHOD" },
|
|
68
74
|
{ NODE_MODULE, NEN_CPATH, NEN_BODY, NEN_NONE, "MODULE" },
|
|
75
|
+
{ NODE_NEWLINE, NEN_NEXT, NEN_NONE, NEN_NONE, "NEWLINE" },
|
|
69
76
|
{ NODE_NEXT, NEN_STTS, NEN_NONE, NEN_NONE, "NEXT" },
|
|
70
77
|
{ NODE_NIL, NEN_NONE, NEN_NONE, NEN_NONE, "NIL" },
|
|
71
|
-
{
|
|
78
|
+
{ NODE_NOT, NEN_BODY, NEN_NONE, NEN_NONE, "NOT" },
|
|
79
|
+
{ NODE_NTH_REF, NEN_CNT, NEN_NTH, NEN_NONE, "NTH_REF" },
|
|
72
80
|
{ NODE_OPT_N, NEN_BODY, NEN_NONE, NEN_NONE, "OPT_N" },
|
|
73
81
|
{ NODE_OP_ASGN1, NEN_ARGS, NEN_MID, NEN_RECV, "OP_ASGN1" },
|
|
74
|
-
{ NODE_OP_ASGN2,
|
|
75
|
-
{ NODE_OP_ASGN2_ARG,
|
|
82
|
+
{ NODE_OP_ASGN2, NEN_NEXT, NEN_RECV, NEN_VALUE, "OP_ASGN2" },
|
|
83
|
+
{ NODE_OP_ASGN2_ARG, NEN_AID, NEN_MID, NEN_VID, "OP_ASGN2_ARG" },
|
|
76
84
|
{ NODE_OP_ASGN_AND, NEN_RECV, NEN_VALUE, NEN_NONE, "OP_ASGN_AND" },
|
|
77
85
|
{ NODE_OP_ASGN_OR, NEN_AID, NEN_VALUE, NEN_RECV, "OP_ASGN_OR" },
|
|
78
86
|
{ NODE_OR, NEN_2ND, NEN_1ST, NEN_NONE, "OR" },
|
|
79
87
|
{ NODE_POSTEXE, NEN_NONE, NEN_NONE, NEN_NONE, "POSTEXE" },
|
|
80
88
|
{ NODE_REDO, NEN_NONE, NEN_NONE, NEN_NONE, "REDO" },
|
|
81
|
-
{ NODE_RESBODY, NEN_HEAD, NEN_BODY,
|
|
82
|
-
{ NODE_RESCUE,
|
|
89
|
+
{ NODE_RESBODY, NEN_ARGS, NEN_HEAD, NEN_BODY, "RESBODY" },
|
|
90
|
+
{ NODE_RESCUE, NEN_RESQ, NEN_HEAD, NEN_ELSE, "RESCUE" },
|
|
83
91
|
{ NODE_RETRY, NEN_NONE, NEN_NONE, NEN_NONE, "RETRY" },
|
|
84
92
|
{ NODE_RETURN, NEN_STTS, NEN_NONE, NEN_NONE, "RETURN" },
|
|
85
93
|
{ NODE_SCLASS, NEN_BODY, NEN_RECV, NEN_NONE, "SCLASS" },
|
|
86
|
-
{ NODE_SCOPE, NEN_TBL, NEN_RVAL,
|
|
94
|
+
{ NODE_SCOPE, NEN_NEXT, NEN_TBL, NEN_RVAL, "SCOPE" },
|
|
87
95
|
{ NODE_SELF, NEN_NONE, NEN_NONE, NEN_NONE, "SELF" },
|
|
88
96
|
{ NODE_SPLAT, NEN_HEAD, NEN_NONE, NEN_NONE, "SPLAT" },
|
|
89
97
|
{ NODE_STR, NEN_LIT, NEN_NONE, NEN_NONE, "STR" },
|
|
90
98
|
{ NODE_SUPER, NEN_ARGS, NEN_NONE, NEN_NONE, "SUPER" },
|
|
99
|
+
{ NODE_SVALUE, NEN_HEAD, NEN_NONE, NEN_NONE, "SVALUE" },
|
|
91
100
|
{ NODE_TO_ARY, NEN_HEAD, NEN_NONE, NEN_NONE, "TO_ARY" },
|
|
92
101
|
{ NODE_TRUE, NEN_NONE, NEN_NONE, NEN_NONE, "TRUE" },
|
|
93
102
|
{ NODE_UNDEF, NEN_BODY, NEN_NONE, NEN_NONE, "UNDEF" },
|
|
94
|
-
{ NODE_UNTIL, NEN_BODY,
|
|
95
|
-
{ NODE_VALIAS,
|
|
103
|
+
{ NODE_UNTIL, NEN_BODY, NEN_STATE, NEN_COND, "UNTIL" },
|
|
104
|
+
{ NODE_VALIAS, NEN_2ND, NEN_1ST, NEN_NONE, "VALIAS" },
|
|
96
105
|
{ NODE_VCALL, NEN_MID, NEN_NONE, NEN_NONE, "VCALL" },
|
|
97
|
-
{ NODE_WHEN, NEN_HEAD, NEN_BODY,
|
|
98
|
-
{ NODE_WHILE, NEN_BODY,
|
|
106
|
+
{ NODE_WHEN, NEN_NEXT, NEN_HEAD, NEN_BODY, "WHEN" },
|
|
107
|
+
{ NODE_WHILE, NEN_BODY, NEN_STATE, NEN_COND, "WHILE" },
|
|
99
108
|
{ NODE_XSTR, NEN_LIT, NEN_NONE, NEN_NONE, "XSTR" },
|
|
100
109
|
{ NODE_YIELD, NEN_HEAD, NEN_STATE, NEN_NONE, "YIELD" },
|
|
101
110
|
{ NODE_ZARRAY, NEN_NONE, NEN_NONE, NEN_NONE, "ZARRAY" },
|
|
@@ -450,8 +450,28 @@ VALUE dump_node_elem(enum Node_Elem_Name nen, NODE * n, VALUE node_hash)
|
|
|
450
450
|
return ID2SYM(n->nd_entry->id);
|
|
451
451
|
}
|
|
452
452
|
case NEN_FRML:
|
|
453
|
+
if(n->nd_frml)
|
|
453
454
|
{
|
|
454
|
-
|
|
455
|
+
int node_type;
|
|
456
|
+
if(0 && nd_type(n) == NODE_OP_ASGN2)
|
|
457
|
+
{
|
|
458
|
+
/* All children of NODE_OP_ASGN2 are NODE_OP_ASGN2_ARG */
|
|
459
|
+
node_type = NODE_OP_ASGN2_ARG;
|
|
460
|
+
}
|
|
461
|
+
else
|
|
462
|
+
{
|
|
463
|
+
node_type = nd_type(n->nd_frml);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
dump_node_or_iseq_to_hash(
|
|
467
|
+
(VALUE)n->nd_frml,
|
|
468
|
+
node_type,
|
|
469
|
+
node_hash);
|
|
470
|
+
return node_id(n->nd_frml);
|
|
471
|
+
}
|
|
472
|
+
else
|
|
473
|
+
{
|
|
474
|
+
return Qnil;
|
|
455
475
|
}
|
|
456
476
|
case NEN_HEAD:
|
|
457
477
|
if(n->nd_head)
|
|
@@ -477,6 +497,30 @@ VALUE dump_node_elem(enum Node_Elem_Name nen, NODE * n, VALUE node_hash)
|
|
|
477
497
|
{
|
|
478
498
|
return Qnil;
|
|
479
499
|
}
|
|
500
|
+
case NEN_IBDY:
|
|
501
|
+
if(n->nd_ibdy)
|
|
502
|
+
{
|
|
503
|
+
int node_type;
|
|
504
|
+
if(0 && nd_type(n) == NODE_OP_ASGN2)
|
|
505
|
+
{
|
|
506
|
+
/* All children of NODE_OP_ASGN2 are NODE_OP_ASGN2_ARG */
|
|
507
|
+
node_type = NODE_OP_ASGN2_ARG;
|
|
508
|
+
}
|
|
509
|
+
else
|
|
510
|
+
{
|
|
511
|
+
node_type = nd_type(n->nd_ibdy);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
dump_node_or_iseq_to_hash(
|
|
515
|
+
(VALUE)n->nd_ibdy,
|
|
516
|
+
node_type,
|
|
517
|
+
node_hash);
|
|
518
|
+
return node_id(n->nd_ibdy);
|
|
519
|
+
}
|
|
520
|
+
else
|
|
521
|
+
{
|
|
522
|
+
return Qnil;
|
|
523
|
+
}
|
|
480
524
|
case NEN_ITER:
|
|
481
525
|
if(n->nd_iter)
|
|
482
526
|
{
|
|
@@ -601,19 +645,6 @@ VALUE dump_node_elem(enum Node_Elem_Name nen, NODE * n, VALUE node_hash)
|
|
|
601
645
|
{
|
|
602
646
|
return LONG2NUM((long)n->nd_nth);
|
|
603
647
|
}
|
|
604
|
-
case NEN_OID:
|
|
605
|
-
if(n->nd_oid == 0)
|
|
606
|
-
{
|
|
607
|
-
return Qfalse;
|
|
608
|
-
}
|
|
609
|
-
else if(n->nd_oid == 1)
|
|
610
|
-
{
|
|
611
|
-
return Qtrue;
|
|
612
|
-
}
|
|
613
|
-
else
|
|
614
|
-
{
|
|
615
|
-
return ID2SYM(n->nd_oid);
|
|
616
|
-
}
|
|
617
648
|
case NEN_OPT:
|
|
618
649
|
if(n->nd_opt)
|
|
619
650
|
{
|
|
@@ -680,23 +711,6 @@ VALUE dump_node_elem(enum Node_Elem_Name nen, NODE * n, VALUE node_hash)
|
|
|
680
711
|
INT2NUM(TYPE((VALUE)n->nd_orig)),
|
|
681
712
|
(VALUE)n->nd_orig);
|
|
682
713
|
}
|
|
683
|
-
case NEN_PID:
|
|
684
|
-
if(n->nd_pid == 0)
|
|
685
|
-
{
|
|
686
|
-
return Qfalse;
|
|
687
|
-
}
|
|
688
|
-
else if(n->nd_pid == 1)
|
|
689
|
-
{
|
|
690
|
-
return Qtrue;
|
|
691
|
-
}
|
|
692
|
-
else
|
|
693
|
-
{
|
|
694
|
-
return ID2SYM(n->nd_pid);
|
|
695
|
-
}
|
|
696
|
-
case NEN_PLEN:
|
|
697
|
-
{
|
|
698
|
-
return LONG2NUM((long)n->nd_plen);
|
|
699
|
-
}
|
|
700
714
|
case NEN_RECV:
|
|
701
715
|
if(n->nd_recv)
|
|
702
716
|
{
|
|
@@ -746,17 +760,28 @@ VALUE dump_node_elem(enum Node_Elem_Name nen, NODE * n, VALUE node_hash)
|
|
|
746
760
|
return Qnil;
|
|
747
761
|
}
|
|
748
762
|
case NEN_REST:
|
|
749
|
-
if(n->nd_rest
|
|
763
|
+
if(n->nd_rest)
|
|
750
764
|
{
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
765
|
+
int node_type;
|
|
766
|
+
if(0 && nd_type(n) == NODE_OP_ASGN2)
|
|
767
|
+
{
|
|
768
|
+
/* All children of NODE_OP_ASGN2 are NODE_OP_ASGN2_ARG */
|
|
769
|
+
node_type = NODE_OP_ASGN2_ARG;
|
|
770
|
+
}
|
|
771
|
+
else
|
|
772
|
+
{
|
|
773
|
+
node_type = nd_type(n->nd_rest);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
dump_node_or_iseq_to_hash(
|
|
777
|
+
(VALUE)n->nd_rest,
|
|
778
|
+
node_type,
|
|
779
|
+
node_hash);
|
|
780
|
+
return node_id(n->nd_rest);
|
|
756
781
|
}
|
|
757
782
|
else
|
|
758
783
|
{
|
|
759
|
-
return
|
|
784
|
+
return Qnil;
|
|
760
785
|
}
|
|
761
786
|
case NEN_RVAL:
|
|
762
787
|
if(n->nd_2nd)
|
|
@@ -955,10 +980,6 @@ VALUE dump_node_elem(enum Node_Elem_Name nen, NODE * n, VALUE node_hash)
|
|
|
955
980
|
{
|
|
956
981
|
return ID2SYM(n->nd_vid);
|
|
957
982
|
}
|
|
958
|
-
case NEN_VISI:
|
|
959
|
-
{
|
|
960
|
-
return LONG2NUM((long)n->nd_visi);
|
|
961
|
-
}
|
|
962
983
|
}
|
|
963
984
|
rb_raise(rb_eArgError, "Invalid Node_Elem_Name %d", nen);
|
|
964
985
|
}
|
|
@@ -1365,7 +1386,27 @@ void load_node_elem(enum Node_Elem_Name nen, VALUE v, NODE * n, VALUE node_hash,
|
|
|
1365
1386
|
}
|
|
1366
1387
|
case NEN_FRML:
|
|
1367
1388
|
{
|
|
1368
|
-
|
|
1389
|
+
if(v == Qnil)
|
|
1390
|
+
{
|
|
1391
|
+
n->nd_frml = 0;
|
|
1392
|
+
}
|
|
1393
|
+
else
|
|
1394
|
+
{
|
|
1395
|
+
VALUE nid = rb_hash_aref(id_hash, v);
|
|
1396
|
+
if(RTEST(nid))
|
|
1397
|
+
{
|
|
1398
|
+
n->nd_frml = id_to_node(nid);
|
|
1399
|
+
}
|
|
1400
|
+
else
|
|
1401
|
+
{
|
|
1402
|
+
n->u1.node = (NODE *)load_node_or_iseq_from_hash(
|
|
1403
|
+
v, node_hash, id_hash);
|
|
1404
|
+
if(nd_type(n->u1.node) == NODE_OP_ASGN2_ARG)
|
|
1405
|
+
{
|
|
1406
|
+
nd_set_type(n->u1.node, NODE_OP_ASGN2);
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1369
1410
|
return;
|
|
1370
1411
|
}
|
|
1371
1412
|
case NEN_HEAD:
|
|
@@ -1393,6 +1434,31 @@ void load_node_elem(enum Node_Elem_Name nen, VALUE v, NODE * n, VALUE node_hash,
|
|
|
1393
1434
|
}
|
|
1394
1435
|
return;
|
|
1395
1436
|
}
|
|
1437
|
+
case NEN_IBDY:
|
|
1438
|
+
{
|
|
1439
|
+
if(v == Qnil)
|
|
1440
|
+
{
|
|
1441
|
+
n->nd_ibdy = 0;
|
|
1442
|
+
}
|
|
1443
|
+
else
|
|
1444
|
+
{
|
|
1445
|
+
VALUE nid = rb_hash_aref(id_hash, v);
|
|
1446
|
+
if(RTEST(nid))
|
|
1447
|
+
{
|
|
1448
|
+
n->nd_ibdy = id_to_node(nid);
|
|
1449
|
+
}
|
|
1450
|
+
else
|
|
1451
|
+
{
|
|
1452
|
+
n->u2.node = (NODE *)load_node_or_iseq_from_hash(
|
|
1453
|
+
v, node_hash, id_hash);
|
|
1454
|
+
if(nd_type(n->u2.node) == NODE_OP_ASGN2_ARG)
|
|
1455
|
+
{
|
|
1456
|
+
nd_set_type(n->u2.node, NODE_OP_ASGN2);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
return;
|
|
1461
|
+
}
|
|
1396
1462
|
case NEN_ITER:
|
|
1397
1463
|
{
|
|
1398
1464
|
if(v == Qnil)
|
|
@@ -1522,22 +1588,6 @@ void load_node_elem(enum Node_Elem_Name nen, VALUE v, NODE * n, VALUE node_hash,
|
|
|
1522
1588
|
n->nd_nth = NUM2LONG(v);
|
|
1523
1589
|
return;
|
|
1524
1590
|
}
|
|
1525
|
-
case NEN_OID:
|
|
1526
|
-
{
|
|
1527
|
-
if(v == Qfalse)
|
|
1528
|
-
{
|
|
1529
|
-
n->nd_oid = 0;
|
|
1530
|
-
}
|
|
1531
|
-
else if(v == Qfalse)
|
|
1532
|
-
{
|
|
1533
|
-
n->nd_oid = 1;
|
|
1534
|
-
}
|
|
1535
|
-
else
|
|
1536
|
-
{
|
|
1537
|
-
n->nd_oid = SYM2ID(v);
|
|
1538
|
-
}
|
|
1539
|
-
return;
|
|
1540
|
-
}
|
|
1541
1591
|
case NEN_OPT:
|
|
1542
1592
|
{
|
|
1543
1593
|
if(v == Qnil)
|
|
@@ -1600,27 +1650,6 @@ void load_node_elem(enum Node_Elem_Name nen, VALUE v, NODE * n, VALUE node_hash,
|
|
|
1600
1650
|
}
|
|
1601
1651
|
return;
|
|
1602
1652
|
}
|
|
1603
|
-
case NEN_PID:
|
|
1604
|
-
{
|
|
1605
|
-
if(v == Qfalse)
|
|
1606
|
-
{
|
|
1607
|
-
n->nd_pid = 0;
|
|
1608
|
-
}
|
|
1609
|
-
else if(v == Qfalse)
|
|
1610
|
-
{
|
|
1611
|
-
n->nd_pid = 1;
|
|
1612
|
-
}
|
|
1613
|
-
else
|
|
1614
|
-
{
|
|
1615
|
-
n->nd_pid = SYM2ID(v);
|
|
1616
|
-
}
|
|
1617
|
-
return;
|
|
1618
|
-
}
|
|
1619
|
-
case NEN_PLEN:
|
|
1620
|
-
{
|
|
1621
|
-
n->nd_plen = NUM2LONG(v);
|
|
1622
|
-
return;
|
|
1623
|
-
}
|
|
1624
1653
|
case NEN_RECV:
|
|
1625
1654
|
{
|
|
1626
1655
|
if(v == Qnil)
|
|
@@ -1673,17 +1702,26 @@ void load_node_elem(enum Node_Elem_Name nen, VALUE v, NODE * n, VALUE node_hash,
|
|
|
1673
1702
|
}
|
|
1674
1703
|
case NEN_REST:
|
|
1675
1704
|
{
|
|
1676
|
-
if(v ==
|
|
1705
|
+
if(v == Qnil)
|
|
1677
1706
|
{
|
|
1678
1707
|
n->nd_rest = 0;
|
|
1679
1708
|
}
|
|
1680
|
-
else if(v == Qfalse)
|
|
1681
|
-
{
|
|
1682
|
-
n->nd_rest = 1;
|
|
1683
|
-
}
|
|
1684
1709
|
else
|
|
1685
1710
|
{
|
|
1686
|
-
|
|
1711
|
+
VALUE nid = rb_hash_aref(id_hash, v);
|
|
1712
|
+
if(RTEST(nid))
|
|
1713
|
+
{
|
|
1714
|
+
n->nd_rest = id_to_node(nid);
|
|
1715
|
+
}
|
|
1716
|
+
else
|
|
1717
|
+
{
|
|
1718
|
+
n->u2.node = (NODE *)load_node_or_iseq_from_hash(
|
|
1719
|
+
v, node_hash, id_hash);
|
|
1720
|
+
if(nd_type(n->u2.node) == NODE_OP_ASGN2_ARG)
|
|
1721
|
+
{
|
|
1722
|
+
nd_set_type(n->u2.node, NODE_OP_ASGN2);
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1687
1725
|
}
|
|
1688
1726
|
return;
|
|
1689
1727
|
}
|
|
@@ -1921,11 +1959,6 @@ void load_node_elem(enum Node_Elem_Name nen, VALUE v, NODE * n, VALUE node_hash,
|
|
|
1921
1959
|
}
|
|
1922
1960
|
return;
|
|
1923
1961
|
}
|
|
1924
|
-
case NEN_VISI:
|
|
1925
|
-
{
|
|
1926
|
-
n->nd_visi = NUM2LONG(v);
|
|
1927
|
-
return;
|
|
1928
|
-
}
|
|
1929
1962
|
}
|
|
1930
1963
|
rb_raise(rb_eRuntimeError, "Internal error: invalid Node_Elem_Name %d", nen);
|
|
1931
1964
|
}
|
|
@@ -2015,6 +2048,16 @@ static VALUE node_alen(VALUE self)
|
|
|
2015
2048
|
Data_Get_Struct(self, NODE, n);
|
|
2016
2049
|
return LONG2NUM(n->nd_alen);
|
|
2017
2050
|
}
|
|
2051
|
+
/*
|
|
2052
|
+
* Return the Node's _argc_ member. The return type is an
|
|
2053
|
+
* Integer.
|
|
2054
|
+
*/
|
|
2055
|
+
static VALUE node_argc(VALUE self)
|
|
2056
|
+
{
|
|
2057
|
+
NODE * n;
|
|
2058
|
+
Data_Get_Struct(self, NODE, n);
|
|
2059
|
+
return LONG2NUM(n->nd_argc);
|
|
2060
|
+
}
|
|
2018
2061
|
/*
|
|
2019
2062
|
* Return the Node's _args_ member. The return type is
|
|
2020
2063
|
* either a Node or an Object.
|
|
@@ -2112,6 +2155,33 @@ static VALUE node_cfnc(VALUE self)
|
|
|
2112
2155
|
Data_Get_Struct(self, NODE, n);
|
|
2113
2156
|
return LONG2NUM((long)(n->nd_cfnc));
|
|
2114
2157
|
}
|
|
2158
|
+
/*
|
|
2159
|
+
* Return the Node's _clss_ member. The return type is
|
|
2160
|
+
* either a Node or an Object.
|
|
2161
|
+
*/
|
|
2162
|
+
static VALUE node_clss(VALUE self)
|
|
2163
|
+
{
|
|
2164
|
+
NODE * n;
|
|
2165
|
+
Data_Get_Struct(self, NODE, n);
|
|
2166
|
+
|
|
2167
|
+
if(TYPE(n->nd_clss) == T_NODE)
|
|
2168
|
+
{
|
|
2169
|
+
if(0 && nd_type(n) == NODE_OP_ASGN2)
|
|
2170
|
+
{
|
|
2171
|
+
return wrap_node_as(
|
|
2172
|
+
(NODE *)n->nd_clss,
|
|
2173
|
+
rb_cNodeSubclass[NODE_OP_ASGN2_ARG]);
|
|
2174
|
+
}
|
|
2175
|
+
else
|
|
2176
|
+
{
|
|
2177
|
+
return wrap_node((NODE *)n->nd_clss);
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
else
|
|
2181
|
+
{
|
|
2182
|
+
return (VALUE)n->nd_clss;
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2115
2185
|
/*
|
|
2116
2186
|
* Return the Node's _cnt_ member. The return type is an
|
|
2117
2187
|
* Integer.
|
|
@@ -2504,6 +2574,33 @@ static VALUE node_opt(VALUE self)
|
|
|
2504
2574
|
return (VALUE)n->nd_opt;
|
|
2505
2575
|
}
|
|
2506
2576
|
}
|
|
2577
|
+
/*
|
|
2578
|
+
* Return the Node's _orig_ member. The return type is
|
|
2579
|
+
* either a Node or an Object.
|
|
2580
|
+
*/
|
|
2581
|
+
static VALUE node_orig(VALUE self)
|
|
2582
|
+
{
|
|
2583
|
+
NODE * n;
|
|
2584
|
+
Data_Get_Struct(self, NODE, n);
|
|
2585
|
+
|
|
2586
|
+
if(TYPE(n->nd_orig) == T_NODE)
|
|
2587
|
+
{
|
|
2588
|
+
if(0 && nd_type(n) == NODE_OP_ASGN2)
|
|
2589
|
+
{
|
|
2590
|
+
return wrap_node_as(
|
|
2591
|
+
(NODE *)n->nd_orig,
|
|
2592
|
+
rb_cNodeSubclass[NODE_OP_ASGN2_ARG]);
|
|
2593
|
+
}
|
|
2594
|
+
else
|
|
2595
|
+
{
|
|
2596
|
+
return wrap_node((NODE *)n->nd_orig);
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
else
|
|
2600
|
+
{
|
|
2601
|
+
return (VALUE)n->nd_orig;
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2507
2604
|
/*
|
|
2508
2605
|
* Return the Node's _recv_ member. The return type is
|
|
2509
2606
|
* either a Node or an Object.
|
|
@@ -2559,24 +2656,30 @@ static VALUE node_resq(VALUE self)
|
|
|
2559
2656
|
}
|
|
2560
2657
|
}
|
|
2561
2658
|
/*
|
|
2562
|
-
* Return the Node's _rest_ member. The return type is
|
|
2563
|
-
*
|
|
2659
|
+
* Return the Node's _rest_ member. The return type is
|
|
2660
|
+
* either a Node or an Object.
|
|
2564
2661
|
*/
|
|
2565
2662
|
static VALUE node_rest(VALUE self)
|
|
2566
2663
|
{
|
|
2567
2664
|
NODE * n;
|
|
2568
2665
|
Data_Get_Struct(self, NODE, n);
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
return Qfalse;
|
|
2572
|
-
}
|
|
2573
|
-
else if(n->nd_rest == 1)
|
|
2666
|
+
|
|
2667
|
+
if(TYPE(n->nd_rest) == T_NODE)
|
|
2574
2668
|
{
|
|
2575
|
-
|
|
2669
|
+
if(0 && nd_type(n) == NODE_OP_ASGN2)
|
|
2670
|
+
{
|
|
2671
|
+
return wrap_node_as(
|
|
2672
|
+
(NODE *)n->nd_rest,
|
|
2673
|
+
rb_cNodeSubclass[NODE_OP_ASGN2_ARG]);
|
|
2674
|
+
}
|
|
2675
|
+
else
|
|
2676
|
+
{
|
|
2677
|
+
return wrap_node((NODE *)n->nd_rest);
|
|
2678
|
+
}
|
|
2576
2679
|
}
|
|
2577
2680
|
else
|
|
2578
2681
|
{
|
|
2579
|
-
return
|
|
2682
|
+
return (VALUE)n->nd_rest;
|
|
2580
2683
|
}
|
|
2581
2684
|
}
|
|
2582
2685
|
/*
|
|
@@ -2822,10 +2925,10 @@ void define_node_subclass_methods()
|
|
|
2822
2925
|
rb_iv_set(rb_cALIAS, "__member__", members);
|
|
2823
2926
|
rb_iv_set(rb_cALIAS, "__type__", INT2NUM(NODE_ALIAS));
|
|
2824
2927
|
rb_define_singleton_method(rb_cALIAS, "members", node_s_members, 0);
|
|
2825
|
-
rb_define_method(rb_cALIAS, "first", node_1st, 0);
|
|
2826
|
-
rb_ary_push(members, rb_str_new2("first"));
|
|
2827
2928
|
rb_define_method(rb_cALIAS, "second", node_2nd, 0);
|
|
2828
2929
|
rb_ary_push(members, rb_str_new2("second"));
|
|
2930
|
+
rb_define_method(rb_cALIAS, "first", node_1st, 0);
|
|
2931
|
+
rb_ary_push(members, rb_str_new2("first"));
|
|
2829
2932
|
}
|
|
2830
2933
|
|
|
2831
2934
|
/* Document-class: Node::ALLOCA
|
|
@@ -2843,12 +2946,6 @@ void define_node_subclass_methods()
|
|
|
2843
2946
|
rb_iv_set(rb_cALLOCA, "__type__", INT2NUM(NODE_ALLOCA));
|
|
2844
2947
|
rb_define_singleton_method(rb_cALLOCA, "members", node_s_members, 0);
|
|
2845
2948
|
|
|
2846
|
-
/* Document-method: cfnc
|
|
2847
|
-
* a pointer to the allocated memory
|
|
2848
|
-
*/
|
|
2849
|
-
rb_define_method(rb_cALLOCA, "cfnc", node_cfnc, 0);
|
|
2850
|
-
rb_ary_push(members, rb_str_new2("cfnc"));
|
|
2851
|
-
|
|
2852
2949
|
/* Document-method: value
|
|
2853
2950
|
* a pointer to the previously allocated temporary node
|
|
2854
2951
|
*/
|
|
@@ -2860,6 +2957,12 @@ void define_node_subclass_methods()
|
|
|
2860
2957
|
*/
|
|
2861
2958
|
rb_define_method(rb_cALLOCA, "cnt", node_cnt, 0);
|
|
2862
2959
|
rb_ary_push(members, rb_str_new2("cnt"));
|
|
2960
|
+
|
|
2961
|
+
/* Document-method: cfnc
|
|
2962
|
+
* a pointer to the allocated memory
|
|
2963
|
+
*/
|
|
2964
|
+
rb_define_method(rb_cALLOCA, "cfnc", node_cfnc, 0);
|
|
2965
|
+
rb_ary_push(members, rb_str_new2("cfnc"));
|
|
2863
2966
|
}
|
|
2864
2967
|
#endif
|
|
2865
2968
|
|
|
@@ -2908,19 +3011,19 @@ void define_node_subclass_methods()
|
|
|
2908
3011
|
rb_define_method(rb_cARGS, "rest", node_rest, 0);
|
|
2909
3012
|
rb_ary_push(members, rb_str_new2("rest"));
|
|
2910
3013
|
|
|
3014
|
+
/* Document-method: cnt
|
|
3015
|
+
* the number of required arguments
|
|
3016
|
+
*/
|
|
3017
|
+
rb_define_method(rb_cARGS, "cnt", node_cnt, 0);
|
|
3018
|
+
rb_ary_push(members, rb_str_new2("cnt"));
|
|
3019
|
+
|
|
2911
3020
|
/* Document-method: opt
|
|
2912
3021
|
* a list of assignment nodes to assign default values to the
|
|
2913
3022
|
* optional arguments if no argument is specified
|
|
2914
3023
|
*/
|
|
2915
3024
|
rb_define_method(rb_cARGS, "opt", node_opt, 0);
|
|
2916
3025
|
rb_ary_push(members, rb_str_new2("opt"));
|
|
2917
|
-
|
|
2918
|
-
/* Document-method: cnt
|
|
2919
|
-
* the number of required arguments
|
|
2920
|
-
*/
|
|
2921
|
-
rb_define_method(rb_cARGS, "cnt", node_cnt, 0);
|
|
2922
|
-
rb_ary_push(members, rb_str_new2("cnt"));
|
|
2923
|
-
}
|
|
3026
|
+
}
|
|
2924
3027
|
|
|
2925
3028
|
/* Document-class: Node::ARGSCAT
|
|
2926
3029
|
* Represents the concatenation of a list of arguments and a splatted
|
|
@@ -2985,20 +3088,20 @@ void define_node_subclass_methods()
|
|
|
2985
3088
|
rb_iv_set(rb_cARRAY, "__member__", members);
|
|
2986
3089
|
rb_iv_set(rb_cARRAY, "__type__", INT2NUM(NODE_ARRAY));
|
|
2987
3090
|
rb_define_singleton_method(rb_cARRAY, "members", node_s_members, 0);
|
|
2988
|
-
rb_define_method(rb_cARRAY, "alen", node_alen, 0);
|
|
2989
|
-
rb_ary_push(members, rb_str_new2("alen"));
|
|
2990
|
-
|
|
2991
|
-
/* Document-method: head
|
|
2992
|
-
* the first element of the array
|
|
2993
|
-
*/
|
|
2994
|
-
rb_define_method(rb_cARRAY, "head", node_head, 0);
|
|
2995
|
-
rb_ary_push(members, rb_str_new2("head"));
|
|
2996
3091
|
|
|
2997
3092
|
/* Document-method: next
|
|
2998
3093
|
* the tail of the array
|
|
2999
3094
|
*/
|
|
3000
3095
|
rb_define_method(rb_cARRAY, "next", node_next, 0);
|
|
3001
3096
|
rb_ary_push(members, rb_str_new2("next"));
|
|
3097
|
+
|
|
3098
|
+
/* Document-method: head
|
|
3099
|
+
* the first element of the array
|
|
3100
|
+
*/
|
|
3101
|
+
rb_define_method(rb_cARRAY, "head", node_head, 0);
|
|
3102
|
+
rb_ary_push(members, rb_str_new2("head"));
|
|
3103
|
+
rb_define_method(rb_cARRAY, "alen", node_alen, 0);
|
|
3104
|
+
rb_ary_push(members, rb_str_new2("alen"));
|
|
3002
3105
|
}
|
|
3003
3106
|
|
|
3004
3107
|
/* Document-class: Node::ATTRASGN
|
|
@@ -3015,6 +3118,12 @@ void define_node_subclass_methods()
|
|
|
3015
3118
|
rb_iv_set(rb_cATTRASGN, "__type__", INT2NUM(NODE_ATTRASGN));
|
|
3016
3119
|
rb_define_singleton_method(rb_cATTRASGN, "members", node_s_members, 0);
|
|
3017
3120
|
|
|
3121
|
+
/* Document-method: mid
|
|
3122
|
+
* the id of the attribute, with a trailing '=' sign
|
|
3123
|
+
*/
|
|
3124
|
+
rb_define_method(rb_cATTRASGN, "mid", node_mid, 0);
|
|
3125
|
+
rb_ary_push(members, rb_str_new2("mid"));
|
|
3126
|
+
|
|
3018
3127
|
/* Document-method: recv
|
|
3019
3128
|
* the receiver of the method
|
|
3020
3129
|
*/
|
|
@@ -3026,12 +3135,27 @@ void define_node_subclass_methods()
|
|
|
3026
3135
|
*/
|
|
3027
3136
|
rb_define_method(rb_cATTRASGN, "args", node_args, 0);
|
|
3028
3137
|
rb_ary_push(members, rb_str_new2("args"));
|
|
3138
|
+
}
|
|
3029
3139
|
|
|
3030
|
-
|
|
3031
|
-
|
|
3140
|
+
/* Document-class: Node::ATTRSET
|
|
3141
|
+
* A placeholder for an attribute writer method, which can added to a
|
|
3142
|
+
* class by using attr_writer:
|
|
3143
|
+
* attr_writer :attribute
|
|
3144
|
+
* Its reader counterpart is IVAR.
|
|
3145
|
+
*/
|
|
3146
|
+
{
|
|
3147
|
+
VALUE rb_cATTRSET = rb_define_class_under(rb_cNode, "ATTRSET", rb_cNode);
|
|
3148
|
+
members = rb_ary_new();
|
|
3149
|
+
rb_cNodeSubclass[NODE_ATTRSET] = rb_cATTRSET;
|
|
3150
|
+
rb_iv_set(rb_cATTRSET, "__member__", members);
|
|
3151
|
+
rb_iv_set(rb_cATTRSET, "__type__", INT2NUM(NODE_ATTRSET));
|
|
3152
|
+
rb_define_singleton_method(rb_cATTRSET, "members", node_s_members, 0);
|
|
3153
|
+
|
|
3154
|
+
/* Document-method: vid
|
|
3155
|
+
* the name of the attribute, with a leading '@' sign
|
|
3032
3156
|
*/
|
|
3033
|
-
rb_define_method(
|
|
3034
|
-
rb_ary_push(members, rb_str_new2("
|
|
3157
|
+
rb_define_method(rb_cATTRSET, "vid", node_vid, 0);
|
|
3158
|
+
rb_ary_push(members, rb_str_new2("vid"));
|
|
3035
3159
|
}
|
|
3036
3160
|
|
|
3037
3161
|
/* Document-class: Node::BACK_REF
|
|
@@ -3098,17 +3222,17 @@ void define_node_subclass_methods()
|
|
|
3098
3222
|
rb_iv_set(rb_cBLOCK, "__type__", INT2NUM(NODE_BLOCK));
|
|
3099
3223
|
rb_define_singleton_method(rb_cBLOCK, "members", node_s_members, 0);
|
|
3100
3224
|
|
|
3101
|
-
/* Document-method: head
|
|
3102
|
-
* the first expression in the block of code
|
|
3103
|
-
*/
|
|
3104
|
-
rb_define_method(rb_cBLOCK, "head", node_head, 0);
|
|
3105
|
-
rb_ary_push(members, rb_str_new2("head"));
|
|
3106
|
-
|
|
3107
3225
|
/* Document-method: next
|
|
3108
3226
|
* the second expression in the block of code
|
|
3109
3227
|
*/
|
|
3110
3228
|
rb_define_method(rb_cBLOCK, "next", node_next, 0);
|
|
3111
3229
|
rb_ary_push(members, rb_str_new2("next"));
|
|
3230
|
+
|
|
3231
|
+
/* Document-method: head
|
|
3232
|
+
* the first expression in the block of code
|
|
3233
|
+
*/
|
|
3234
|
+
rb_define_method(rb_cBLOCK, "head", node_head, 0);
|
|
3235
|
+
rb_ary_push(members, rb_str_new2("head"));
|
|
3112
3236
|
}
|
|
3113
3237
|
|
|
3114
3238
|
/* Document-class: Node::BLOCK_ARG
|
|
@@ -3216,12 +3340,6 @@ void define_node_subclass_methods()
|
|
|
3216
3340
|
rb_iv_set(rb_cCALL, "__type__", INT2NUM(NODE_CALL));
|
|
3217
3341
|
rb_define_singleton_method(rb_cCALL, "members", node_s_members, 0);
|
|
3218
3342
|
|
|
3219
|
-
/* Document-method: args
|
|
3220
|
-
* the arguments to the method
|
|
3221
|
-
*/
|
|
3222
|
-
rb_define_method(rb_cCALL, "args", node_args, 0);
|
|
3223
|
-
rb_ary_push(members, rb_str_new2("args"));
|
|
3224
|
-
|
|
3225
3343
|
/* Document-method: mid
|
|
3226
3344
|
* the method id
|
|
3227
3345
|
*/
|
|
@@ -3233,6 +3351,12 @@ void define_node_subclass_methods()
|
|
|
3233
3351
|
*/
|
|
3234
3352
|
rb_define_method(rb_cCALL, "recv", node_recv, 0);
|
|
3235
3353
|
rb_ary_push(members, rb_str_new2("recv"));
|
|
3354
|
+
|
|
3355
|
+
/* Document-method: args
|
|
3356
|
+
* the arguments to the method
|
|
3357
|
+
*/
|
|
3358
|
+
rb_define_method(rb_cCALL, "args", node_args, 0);
|
|
3359
|
+
rb_ary_push(members, rb_str_new2("args"));
|
|
3236
3360
|
}
|
|
3237
3361
|
|
|
3238
3362
|
/* Document-class: Node::CASE
|
|
@@ -3249,6 +3373,8 @@ void define_node_subclass_methods()
|
|
|
3249
3373
|
rb_iv_set(rb_cCASE, "__member__", members);
|
|
3250
3374
|
rb_iv_set(rb_cCASE, "__type__", INT2NUM(NODE_CASE));
|
|
3251
3375
|
rb_define_singleton_method(rb_cCASE, "members", node_s_members, 0);
|
|
3376
|
+
rb_define_method(rb_cCASE, "next", node_next, 0);
|
|
3377
|
+
rb_ary_push(members, rb_str_new2("next"));
|
|
3252
3378
|
|
|
3253
3379
|
/* Document-method: head
|
|
3254
3380
|
* the value to select on
|
|
@@ -3262,8 +3388,6 @@ void define_node_subclass_methods()
|
|
|
3262
3388
|
*/
|
|
3263
3389
|
rb_define_method(rb_cCASE, "body", node_body, 0);
|
|
3264
3390
|
rb_ary_push(members, rb_str_new2("body"));
|
|
3265
|
-
rb_define_method(rb_cCASE, "next", node_next, 0);
|
|
3266
|
-
rb_ary_push(members, rb_str_new2("next"));
|
|
3267
3391
|
}
|
|
3268
3392
|
|
|
3269
3393
|
/* Document-class: Node::CDECL
|
|
@@ -3291,6 +3415,22 @@ void define_node_subclass_methods()
|
|
|
3291
3415
|
rb_ary_push(members, rb_str_new2("vid"));
|
|
3292
3416
|
}
|
|
3293
3417
|
|
|
3418
|
+
/* Document-class: Node::CFUNC
|
|
3419
|
+
* A placeholder for a function implemented in C.
|
|
3420
|
+
*/
|
|
3421
|
+
{
|
|
3422
|
+
VALUE rb_cCFUNC = rb_define_class_under(rb_cNode, "CFUNC", rb_cNode);
|
|
3423
|
+
members = rb_ary_new();
|
|
3424
|
+
rb_cNodeSubclass[NODE_CFUNC] = rb_cCFUNC;
|
|
3425
|
+
rb_iv_set(rb_cCFUNC, "__member__", members);
|
|
3426
|
+
rb_iv_set(rb_cCFUNC, "__type__", INT2NUM(NODE_CFUNC));
|
|
3427
|
+
rb_define_singleton_method(rb_cCFUNC, "members", node_s_members, 0);
|
|
3428
|
+
rb_define_method(rb_cCFUNC, "cfnc", node_cfnc, 0);
|
|
3429
|
+
rb_ary_push(members, rb_str_new2("cfnc"));
|
|
3430
|
+
rb_define_method(rb_cCFUNC, "argc", node_argc, 0);
|
|
3431
|
+
rb_ary_push(members, rb_str_new2("argc"));
|
|
3432
|
+
}
|
|
3433
|
+
|
|
3294
3434
|
/* Document-class: Node::CLASS
|
|
3295
3435
|
* Represents a class definition, e.g.:
|
|
3296
3436
|
* class cpath
|
|
@@ -3351,17 +3491,17 @@ void define_node_subclass_methods()
|
|
|
3351
3491
|
rb_iv_set(rb_cCOLON2, "__type__", INT2NUM(NODE_COLON2));
|
|
3352
3492
|
rb_define_singleton_method(rb_cCOLON2, "members", node_s_members, 0);
|
|
3353
3493
|
|
|
3354
|
-
/* Document-method: head
|
|
3355
|
-
* an expression specifying the class in which to do the lookup
|
|
3356
|
-
*/
|
|
3357
|
-
rb_define_method(rb_cCOLON2, "head", node_head, 0);
|
|
3358
|
-
rb_ary_push(members, rb_str_new2("head"));
|
|
3359
|
-
|
|
3360
3494
|
/* Document-method: mid
|
|
3361
3495
|
* the name of the method or constant to call/look up
|
|
3362
3496
|
*/
|
|
3363
3497
|
rb_define_method(rb_cCOLON2, "mid", node_mid, 0);
|
|
3364
3498
|
rb_ary_push(members, rb_str_new2("mid"));
|
|
3499
|
+
|
|
3500
|
+
/* Document-method: head
|
|
3501
|
+
* an expression specifying the class in which to do the lookup
|
|
3502
|
+
*/
|
|
3503
|
+
rb_define_method(rb_cCOLON2, "head", node_head, 0);
|
|
3504
|
+
rb_ary_push(members, rb_str_new2("head"));
|
|
3365
3505
|
}
|
|
3366
3506
|
|
|
3367
3507
|
/* Document-class: Node::COLON3
|
|
@@ -3404,6 +3544,41 @@ void define_node_subclass_methods()
|
|
|
3404
3544
|
rb_ary_push(members, rb_str_new2("vid"));
|
|
3405
3545
|
}
|
|
3406
3546
|
|
|
3547
|
+
/* Document-class: Node::CREF
|
|
3548
|
+
* A temporary node used to store the value of ruby_cref or
|
|
3549
|
+
* ruby_top_cref and later restore it. The cref holds a reference to
|
|
3550
|
+
* the cbase, which, among other things, is used for constant and class
|
|
3551
|
+
* variable lookup.
|
|
3552
|
+
*
|
|
3553
|
+
* It should never be evaluated as an expression.
|
|
3554
|
+
*/
|
|
3555
|
+
{
|
|
3556
|
+
VALUE rb_cCREF = rb_define_class_under(rb_cNode, "CREF", rb_cNode);
|
|
3557
|
+
members = rb_ary_new();
|
|
3558
|
+
rb_cNodeSubclass[NODE_CREF] = rb_cCREF;
|
|
3559
|
+
rb_iv_set(rb_cCREF, "__member__", members);
|
|
3560
|
+
rb_iv_set(rb_cCREF, "__type__", INT2NUM(NODE_CREF));
|
|
3561
|
+
rb_define_singleton_method(rb_cCREF, "members", node_s_members, 0);
|
|
3562
|
+
|
|
3563
|
+
/* Document-method: next
|
|
3564
|
+
* the previous value of ruby_cref or ruby_top_cref
|
|
3565
|
+
*/
|
|
3566
|
+
rb_define_method(rb_cCREF, "next", node_next, 0);
|
|
3567
|
+
rb_ary_push(members, rb_str_new2("next"));
|
|
3568
|
+
|
|
3569
|
+
/* Document-method: body
|
|
3570
|
+
* always 0 (false)
|
|
3571
|
+
*/
|
|
3572
|
+
rb_define_method(rb_cCREF, "body", node_body, 0);
|
|
3573
|
+
rb_ary_push(members, rb_str_new2("body"));
|
|
3574
|
+
|
|
3575
|
+
/* Document-method: clss
|
|
3576
|
+
* the new class to use for the cbase.
|
|
3577
|
+
*/
|
|
3578
|
+
rb_define_method(rb_cCREF, "clss", node_clss, 0);
|
|
3579
|
+
rb_ary_push(members, rb_str_new2("clss"));
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3407
3582
|
/* Document-class: Node::CVAR
|
|
3408
3583
|
* Represents a class variable retrieval. The result of the expression
|
|
3409
3584
|
* is the value of the class variable.
|
|
@@ -3566,12 +3741,6 @@ void define_node_subclass_methods()
|
|
|
3566
3741
|
rb_iv_set(rb_cDEFN, "__type__", INT2NUM(NODE_DEFN));
|
|
3567
3742
|
rb_define_singleton_method(rb_cDEFN, "members", node_s_members, 0);
|
|
3568
3743
|
|
|
3569
|
-
/* Document-method: defn
|
|
3570
|
-
* the body of the method definition
|
|
3571
|
-
*/
|
|
3572
|
-
rb_define_method(rb_cDEFN, "defn", node_defn, 0);
|
|
3573
|
-
rb_ary_push(members, rb_str_new2("defn"));
|
|
3574
|
-
|
|
3575
3744
|
/* Document-method: mid
|
|
3576
3745
|
* the name of the method* defn the body of the method
|
|
3577
3746
|
*/
|
|
@@ -3583,6 +3752,12 @@ void define_node_subclass_methods()
|
|
|
3583
3752
|
*/
|
|
3584
3753
|
rb_define_method(rb_cDEFN, "noex", node_noex, 0);
|
|
3585
3754
|
rb_ary_push(members, rb_str_new2("noex"));
|
|
3755
|
+
|
|
3756
|
+
/* Document-method: defn
|
|
3757
|
+
* the body of the method definition
|
|
3758
|
+
*/
|
|
3759
|
+
rb_define_method(rb_cDEFN, "defn", node_defn, 0);
|
|
3760
|
+
rb_ary_push(members, rb_str_new2("defn"));
|
|
3586
3761
|
}
|
|
3587
3762
|
|
|
3588
3763
|
/* Document-class: Node::DEFS
|
|
@@ -3598,6 +3773,12 @@ void define_node_subclass_methods()
|
|
|
3598
3773
|
rb_iv_set(rb_cDEFS, "__member__", members);
|
|
3599
3774
|
rb_iv_set(rb_cDEFS, "__type__", INT2NUM(NODE_DEFS));
|
|
3600
3775
|
rb_define_singleton_method(rb_cDEFS, "members", node_s_members, 0);
|
|
3776
|
+
|
|
3777
|
+
/* Document-method: mid
|
|
3778
|
+
* the name of the method* defn the body of the method
|
|
3779
|
+
*/
|
|
3780
|
+
rb_define_method(rb_cDEFS, "mid", node_mid, 0);
|
|
3781
|
+
rb_ary_push(members, rb_str_new2("mid"));
|
|
3601
3782
|
rb_define_method(rb_cDEFS, "defn", node_defn, 0);
|
|
3602
3783
|
rb_ary_push(members, rb_str_new2("defn"));
|
|
3603
3784
|
|
|
@@ -3606,12 +3787,29 @@ void define_node_subclass_methods()
|
|
|
3606
3787
|
*/
|
|
3607
3788
|
rb_define_method(rb_cDEFS, "recv", node_recv, 0);
|
|
3608
3789
|
rb_ary_push(members, rb_str_new2("recv"));
|
|
3790
|
+
}
|
|
3609
3791
|
|
|
3610
|
-
|
|
3611
|
-
|
|
3792
|
+
/* Document-class: Node::DMETHOD
|
|
3793
|
+
* A placeholder for a method defined using define_method where the
|
|
3794
|
+
* passed block is created from a Method object, e.g.:
|
|
3795
|
+
* define_method(:name, method(:foo))
|
|
3796
|
+
*
|
|
3797
|
+
* See also BMETHOD.
|
|
3798
|
+
*/
|
|
3799
|
+
{
|
|
3800
|
+
VALUE rb_cDMETHOD = rb_define_class_under(rb_cNode, "DMETHOD", rb_cNode);
|
|
3801
|
+
members = rb_ary_new();
|
|
3802
|
+
rb_cNodeSubclass[NODE_DMETHOD] = rb_cDMETHOD;
|
|
3803
|
+
rb_iv_set(rb_cDMETHOD, "__member__", members);
|
|
3804
|
+
rb_iv_set(rb_cDMETHOD, "__type__", INT2NUM(NODE_DMETHOD));
|
|
3805
|
+
rb_define_singleton_method(rb_cDMETHOD, "members", node_s_members, 0);
|
|
3806
|
+
|
|
3807
|
+
/* Document-method: cval
|
|
3808
|
+
* the Method object passed to define_method, which contains the
|
|
3809
|
+
* body of the method
|
|
3612
3810
|
*/
|
|
3613
|
-
rb_define_method(
|
|
3614
|
-
rb_ary_push(members, rb_str_new2("
|
|
3811
|
+
rb_define_method(rb_cDMETHOD, "cval", node_cval, 0);
|
|
3812
|
+
rb_ary_push(members, rb_str_new2("cval"));
|
|
3615
3813
|
}
|
|
3616
3814
|
|
|
3617
3815
|
/* Document-class: Node::DOT2
|
|
@@ -3626,20 +3824,20 @@ void define_node_subclass_methods()
|
|
|
3626
3824
|
rb_iv_set(rb_cDOT2, "__member__", members);
|
|
3627
3825
|
rb_iv_set(rb_cDOT2, "__type__", INT2NUM(NODE_DOT2));
|
|
3628
3826
|
rb_define_singleton_method(rb_cDOT2, "members", node_s_members, 0);
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
* the beginning of the range
|
|
3632
|
-
*/
|
|
3633
|
-
rb_define_method(rb_cDOT2, "beg", node_beg, 0);
|
|
3634
|
-
rb_ary_push(members, rb_str_new2("beg"));
|
|
3827
|
+
rb_define_method(rb_cDOT2, "state", node_state, 0);
|
|
3828
|
+
rb_ary_push(members, rb_str_new2("state"));
|
|
3635
3829
|
|
|
3636
3830
|
/* Document-method: end
|
|
3637
3831
|
* the end of the range
|
|
3638
3832
|
*/
|
|
3639
3833
|
rb_define_method(rb_cDOT2, "end", node_end, 0);
|
|
3640
3834
|
rb_ary_push(members, rb_str_new2("end"));
|
|
3641
|
-
|
|
3642
|
-
|
|
3835
|
+
|
|
3836
|
+
/* Document-method: beg
|
|
3837
|
+
* the beginning of the range
|
|
3838
|
+
*/
|
|
3839
|
+
rb_define_method(rb_cDOT2, "beg", node_beg, 0);
|
|
3840
|
+
rb_ary_push(members, rb_str_new2("beg"));
|
|
3643
3841
|
}
|
|
3644
3842
|
|
|
3645
3843
|
/* Document-class: Node::DOT3
|
|
@@ -3654,20 +3852,20 @@ void define_node_subclass_methods()
|
|
|
3654
3852
|
rb_iv_set(rb_cDOT3, "__member__", members);
|
|
3655
3853
|
rb_iv_set(rb_cDOT3, "__type__", INT2NUM(NODE_DOT3));
|
|
3656
3854
|
rb_define_singleton_method(rb_cDOT3, "members", node_s_members, 0);
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
* the beginning of the range
|
|
3660
|
-
*/
|
|
3661
|
-
rb_define_method(rb_cDOT3, "beg", node_beg, 0);
|
|
3662
|
-
rb_ary_push(members, rb_str_new2("beg"));
|
|
3855
|
+
rb_define_method(rb_cDOT3, "state", node_state, 0);
|
|
3856
|
+
rb_ary_push(members, rb_str_new2("state"));
|
|
3663
3857
|
|
|
3664
3858
|
/* Document-method: end
|
|
3665
3859
|
* the end of the range
|
|
3666
3860
|
*/
|
|
3667
3861
|
rb_define_method(rb_cDOT3, "end", node_end, 0);
|
|
3668
3862
|
rb_ary_push(members, rb_str_new2("end"));
|
|
3669
|
-
|
|
3670
|
-
|
|
3863
|
+
|
|
3864
|
+
/* Document-method: beg
|
|
3865
|
+
* the beginning of the range
|
|
3866
|
+
*/
|
|
3867
|
+
rb_define_method(rb_cDOT3, "beg", node_beg, 0);
|
|
3868
|
+
rb_ary_push(members, rb_str_new2("beg"));
|
|
3671
3869
|
}
|
|
3672
3870
|
|
|
3673
3871
|
/* Document-class: Node::DREGX
|
|
@@ -3923,6 +4121,38 @@ void define_node_subclass_methods()
|
|
|
3923
4121
|
rb_define_singleton_method(rb_cFALSE, "members", node_s_members, 0);
|
|
3924
4122
|
}
|
|
3925
4123
|
|
|
4124
|
+
/* Document-class: Node::FBODY
|
|
4125
|
+
* A placeholder for a method alias, which can be added to a class by
|
|
4126
|
+
* using alias or alias_method:
|
|
4127
|
+
* alias old new
|
|
4128
|
+
*/
|
|
4129
|
+
{
|
|
4130
|
+
VALUE rb_cFBODY = rb_define_class_under(rb_cNode, "FBODY", rb_cNode);
|
|
4131
|
+
members = rb_ary_new();
|
|
4132
|
+
rb_cNodeSubclass[NODE_FBODY] = rb_cFBODY;
|
|
4133
|
+
rb_iv_set(rb_cFBODY, "__member__", members);
|
|
4134
|
+
rb_iv_set(rb_cFBODY, "__type__", INT2NUM(NODE_FBODY));
|
|
4135
|
+
rb_define_singleton_method(rb_cFBODY, "members", node_s_members, 0);
|
|
4136
|
+
|
|
4137
|
+
/* Document-method: orig
|
|
4138
|
+
* the origin class
|
|
4139
|
+
*/
|
|
4140
|
+
rb_define_method(rb_cFBODY, "orig", node_orig, 0);
|
|
4141
|
+
rb_ary_push(members, rb_str_new2("orig"));
|
|
4142
|
+
|
|
4143
|
+
/* Document-method: mid
|
|
4144
|
+
* the name of the method
|
|
4145
|
+
*/
|
|
4146
|
+
rb_define_method(rb_cFBODY, "mid", node_mid, 0);
|
|
4147
|
+
rb_ary_push(members, rb_str_new2("mid"));
|
|
4148
|
+
|
|
4149
|
+
/* Document-method: head
|
|
4150
|
+
* the method body
|
|
4151
|
+
*/
|
|
4152
|
+
rb_define_method(rb_cFBODY, "head", node_head, 0);
|
|
4153
|
+
rb_ary_push(members, rb_str_new2("head"));
|
|
4154
|
+
}
|
|
4155
|
+
|
|
3926
4156
|
/* Document-class: Node::FCALL
|
|
3927
4157
|
* Represents a method call in the form:
|
|
3928
4158
|
* mid(args).
|
|
@@ -3938,17 +4168,17 @@ void define_node_subclass_methods()
|
|
|
3938
4168
|
rb_iv_set(rb_cFCALL, "__type__", INT2NUM(NODE_FCALL));
|
|
3939
4169
|
rb_define_singleton_method(rb_cFCALL, "members", node_s_members, 0);
|
|
3940
4170
|
|
|
3941
|
-
/* Document-method: args
|
|
3942
|
-
* the arguments to the method
|
|
3943
|
-
*/
|
|
3944
|
-
rb_define_method(rb_cFCALL, "args", node_args, 0);
|
|
3945
|
-
rb_ary_push(members, rb_str_new2("args"));
|
|
3946
|
-
|
|
3947
4171
|
/* Document-method: mid
|
|
3948
4172
|
* the method id
|
|
3949
4173
|
*/
|
|
3950
4174
|
rb_define_method(rb_cFCALL, "mid", node_mid, 0);
|
|
3951
4175
|
rb_ary_push(members, rb_str_new2("mid"));
|
|
4176
|
+
|
|
4177
|
+
/* Document-method: args
|
|
4178
|
+
* the arguments to the method
|
|
4179
|
+
*/
|
|
4180
|
+
rb_define_method(rb_cFCALL, "args", node_args, 0);
|
|
4181
|
+
rb_ary_push(members, rb_str_new2("args"));
|
|
3952
4182
|
}
|
|
3953
4183
|
|
|
3954
4184
|
/* Document-class: Node::FLIP2
|
|
@@ -3972,17 +4202,17 @@ void define_node_subclass_methods()
|
|
|
3972
4202
|
rb_define_method(rb_cFLIP2, "cnt", node_cnt, 0);
|
|
3973
4203
|
rb_ary_push(members, rb_str_new2("cnt"));
|
|
3974
4204
|
|
|
3975
|
-
/* Document-method: beg
|
|
3976
|
-
* the beginning of the range
|
|
3977
|
-
*/
|
|
3978
|
-
rb_define_method(rb_cFLIP2, "beg", node_beg, 0);
|
|
3979
|
-
rb_ary_push(members, rb_str_new2("beg"));
|
|
3980
|
-
|
|
3981
4205
|
/* Document-method: end
|
|
3982
4206
|
* the end of the range
|
|
3983
4207
|
*/
|
|
3984
4208
|
rb_define_method(rb_cFLIP2, "end", node_end, 0);
|
|
3985
4209
|
rb_ary_push(members, rb_str_new2("end"));
|
|
4210
|
+
|
|
4211
|
+
/* Document-method: beg
|
|
4212
|
+
* the beginning of the range
|
|
4213
|
+
*/
|
|
4214
|
+
rb_define_method(rb_cFLIP2, "beg", node_beg, 0);
|
|
4215
|
+
rb_ary_push(members, rb_str_new2("beg"));
|
|
3986
4216
|
}
|
|
3987
4217
|
|
|
3988
4218
|
/* Document-class: Node::FLIP3
|
|
@@ -4006,17 +4236,17 @@ void define_node_subclass_methods()
|
|
|
4006
4236
|
rb_define_method(rb_cFLIP3, "cnt", node_cnt, 0);
|
|
4007
4237
|
rb_ary_push(members, rb_str_new2("cnt"));
|
|
4008
4238
|
|
|
4009
|
-
/* Document-method: beg
|
|
4010
|
-
* the beginning of the range
|
|
4011
|
-
*/
|
|
4012
|
-
rb_define_method(rb_cFLIP3, "beg", node_beg, 0);
|
|
4013
|
-
rb_ary_push(members, rb_str_new2("beg"));
|
|
4014
|
-
|
|
4015
4239
|
/* Document-method: end
|
|
4016
4240
|
* the end of the range
|
|
4017
4241
|
*/
|
|
4018
4242
|
rb_define_method(rb_cFLIP3, "end", node_end, 0);
|
|
4019
4243
|
rb_ary_push(members, rb_str_new2("end"));
|
|
4244
|
+
|
|
4245
|
+
/* Document-method: beg
|
|
4246
|
+
* the beginning of the range
|
|
4247
|
+
*/
|
|
4248
|
+
rb_define_method(rb_cFLIP3, "beg", node_beg, 0);
|
|
4249
|
+
rb_ary_push(members, rb_str_new2("beg"));
|
|
4020
4250
|
}
|
|
4021
4251
|
|
|
4022
4252
|
/* Document-class: Node::FOR
|
|
@@ -4041,6 +4271,14 @@ void define_node_subclass_methods()
|
|
|
4041
4271
|
rb_iv_set(rb_cFOR, "__type__", INT2NUM(NODE_FOR));
|
|
4042
4272
|
rb_define_singleton_method(rb_cFOR, "members", node_s_members, 0);
|
|
4043
4273
|
|
|
4274
|
+
/* Document-method: var
|
|
4275
|
+
* an assignment node which assigns the next value in the sequence
|
|
4276
|
+
* to a variable, which may or may not be local. May also be a
|
|
4277
|
+
* multiple assignment.
|
|
4278
|
+
*/
|
|
4279
|
+
rb_define_method(rb_cFOR, "var", node_var, 0);
|
|
4280
|
+
rb_ary_push(members, rb_str_new2("var"));
|
|
4281
|
+
|
|
4044
4282
|
/* Document-method: body
|
|
4045
4283
|
* the body of the loop
|
|
4046
4284
|
*/
|
|
@@ -4052,14 +4290,6 @@ void define_node_subclass_methods()
|
|
|
4052
4290
|
*/
|
|
4053
4291
|
rb_define_method(rb_cFOR, "iter", node_iter, 0);
|
|
4054
4292
|
rb_ary_push(members, rb_str_new2("iter"));
|
|
4055
|
-
|
|
4056
|
-
/* Document-method: var
|
|
4057
|
-
* an assignment node which assigns the next value in the sequence
|
|
4058
|
-
* to a variable, which may or may not be local. May also be a
|
|
4059
|
-
* multiple assignment.
|
|
4060
|
-
*/
|
|
4061
|
-
rb_define_method(rb_cFOR, "var", node_var, 0);
|
|
4062
|
-
rb_ary_push(members, rb_str_new2("var"));
|
|
4063
4293
|
}
|
|
4064
4294
|
|
|
4065
4295
|
/* Document-class: Node::GASGN
|
|
@@ -4180,12 +4410,6 @@ void define_node_subclass_methods()
|
|
|
4180
4410
|
rb_iv_set(rb_cIF, "__type__", INT2NUM(NODE_IF));
|
|
4181
4411
|
rb_define_singleton_method(rb_cIF, "members", node_s_members, 0);
|
|
4182
4412
|
|
|
4183
|
-
/* Document-method: cond
|
|
4184
|
-
* the condition to evaluate
|
|
4185
|
-
*/
|
|
4186
|
-
rb_define_method(rb_cIF, "cond", node_cond, 0);
|
|
4187
|
-
rb_ary_push(members, rb_str_new2("cond"));
|
|
4188
|
-
|
|
4189
4413
|
/* Document-method: body
|
|
4190
4414
|
* the expression to evaluate if the expression is true, or false
|
|
4191
4415
|
* if the expression is empty
|
|
@@ -4199,6 +4423,12 @@ void define_node_subclass_methods()
|
|
|
4199
4423
|
*/
|
|
4200
4424
|
rb_define_method(rb_cIF, "else", node_else, 0);
|
|
4201
4425
|
rb_ary_push(members, rb_str_new2("else"));
|
|
4426
|
+
|
|
4427
|
+
/* Document-method: cond
|
|
4428
|
+
* the condition to evaluate
|
|
4429
|
+
*/
|
|
4430
|
+
rb_define_method(rb_cIF, "cond", node_cond, 0);
|
|
4431
|
+
rb_ary_push(members, rb_str_new2("cond"));
|
|
4202
4432
|
}
|
|
4203
4433
|
|
|
4204
4434
|
/* Document-class: Node::IFUNC
|
|
@@ -4212,11 +4442,11 @@ void define_node_subclass_methods()
|
|
|
4212
4442
|
rb_iv_set(rb_cIFUNC, "__type__", INT2NUM(NODE_IFUNC));
|
|
4213
4443
|
rb_define_singleton_method(rb_cIFUNC, "members", node_s_members, 0);
|
|
4214
4444
|
|
|
4215
|
-
/* Document-method:
|
|
4216
|
-
*
|
|
4445
|
+
/* Document-method: state
|
|
4446
|
+
* always 0
|
|
4217
4447
|
*/
|
|
4218
|
-
rb_define_method(rb_cIFUNC, "
|
|
4219
|
-
rb_ary_push(members, rb_str_new2("
|
|
4448
|
+
rb_define_method(rb_cIFUNC, "state", node_state, 0);
|
|
4449
|
+
rb_ary_push(members, rb_str_new2("state"));
|
|
4220
4450
|
|
|
4221
4451
|
/* Document-method: tval
|
|
4222
4452
|
* the user-specified data to be passed as the second argument to
|
|
@@ -4225,11 +4455,11 @@ void define_node_subclass_methods()
|
|
|
4225
4455
|
rb_define_method(rb_cIFUNC, "tval", node_tval, 0);
|
|
4226
4456
|
rb_ary_push(members, rb_str_new2("tval"));
|
|
4227
4457
|
|
|
4228
|
-
/* Document-method:
|
|
4229
|
-
*
|
|
4458
|
+
/* Document-method: cfnc
|
|
4459
|
+
* a pointer to the C function to which to yield
|
|
4230
4460
|
*/
|
|
4231
|
-
rb_define_method(rb_cIFUNC, "
|
|
4232
|
-
rb_ary_push(members, rb_str_new2("
|
|
4461
|
+
rb_define_method(rb_cIFUNC, "cfnc", node_cfnc, 0);
|
|
4462
|
+
rb_ary_push(members, rb_str_new2("cfnc"));
|
|
4233
4463
|
}
|
|
4234
4464
|
|
|
4235
4465
|
/* Document-class: Node::ITER
|
|
@@ -4253,6 +4483,14 @@ void define_node_subclass_methods()
|
|
|
4253
4483
|
rb_iv_set(rb_cITER, "__type__", INT2NUM(NODE_ITER));
|
|
4254
4484
|
rb_define_singleton_method(rb_cITER, "members", node_s_members, 0);
|
|
4255
4485
|
|
|
4486
|
+
/* Document-method: var
|
|
4487
|
+
* an assignment node which assigns the next value in the sequence
|
|
4488
|
+
* to a variable, which may or may not be local. May also be a
|
|
4489
|
+
* multiple assignment.
|
|
4490
|
+
*/
|
|
4491
|
+
rb_define_method(rb_cITER, "var", node_var, 0);
|
|
4492
|
+
rb_ary_push(members, rb_str_new2("var"));
|
|
4493
|
+
|
|
4256
4494
|
/* Document-method: body
|
|
4257
4495
|
* the body of the loop
|
|
4258
4496
|
*/
|
|
@@ -4265,14 +4503,6 @@ void define_node_subclass_methods()
|
|
|
4265
4503
|
*/
|
|
4266
4504
|
rb_define_method(rb_cITER, "iter", node_iter, 0);
|
|
4267
4505
|
rb_ary_push(members, rb_str_new2("iter"));
|
|
4268
|
-
|
|
4269
|
-
/* Document-method: var
|
|
4270
|
-
* an assignment node which assigns the next value in the sequence
|
|
4271
|
-
* to a variable, which may or may not be local. May also be a
|
|
4272
|
-
* multiple assignment.
|
|
4273
|
-
*/
|
|
4274
|
-
rb_define_method(rb_cITER, "var", node_var, 0);
|
|
4275
|
-
rb_ary_push(members, rb_str_new2("var"));
|
|
4276
4506
|
}
|
|
4277
4507
|
|
|
4278
4508
|
/* Document-class: Node::IVAR
|
|
@@ -4312,14 +4542,14 @@ void define_node_subclass_methods()
|
|
|
4312
4542
|
*/
|
|
4313
4543
|
rb_define_method(rb_cLASGN, "value", node_value, 0);
|
|
4314
4544
|
rb_ary_push(members, rb_str_new2("value"));
|
|
4545
|
+
rb_define_method(rb_cLASGN, "cnt", node_cnt, 0);
|
|
4546
|
+
rb_ary_push(members, rb_str_new2("cnt"));
|
|
4315
4547
|
|
|
4316
4548
|
/* Document-method: vid
|
|
4317
4549
|
* the name of the local variable
|
|
4318
4550
|
*/
|
|
4319
4551
|
rb_define_method(rb_cLASGN, "vid", node_vid, 0);
|
|
4320
4552
|
rb_ary_push(members, rb_str_new2("vid"));
|
|
4321
|
-
rb_define_method(rb_cLASGN, "cnt", node_cnt, 0);
|
|
4322
|
-
rb_ary_push(members, rb_str_new2("cnt"));
|
|
4323
4553
|
}
|
|
4324
4554
|
|
|
4325
4555
|
/* Document-class: Node::LIT
|
|
@@ -4351,14 +4581,14 @@ void define_node_subclass_methods()
|
|
|
4351
4581
|
rb_iv_set(rb_cLVAR, "__member__", members);
|
|
4352
4582
|
rb_iv_set(rb_cLVAR, "__type__", INT2NUM(NODE_LVAR));
|
|
4353
4583
|
rb_define_singleton_method(rb_cLVAR, "members", node_s_members, 0);
|
|
4584
|
+
rb_define_method(rb_cLVAR, "cnt", node_cnt, 0);
|
|
4585
|
+
rb_ary_push(members, rb_str_new2("cnt"));
|
|
4354
4586
|
|
|
4355
4587
|
/* Document-method: vid
|
|
4356
4588
|
* the name of the local variable to retrieve.
|
|
4357
4589
|
*/
|
|
4358
4590
|
rb_define_method(rb_cLVAR, "vid", node_vid, 0);
|
|
4359
4591
|
rb_ary_push(members, rb_str_new2("vid"));
|
|
4360
|
-
rb_define_method(rb_cLVAR, "cnt", node_cnt, 0);
|
|
4361
|
-
rb_ary_push(members, rb_str_new2("cnt"));
|
|
4362
4592
|
}
|
|
4363
4593
|
|
|
4364
4594
|
/* Document-class: Node::MASGN
|
|
@@ -4372,11 +4602,11 @@ void define_node_subclass_methods()
|
|
|
4372
4602
|
rb_iv_set(rb_cMASGN, "__type__", INT2NUM(NODE_MASGN));
|
|
4373
4603
|
rb_define_singleton_method(rb_cMASGN, "members", node_s_members, 0);
|
|
4374
4604
|
|
|
4375
|
-
/* Document-method:
|
|
4605
|
+
/* Document-method: value
|
|
4376
4606
|
* TODO
|
|
4377
4607
|
*/
|
|
4378
|
-
rb_define_method(rb_cMASGN, "
|
|
4379
|
-
rb_ary_push(members, rb_str_new2("
|
|
4608
|
+
rb_define_method(rb_cMASGN, "value", node_value, 0);
|
|
4609
|
+
rb_ary_push(members, rb_str_new2("value"));
|
|
4380
4610
|
|
|
4381
4611
|
/* Document-method: head
|
|
4382
4612
|
* TODO
|
|
@@ -4384,11 +4614,11 @@ void define_node_subclass_methods()
|
|
|
4384
4614
|
rb_define_method(rb_cMASGN, "head", node_head, 0);
|
|
4385
4615
|
rb_ary_push(members, rb_str_new2("head"));
|
|
4386
4616
|
|
|
4387
|
-
/* Document-method:
|
|
4617
|
+
/* Document-method: args
|
|
4388
4618
|
* TODO
|
|
4389
4619
|
*/
|
|
4390
|
-
rb_define_method(rb_cMASGN, "
|
|
4391
|
-
rb_ary_push(members, rb_str_new2("
|
|
4620
|
+
rb_define_method(rb_cMASGN, "args", node_args, 0);
|
|
4621
|
+
rb_ary_push(members, rb_str_new2("args"));
|
|
4392
4622
|
}
|
|
4393
4623
|
|
|
4394
4624
|
/* Document-class: Node::MATCH
|
|
@@ -4413,17 +4643,17 @@ void define_node_subclass_methods()
|
|
|
4413
4643
|
rb_iv_set(rb_cMATCH, "__type__", INT2NUM(NODE_MATCH));
|
|
4414
4644
|
rb_define_singleton_method(rb_cMATCH, "members", node_s_members, 0);
|
|
4415
4645
|
|
|
4416
|
-
/* Document-method: lit
|
|
4417
|
-
* the regular expression to use in the condition.
|
|
4418
|
-
*/
|
|
4419
|
-
rb_define_method(rb_cMATCH, "lit", node_lit, 0);
|
|
4420
|
-
rb_ary_push(members, rb_str_new2("lit"));
|
|
4421
|
-
|
|
4422
4646
|
/* Document-method: value
|
|
4423
4647
|
* the value to compare against
|
|
4424
4648
|
*/
|
|
4425
4649
|
rb_define_method(rb_cMATCH, "value", node_value, 0);
|
|
4426
4650
|
rb_ary_push(members, rb_str_new2("value"));
|
|
4651
|
+
|
|
4652
|
+
/* Document-method: lit
|
|
4653
|
+
* the regular expression to use in the condition.
|
|
4654
|
+
*/
|
|
4655
|
+
rb_define_method(rb_cMATCH, "lit", node_lit, 0);
|
|
4656
|
+
rb_ary_push(members, rb_str_new2("lit"));
|
|
4427
4657
|
}
|
|
4428
4658
|
|
|
4429
4659
|
/* Document-class: Node::MATCH2
|
|
@@ -4451,13 +4681,6 @@ void define_node_subclass_methods()
|
|
|
4451
4681
|
rb_iv_set(rb_cMATCH2, "__type__", INT2NUM(NODE_MATCH2));
|
|
4452
4682
|
rb_define_singleton_method(rb_cMATCH2, "members", node_s_members, 0);
|
|
4453
4683
|
|
|
4454
|
-
/* Document-method: recv
|
|
4455
|
-
* the regular expression on the left hand side of the match
|
|
4456
|
-
* operator
|
|
4457
|
-
*/
|
|
4458
|
-
rb_define_method(rb_cMATCH2, "recv", node_recv, 0);
|
|
4459
|
-
rb_ary_push(members, rb_str_new2("recv"));
|
|
4460
|
-
|
|
4461
4684
|
/* Document-method: value
|
|
4462
4685
|
* the expression on the right hand side of the match operator, or
|
|
4463
4686
|
* an expression returning $_ if there is nothing on the right hand
|
|
@@ -4465,6 +4688,13 @@ void define_node_subclass_methods()
|
|
|
4465
4688
|
*/
|
|
4466
4689
|
rb_define_method(rb_cMATCH2, "value", node_value, 0);
|
|
4467
4690
|
rb_ary_push(members, rb_str_new2("value"));
|
|
4691
|
+
|
|
4692
|
+
/* Document-method: recv
|
|
4693
|
+
* the regular expression on the left hand side of the match
|
|
4694
|
+
* operator
|
|
4695
|
+
*/
|
|
4696
|
+
rb_define_method(rb_cMATCH2, "recv", node_recv, 0);
|
|
4697
|
+
rb_ary_push(members, rb_str_new2("recv"));
|
|
4468
4698
|
}
|
|
4469
4699
|
|
|
4470
4700
|
/* Document-class: Node::MATCH3
|
|
@@ -4482,17 +4712,17 @@ void define_node_subclass_methods()
|
|
|
4482
4712
|
rb_iv_set(rb_cMATCH3, "__type__", INT2NUM(NODE_MATCH3));
|
|
4483
4713
|
rb_define_singleton_method(rb_cMATCH3, "members", node_s_members, 0);
|
|
4484
4714
|
|
|
4485
|
-
/* Document-method: recv
|
|
4486
|
-
* the left hand side of the match
|
|
4487
|
-
*/
|
|
4488
|
-
rb_define_method(rb_cMATCH3, "recv", node_recv, 0);
|
|
4489
|
-
rb_ary_push(members, rb_str_new2("recv"));
|
|
4490
|
-
|
|
4491
4715
|
/* Document-method: value
|
|
4492
4716
|
* the right hand side of the match
|
|
4493
4717
|
*/
|
|
4494
4718
|
rb_define_method(rb_cMATCH3, "value", node_value, 0);
|
|
4495
4719
|
rb_ary_push(members, rb_str_new2("value"));
|
|
4720
|
+
|
|
4721
|
+
/* Document-method: recv
|
|
4722
|
+
* the left hand side of the match
|
|
4723
|
+
*/
|
|
4724
|
+
rb_define_method(rb_cMATCH3, "recv", node_recv, 0);
|
|
4725
|
+
rb_ary_push(members, rb_str_new2("recv"));
|
|
4496
4726
|
}
|
|
4497
4727
|
|
|
4498
4728
|
/* Document-class: Node::MEMO
|
|
@@ -4518,6 +4748,30 @@ void define_node_subclass_methods()
|
|
|
4518
4748
|
rb_define_singleton_method(rb_cMEMO, "members", node_s_members, 0);
|
|
4519
4749
|
}
|
|
4520
4750
|
|
|
4751
|
+
/* Document-class: Node::METHOD
|
|
4752
|
+
* A placeholder for a method entry in a class's method table.
|
|
4753
|
+
*/
|
|
4754
|
+
{
|
|
4755
|
+
VALUE rb_cMETHOD = rb_define_class_under(rb_cNode, "METHOD", rb_cNode);
|
|
4756
|
+
members = rb_ary_new();
|
|
4757
|
+
rb_cNodeSubclass[NODE_METHOD] = rb_cMETHOD;
|
|
4758
|
+
rb_iv_set(rb_cMETHOD, "__member__", members);
|
|
4759
|
+
rb_iv_set(rb_cMETHOD, "__type__", INT2NUM(NODE_METHOD));
|
|
4760
|
+
rb_define_singleton_method(rb_cMETHOD, "members", node_s_members, 0);
|
|
4761
|
+
|
|
4762
|
+
/* Document-method: noex
|
|
4763
|
+
* the method's flags
|
|
4764
|
+
*/
|
|
4765
|
+
rb_define_method(rb_cMETHOD, "noex", node_noex, 0);
|
|
4766
|
+
rb_ary_push(members, rb_str_new2("noex"));
|
|
4767
|
+
|
|
4768
|
+
/* Document-method: body
|
|
4769
|
+
* the body of the method
|
|
4770
|
+
*/
|
|
4771
|
+
rb_define_method(rb_cMETHOD, "body", node_body, 0);
|
|
4772
|
+
rb_ary_push(members, rb_str_new2("body"));
|
|
4773
|
+
}
|
|
4774
|
+
|
|
4521
4775
|
/* Document-class: Node::MODULE
|
|
4522
4776
|
* Represents a module definition, e.g.:
|
|
4523
4777
|
* module cpath
|
|
@@ -4550,6 +4804,25 @@ void define_node_subclass_methods()
|
|
|
4550
4804
|
rb_ary_push(members, rb_str_new2("body"));
|
|
4551
4805
|
}
|
|
4552
4806
|
|
|
4807
|
+
/* Document-class: Node::NEWLINE
|
|
4808
|
+
* Represents the termination of a line. This is used for calling
|
|
4809
|
+
* event hooks when a new line of code is reached.
|
|
4810
|
+
*/
|
|
4811
|
+
{
|
|
4812
|
+
VALUE rb_cNEWLINE = rb_define_class_under(rb_cNode, "NEWLINE", rb_cNode);
|
|
4813
|
+
members = rb_ary_new();
|
|
4814
|
+
rb_cNodeSubclass[NODE_NEWLINE] = rb_cNEWLINE;
|
|
4815
|
+
rb_iv_set(rb_cNEWLINE, "__member__", members);
|
|
4816
|
+
rb_iv_set(rb_cNEWLINE, "__type__", INT2NUM(NODE_NEWLINE));
|
|
4817
|
+
rb_define_singleton_method(rb_cNEWLINE, "members", node_s_members, 0);
|
|
4818
|
+
|
|
4819
|
+
/* Document-method: next
|
|
4820
|
+
* the expression on the next line
|
|
4821
|
+
*/
|
|
4822
|
+
rb_define_method(rb_cNEWLINE, "next", node_next, 0);
|
|
4823
|
+
rb_ary_push(members, rb_str_new2("next"));
|
|
4824
|
+
}
|
|
4825
|
+
|
|
4553
4826
|
/* Document-class: Node::NEXT
|
|
4554
4827
|
* Represents the 'next' keyword.
|
|
4555
4828
|
* Causes control to be transferred to the end of the loop, causing the
|
|
@@ -4578,6 +4851,24 @@ void define_node_subclass_methods()
|
|
|
4578
4851
|
rb_define_singleton_method(rb_cNIL, "members", node_s_members, 0);
|
|
4579
4852
|
}
|
|
4580
4853
|
|
|
4854
|
+
/* Document-class: Node::NOT
|
|
4855
|
+
* Represents a logical negation.
|
|
4856
|
+
*/
|
|
4857
|
+
{
|
|
4858
|
+
VALUE rb_cNOT = rb_define_class_under(rb_cNode, "NOT", rb_cNode);
|
|
4859
|
+
members = rb_ary_new();
|
|
4860
|
+
rb_cNodeSubclass[NODE_NOT] = rb_cNOT;
|
|
4861
|
+
rb_iv_set(rb_cNOT, "__member__", members);
|
|
4862
|
+
rb_iv_set(rb_cNOT, "__type__", INT2NUM(NODE_NOT));
|
|
4863
|
+
rb_define_singleton_method(rb_cNOT, "members", node_s_members, 0);
|
|
4864
|
+
|
|
4865
|
+
/* Document-method: body
|
|
4866
|
+
* the value to negate.
|
|
4867
|
+
*/
|
|
4868
|
+
rb_define_method(rb_cNOT, "body", node_body, 0);
|
|
4869
|
+
rb_ary_push(members, rb_str_new2("body"));
|
|
4870
|
+
}
|
|
4871
|
+
|
|
4581
4872
|
/* Document-class: Node::NTH_REF
|
|
4582
4873
|
* Represents the nth match data item, e.g. $1, $2, etc.
|
|
4583
4874
|
*/
|
|
@@ -4652,12 +4943,6 @@ void define_node_subclass_methods()
|
|
|
4652
4943
|
rb_iv_set(rb_cOP_ASGN1, "__type__", INT2NUM(NODE_OP_ASGN1));
|
|
4653
4944
|
rb_define_singleton_method(rb_cOP_ASGN1, "members", node_s_members, 0);
|
|
4654
4945
|
|
|
4655
|
-
/* Document-method: args
|
|
4656
|
-
* the arguments to the assigment
|
|
4657
|
-
*/
|
|
4658
|
-
rb_define_method(rb_cOP_ASGN1, "args", node_args, 0);
|
|
4659
|
-
rb_ary_push(members, rb_str_new2("args"));
|
|
4660
|
-
|
|
4661
4946
|
/* Document-method: mid
|
|
4662
4947
|
* 0, 1, or the name a method to call to calculate the value of the
|
|
4663
4948
|
* rhs
|
|
@@ -4670,6 +4955,12 @@ void define_node_subclass_methods()
|
|
|
4670
4955
|
*/
|
|
4671
4956
|
rb_define_method(rb_cOP_ASGN1, "recv", node_recv, 0);
|
|
4672
4957
|
rb_ary_push(members, rb_str_new2("recv"));
|
|
4958
|
+
|
|
4959
|
+
/* Document-method: args
|
|
4960
|
+
* the arguments to the assigment
|
|
4961
|
+
*/
|
|
4962
|
+
rb_define_method(rb_cOP_ASGN1, "args", node_args, 0);
|
|
4963
|
+
rb_ary_push(members, rb_str_new2("args"));
|
|
4673
4964
|
}
|
|
4674
4965
|
|
|
4675
4966
|
/* Document-class: Node::OP_ASGN2
|
|
@@ -4692,11 +4983,11 @@ void define_node_subclass_methods()
|
|
|
4692
4983
|
rb_iv_set(rb_cOP_ASGN2, "__type__", INT2NUM(NODE_OP_ASGN2));
|
|
4693
4984
|
rb_define_singleton_method(rb_cOP_ASGN2, "members", node_s_members, 0);
|
|
4694
4985
|
|
|
4695
|
-
/* Document-method:
|
|
4696
|
-
* the
|
|
4986
|
+
/* Document-method: value
|
|
4987
|
+
* the value to assign to the attribute
|
|
4697
4988
|
*/
|
|
4698
|
-
rb_define_method(rb_cOP_ASGN2, "
|
|
4699
|
-
rb_ary_push(members, rb_str_new2("
|
|
4989
|
+
rb_define_method(rb_cOP_ASGN2, "value", node_value, 0);
|
|
4990
|
+
rb_ary_push(members, rb_str_new2("value"));
|
|
4700
4991
|
|
|
4701
4992
|
/* Document-method: next
|
|
4702
4993
|
* another node of type OP_ASGN2 which contains more information
|
|
@@ -4705,11 +4996,11 @@ void define_node_subclass_methods()
|
|
|
4705
4996
|
rb_define_method(rb_cOP_ASGN2, "next", node_next, 0);
|
|
4706
4997
|
rb_ary_push(members, rb_str_new2("next"));
|
|
4707
4998
|
|
|
4708
|
-
/* Document-method:
|
|
4709
|
-
* the
|
|
4999
|
+
/* Document-method: recv
|
|
5000
|
+
* the receiver of the attribute
|
|
4710
5001
|
*/
|
|
4711
|
-
rb_define_method(rb_cOP_ASGN2, "
|
|
4712
|
-
rb_ary_push(members, rb_str_new2("
|
|
5002
|
+
rb_define_method(rb_cOP_ASGN2, "recv", node_recv, 0);
|
|
5003
|
+
rb_ary_push(members, rb_str_new2("recv"));
|
|
4713
5004
|
}
|
|
4714
5005
|
|
|
4715
5006
|
/* Document-class: Node::OP_ASGN2_ARG
|
|
@@ -4725,12 +5016,6 @@ void define_node_subclass_methods()
|
|
|
4725
5016
|
rb_iv_set(rb_cOP_ASGN2_ARG, "__type__", INT2NUM(NODE_OP_ASGN2_ARG));
|
|
4726
5017
|
rb_define_singleton_method(rb_cOP_ASGN2_ARG, "members", node_s_members, 0);
|
|
4727
5018
|
|
|
4728
|
-
/* Document-method: vid
|
|
4729
|
-
* The method to call on the receiver to retrieve the attribute
|
|
4730
|
-
*/
|
|
4731
|
-
rb_define_method(rb_cOP_ASGN2_ARG, "vid", node_vid, 0);
|
|
4732
|
-
rb_ary_push(members, rb_str_new2("vid"));
|
|
4733
|
-
|
|
4734
5019
|
/* Document-method: aid
|
|
4735
5020
|
* The method to call on the receiver to set the attribute
|
|
4736
5021
|
*/
|
|
@@ -4744,6 +5029,12 @@ void define_node_subclass_methods()
|
|
|
4744
5029
|
*/
|
|
4745
5030
|
rb_define_method(rb_cOP_ASGN2_ARG, "mid", node_mid, 0);
|
|
4746
5031
|
rb_ary_push(members, rb_str_new2("mid"));
|
|
5032
|
+
|
|
5033
|
+
/* Document-method: vid
|
|
5034
|
+
* The method to call on the receiver to retrieve the attribute
|
|
5035
|
+
*/
|
|
5036
|
+
rb_define_method(rb_cOP_ASGN2_ARG, "vid", node_vid, 0);
|
|
5037
|
+
rb_ary_push(members, rb_str_new2("vid"));
|
|
4747
5038
|
}
|
|
4748
5039
|
|
|
4749
5040
|
/* Document-class: Node::OP_ASGN_AND
|
|
@@ -4762,18 +5053,18 @@ void define_node_subclass_methods()
|
|
|
4762
5053
|
rb_iv_set(rb_cOP_ASGN_AND, "__type__", INT2NUM(NODE_OP_ASGN_AND));
|
|
4763
5054
|
rb_define_singleton_method(rb_cOP_ASGN_AND, "members", node_s_members, 0);
|
|
4764
5055
|
|
|
4765
|
-
/* Document-method: recv
|
|
4766
|
-
* an expression representing the left hand side of the assignment
|
|
4767
|
-
*/
|
|
4768
|
-
rb_define_method(rb_cOP_ASGN_AND, "recv", node_recv, 0);
|
|
4769
|
-
rb_ary_push(members, rb_str_new2("recv"));
|
|
4770
|
-
|
|
4771
5056
|
/* Document-method: value
|
|
4772
5057
|
* an expression representing the assignment that should be
|
|
4773
5058
|
* performed if the left hand side is true
|
|
4774
5059
|
*/
|
|
4775
5060
|
rb_define_method(rb_cOP_ASGN_AND, "value", node_value, 0);
|
|
4776
5061
|
rb_ary_push(members, rb_str_new2("value"));
|
|
5062
|
+
|
|
5063
|
+
/* Document-method: recv
|
|
5064
|
+
* an expression representing the left hand side of the assignment
|
|
5065
|
+
*/
|
|
5066
|
+
rb_define_method(rb_cOP_ASGN_AND, "recv", node_recv, 0);
|
|
5067
|
+
rb_ary_push(members, rb_str_new2("recv"));
|
|
4777
5068
|
}
|
|
4778
5069
|
|
|
4779
5070
|
/* Document-class: Node::OP_ASGN_OR
|
|
@@ -4946,18 +5237,18 @@ void define_node_subclass_methods()
|
|
|
4946
5237
|
rb_iv_set(rb_cRESCUE, "__type__", INT2NUM(NODE_RESCUE));
|
|
4947
5238
|
rb_define_singleton_method(rb_cRESCUE, "members", node_s_members, 0);
|
|
4948
5239
|
|
|
4949
|
-
/* Document-method: head
|
|
4950
|
-
* the body of the block to evaluate
|
|
4951
|
-
*/
|
|
4952
|
-
rb_define_method(rb_cRESCUE, "head", node_head, 0);
|
|
4953
|
-
rb_ary_push(members, rb_str_new2("head"));
|
|
4954
|
-
|
|
4955
5240
|
/* Document-method: resq
|
|
4956
5241
|
* the expression to be evaluated if an exception is raised
|
|
4957
5242
|
*/
|
|
4958
5243
|
rb_define_method(rb_cRESCUE, "resq", node_resq, 0);
|
|
4959
5244
|
rb_ary_push(members, rb_str_new2("resq"));
|
|
4960
5245
|
|
|
5246
|
+
/* Document-method: head
|
|
5247
|
+
* the body of the block to evaluate
|
|
5248
|
+
*/
|
|
5249
|
+
rb_define_method(rb_cRESCUE, "head", node_head, 0);
|
|
5250
|
+
rb_ary_push(members, rb_str_new2("head"));
|
|
5251
|
+
|
|
4961
5252
|
/* Document-method: else
|
|
4962
5253
|
* the expression to be evaluated if no exception is raised
|
|
4963
5254
|
*/
|
|
@@ -5059,18 +5350,18 @@ void define_node_subclass_methods()
|
|
|
5059
5350
|
rb_define_method(rb_cSCOPE, "tbl", node_tbl, 0);
|
|
5060
5351
|
rb_ary_push(members, rb_str_new2("tbl"));
|
|
5061
5352
|
|
|
5353
|
+
/* Document-method: next
|
|
5354
|
+
* the body of the lexical scope
|
|
5355
|
+
*/
|
|
5356
|
+
rb_define_method(rb_cSCOPE, "next", node_next, 0);
|
|
5357
|
+
rb_ary_push(members, rb_str_new2("next"));
|
|
5358
|
+
|
|
5062
5359
|
/* Document-method: rval
|
|
5063
5360
|
* holds information about which class(es) to search for constants
|
|
5064
5361
|
* in this scope
|
|
5065
5362
|
*/
|
|
5066
5363
|
rb_define_method(rb_cSCOPE, "rval", node_rval, 0);
|
|
5067
5364
|
rb_ary_push(members, rb_str_new2("rval"));
|
|
5068
|
-
|
|
5069
|
-
/* Document-method: next
|
|
5070
|
-
* the body of the lexical scope
|
|
5071
|
-
*/
|
|
5072
|
-
rb_define_method(rb_cSCOPE, "next", node_next, 0);
|
|
5073
|
-
rb_ary_push(members, rb_str_new2("next"));
|
|
5074
5365
|
}
|
|
5075
5366
|
|
|
5076
5367
|
/* Document-class: Node::SELF
|
|
@@ -5145,6 +5436,31 @@ void define_node_subclass_methods()
|
|
|
5145
5436
|
rb_ary_push(members, rb_str_new2("args"));
|
|
5146
5437
|
}
|
|
5147
5438
|
|
|
5439
|
+
/* Document-class: Node::SVALUE
|
|
5440
|
+
* Represents the collection of multiple values of the right hand side
|
|
5441
|
+
* of an assignment into a single value, for use in single assignment,
|
|
5442
|
+
* e.g.:
|
|
5443
|
+
* lhs = a, b, c
|
|
5444
|
+
* The argument to this node is an Array.
|
|
5445
|
+
* If it is length 0, returns nil.
|
|
5446
|
+
* If it is length 1, returns the first element in the array.
|
|
5447
|
+
* Otherwise, returns the array.
|
|
5448
|
+
*/
|
|
5449
|
+
{
|
|
5450
|
+
VALUE rb_cSVALUE = rb_define_class_under(rb_cNode, "SVALUE", rb_cNode);
|
|
5451
|
+
members = rb_ary_new();
|
|
5452
|
+
rb_cNodeSubclass[NODE_SVALUE] = rb_cSVALUE;
|
|
5453
|
+
rb_iv_set(rb_cSVALUE, "__member__", members);
|
|
5454
|
+
rb_iv_set(rb_cSVALUE, "__type__", INT2NUM(NODE_SVALUE));
|
|
5455
|
+
rb_define_singleton_method(rb_cSVALUE, "members", node_s_members, 0);
|
|
5456
|
+
|
|
5457
|
+
/* Document-method: head
|
|
5458
|
+
* an expression which returns an Array.
|
|
5459
|
+
*/
|
|
5460
|
+
rb_define_method(rb_cSVALUE, "head", node_head, 0);
|
|
5461
|
+
rb_ary_push(members, rb_str_new2("head"));
|
|
5462
|
+
}
|
|
5463
|
+
|
|
5148
5464
|
/* Document-class: Node::TO_ARY
|
|
5149
5465
|
* Represents a conversion from one object type to an array type.
|
|
5150
5466
|
* Evaluation of this node converts its argument to an array by calling
|
|
@@ -5212,6 +5528,8 @@ void define_node_subclass_methods()
|
|
|
5212
5528
|
rb_iv_set(rb_cUNTIL, "__member__", members);
|
|
5213
5529
|
rb_iv_set(rb_cUNTIL, "__type__", INT2NUM(NODE_UNTIL));
|
|
5214
5530
|
rb_define_singleton_method(rb_cUNTIL, "members", node_s_members, 0);
|
|
5531
|
+
rb_define_method(rb_cUNTIL, "state", node_state, 0);
|
|
5532
|
+
rb_ary_push(members, rb_str_new2("state"));
|
|
5215
5533
|
|
|
5216
5534
|
/* Document-method: body
|
|
5217
5535
|
* the body of the loop
|
|
@@ -5224,8 +5542,6 @@ void define_node_subclass_methods()
|
|
|
5224
5542
|
*/
|
|
5225
5543
|
rb_define_method(rb_cUNTIL, "cond", node_cond, 0);
|
|
5226
5544
|
rb_ary_push(members, rb_str_new2("cond"));
|
|
5227
|
-
rb_define_method(rb_cUNTIL, "state", node_state, 0);
|
|
5228
|
-
rb_ary_push(members, rb_str_new2("state"));
|
|
5229
5545
|
}
|
|
5230
5546
|
|
|
5231
5547
|
/* Document-class: Node::VALIAS
|
|
@@ -5241,10 +5557,10 @@ void define_node_subclass_methods()
|
|
|
5241
5557
|
rb_iv_set(rb_cVALIAS, "__member__", members);
|
|
5242
5558
|
rb_iv_set(rb_cVALIAS, "__type__", INT2NUM(NODE_VALIAS));
|
|
5243
5559
|
rb_define_singleton_method(rb_cVALIAS, "members", node_s_members, 0);
|
|
5244
|
-
rb_define_method(rb_cVALIAS, "first", node_1st, 0);
|
|
5245
|
-
rb_ary_push(members, rb_str_new2("first"));
|
|
5246
5560
|
rb_define_method(rb_cVALIAS, "second", node_2nd, 0);
|
|
5247
5561
|
rb_ary_push(members, rb_str_new2("second"));
|
|
5562
|
+
rb_define_method(rb_cVALIAS, "first", node_1st, 0);
|
|
5563
|
+
rb_ary_push(members, rb_str_new2("first"));
|
|
5248
5564
|
}
|
|
5249
5565
|
|
|
5250
5566
|
/* Document-class: Node::VCALL
|
|
@@ -5304,6 +5620,12 @@ void define_node_subclass_methods()
|
|
|
5304
5620
|
rb_iv_set(rb_cWHEN, "__type__", INT2NUM(NODE_WHEN));
|
|
5305
5621
|
rb_define_singleton_method(rb_cWHEN, "members", node_s_members, 0);
|
|
5306
5622
|
|
|
5623
|
+
/* Document-method: next
|
|
5624
|
+
* the next expression to be evaluated if the condition is false
|
|
5625
|
+
*/
|
|
5626
|
+
rb_define_method(rb_cWHEN, "next", node_next, 0);
|
|
5627
|
+
rb_ary_push(members, rb_str_new2("next"));
|
|
5628
|
+
|
|
5307
5629
|
/* Document-method: head
|
|
5308
5630
|
* a value to compare against, or a condition to be tested
|
|
5309
5631
|
*/
|
|
@@ -5315,12 +5637,6 @@ void define_node_subclass_methods()
|
|
|
5315
5637
|
*/
|
|
5316
5638
|
rb_define_method(rb_cWHEN, "body", node_body, 0);
|
|
5317
5639
|
rb_ary_push(members, rb_str_new2("body"));
|
|
5318
|
-
|
|
5319
|
-
/* Document-method: next
|
|
5320
|
-
* the next expression to be evaluated if the condition is false
|
|
5321
|
-
*/
|
|
5322
|
-
rb_define_method(rb_cWHEN, "next", node_next, 0);
|
|
5323
|
-
rb_ary_push(members, rb_str_new2("next"));
|
|
5324
5640
|
}
|
|
5325
5641
|
|
|
5326
5642
|
/* Document-class: Node::WHILE
|
|
@@ -5336,6 +5652,8 @@ void define_node_subclass_methods()
|
|
|
5336
5652
|
rb_iv_set(rb_cWHILE, "__member__", members);
|
|
5337
5653
|
rb_iv_set(rb_cWHILE, "__type__", INT2NUM(NODE_WHILE));
|
|
5338
5654
|
rb_define_singleton_method(rb_cWHILE, "members", node_s_members, 0);
|
|
5655
|
+
rb_define_method(rb_cWHILE, "state", node_state, 0);
|
|
5656
|
+
rb_ary_push(members, rb_str_new2("state"));
|
|
5339
5657
|
|
|
5340
5658
|
/* Document-method: body
|
|
5341
5659
|
* the body of the loop
|
|
@@ -5348,8 +5666,6 @@ void define_node_subclass_methods()
|
|
|
5348
5666
|
*/
|
|
5349
5667
|
rb_define_method(rb_cWHILE, "cond", node_cond, 0);
|
|
5350
5668
|
rb_ary_push(members, rb_str_new2("cond"));
|
|
5351
|
-
rb_define_method(rb_cWHILE, "state", node_state, 0);
|
|
5352
|
-
rb_ary_push(members, rb_str_new2("state"));
|
|
5353
5669
|
}
|
|
5354
5670
|
|
|
5355
5671
|
/* Document-class: Node::XSTR
|
|
@@ -5386,17 +5702,17 @@ void define_node_subclass_methods()
|
|
|
5386
5702
|
rb_iv_set(rb_cYIELD, "__type__", INT2NUM(NODE_YIELD));
|
|
5387
5703
|
rb_define_singleton_method(rb_cYIELD, "members", node_s_members, 0);
|
|
5388
5704
|
|
|
5389
|
-
/* Document-method: head
|
|
5390
|
-
* the value to yield
|
|
5391
|
-
*/
|
|
5392
|
-
rb_define_method(rb_cYIELD, "head", node_head, 0);
|
|
5393
|
-
rb_ary_push(members, rb_str_new2("head"));
|
|
5394
|
-
|
|
5395
5705
|
/* Document-method: state
|
|
5396
5706
|
* if nonzero, splats the value before yielding
|
|
5397
5707
|
*/
|
|
5398
5708
|
rb_define_method(rb_cYIELD, "state", node_state, 0);
|
|
5399
5709
|
rb_ary_push(members, rb_str_new2("state"));
|
|
5710
|
+
|
|
5711
|
+
/* Document-method: head
|
|
5712
|
+
* the value to yield
|
|
5713
|
+
*/
|
|
5714
|
+
rb_define_method(rb_cYIELD, "head", node_head, 0);
|
|
5715
|
+
rb_ary_push(members, rb_str_new2("head"));
|
|
5400
5716
|
}
|
|
5401
5717
|
|
|
5402
5718
|
/* Document-class: Node::ZARRAY
|