kanayago 0.1.1 → 0.2.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.
- checksums.yaml +4 -4
 - data/.rubocop.yml +12 -0
 - data/.ruby-version +1 -0
 - data/README.md +20 -29
 - data/Rakefile +43 -96
 - data/ext/kanayago/extconf.rb +6 -0
 - data/ext/kanayago/id.h +12 -5
 - data/ext/kanayago/id_table.h +15 -0
 - data/ext/kanayago/include/ruby/st.h +199 -0
 - data/ext/kanayago/internal/array.h +3 -0
 - data/ext/kanayago/internal/basic_operators.h +1 -0
 - data/ext/kanayago/internal/bignum.h +1 -0
 - data/ext/kanayago/internal/bits.h +82 -0
 - data/ext/kanayago/internal/encoding.h +4 -1
 - data/ext/kanayago/internal/error.h +33 -0
 - data/ext/kanayago/internal/fixnum.h +1 -0
 - data/ext/kanayago/internal/gc.h +47 -11
 - data/ext/kanayago/internal/hash.h +3 -0
 - data/ext/kanayago/internal/imemo.h +93 -32
 - data/ext/kanayago/internal/io.h +30 -7
 - data/ext/kanayago/internal/namespace.h +81 -0
 - data/ext/kanayago/internal/numeric.h +1 -0
 - data/ext/kanayago/internal/parse.h +17 -3
 - data/ext/kanayago/internal/re.h +7 -2
 - data/ext/kanayago/internal/sanitizers.h +88 -39
 - data/ext/kanayago/internal/set_table.h +70 -0
 - data/ext/kanayago/internal/string.h +33 -16
 - data/ext/kanayago/internal/symbol.h +4 -3
 - data/ext/kanayago/internal/thread.h +42 -9
 - data/ext/kanayago/internal/variable.h +13 -11
 - data/ext/kanayago/internal/vm.h +4 -5
 - data/ext/kanayago/internal.h +0 -3
 - data/ext/kanayago/kanayago.c +554 -235
 - data/ext/kanayago/kanayago.h +5 -0
 - data/ext/kanayago/literal_node.c +343 -0
 - data/ext/kanayago/literal_node.h +30 -0
 - data/ext/kanayago/method.h +18 -2
 - data/ext/kanayago/node.c +7 -1
 - data/ext/kanayago/node.h +14 -3
 - data/ext/kanayago/parse.c +7602 -7156
 - data/ext/kanayago/parse.h +39 -39
 - data/ext/kanayago/parser_st.c +2 -1
 - data/ext/kanayago/pattern_node.c +78 -0
 - data/ext/kanayago/pattern_node.h +13 -0
 - data/ext/kanayago/ruby_atomic.h +43 -0
 - data/ext/kanayago/ruby_parser.c +7 -35
 - data/ext/kanayago/rubyparser.h +83 -80
 - data/ext/kanayago/scope_node.c +34 -0
 - data/ext/kanayago/scope_node.h +8 -0
 - data/ext/kanayago/shape.h +321 -111
 - data/ext/kanayago/st.c +905 -21
 - data/ext/kanayago/statement_node.c +795 -0
 - data/ext/kanayago/statement_node.h +66 -0
 - data/ext/kanayago/string_node.c +192 -0
 - data/ext/kanayago/string_node.h +19 -0
 - data/ext/kanayago/symbol.h +2 -9
 - data/ext/kanayago/thread_pthread.h +10 -3
 - data/ext/kanayago/universal_parser.c +1 -20
 - data/ext/kanayago/variable_node.c +72 -0
 - data/ext/kanayago/variable_node.h +12 -0
 - data/ext/kanayago/vm_core.h +205 -71
 - data/lib/kanayago/literal_node.rb +87 -0
 - data/lib/kanayago/pattern_node.rb +19 -0
 - data/lib/kanayago/statement_node.rb +222 -0
 - data/lib/kanayago/string_node.rb +43 -0
 - data/lib/kanayago/variable_node.rb +23 -0
 - data/lib/kanayago/version.rb +1 -1
 - data/lib/kanayago.rb +22 -0
 - data/patch/3.4/copy_target.rb +78 -0
 - data/patch/3.4/kanayago.patch +162 -0
 - data/patch/head/copy_target.rb +84 -0
 - data/patch/head/kanayago.patch +162 -0
 - data/sample/minitest_generator.rb +266 -0
 - data/sample/test_generator.rb +272 -0
 - data/typeprof.conf.json +9 -0
 - metadata +32 -4
 - data/ext/kanayago/parse.tmp.y +0 -16145
 
    
        data/ext/kanayago/kanayago.h
    CHANGED
    
    
| 
         @@ -0,0 +1,343 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #include "literal_node.h"
         
     | 
| 
      
 2 
     | 
    
         
            +
            #include "internal/ruby_parser.h"
         
     | 
| 
      
 3 
     | 
    
         
            +
            #include "kanayago.h"
         
     | 
| 
      
 4 
     | 
    
         
            +
            #include "internal/encoding.h"
         
     | 
| 
      
 5 
     | 
    
         
            +
            #include "rubyparser.h"
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            VALUE rb_cIntegerNode;
         
     | 
| 
      
 8 
     | 
    
         
            +
            VALUE rb_cFloatNode;
         
     | 
| 
      
 9 
     | 
    
         
            +
            VALUE rb_cRationalNode;
         
     | 
| 
      
 10 
     | 
    
         
            +
            VALUE rb_cImaginaryNode;
         
     | 
| 
      
 11 
     | 
    
         
            +
            VALUE rb_cStringNode;
         
     | 
| 
      
 12 
     | 
    
         
            +
            VALUE rb_cSymbolNode;
         
     | 
| 
      
 13 
     | 
    
         
            +
            VALUE rb_cZeroListNode;
         
     | 
| 
      
 14 
     | 
    
         
            +
            VALUE rb_cFileNode;
         
     | 
| 
      
 15 
     | 
    
         
            +
            VALUE rb_cLineNode;
         
     | 
| 
      
 16 
     | 
    
         
            +
            VALUE rb_cEncodingNode;
         
     | 
| 
      
 17 
     | 
    
         
            +
            VALUE rb_cNilNode;
         
     | 
| 
      
 18 
     | 
    
         
            +
            VALUE rb_cTrueNode;
         
     | 
| 
      
 19 
     | 
    
         
            +
            VALUE rb_cFalseNode;
         
     | 
| 
      
 20 
     | 
    
         
            +
            VALUE rb_cRangeNode;
         
     | 
| 
      
 21 
     | 
    
         
            +
            VALUE rb_cExclusiveRangeNode;
         
     | 
| 
      
 22 
     | 
    
         
            +
            VALUE rb_cFlipFlopNode;
         
     | 
| 
      
 23 
     | 
    
         
            +
            VALUE rb_cExclusiveFlipFlopNode;
         
     | 
| 
      
 24 
     | 
    
         
            +
            VALUE rb_cHashNode;
         
     | 
| 
      
 25 
     | 
    
         
            +
            VALUE rb_cNthRefNode;
         
     | 
| 
      
 26 
     | 
    
         
            +
            VALUE rb_cBackRefNode;
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 29 
     | 
    
         
            +
            integer_node_new(const NODE *node)
         
     | 
| 
      
 30 
     | 
    
         
            +
            {
         
     | 
| 
      
 31 
     | 
    
         
            +
                VALUE result = rb_class_new_instance(0, 0, rb_cIntegerNode);
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@val"), rb_node_integer_literal_val(node));
         
     | 
| 
      
 34 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@minus"), RNODE_INTEGER(node)->minus == TRUE ? Qtrue : Qfalse);
         
     | 
| 
      
 35 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@base"), INT2FIX(RNODE_INTEGER(node)->base));
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                return result;
         
     | 
| 
      
 38 
     | 
    
         
            +
            }
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 41 
     | 
    
         
            +
            float_node_new(const NODE *node)
         
     | 
| 
      
 42 
     | 
    
         
            +
            {
         
     | 
| 
      
 43 
     | 
    
         
            +
                VALUE result = rb_class_new_instance(0, 0, rb_cFloatNode);
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@val"), rb_node_float_literal_val(node));
         
     | 
| 
      
 46 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@minus"), RNODE_FLOAT(node)->minus == TRUE ? Qtrue : Qfalse);
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                return result;
         
     | 
| 
      
 49 
     | 
    
         
            +
            }
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 52 
     | 
    
         
            +
            rational_node_new(const NODE *node)
         
     | 
| 
      
 53 
     | 
    
         
            +
            {
         
     | 
| 
      
 54 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cRationalNode);
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@val"), rb_node_rational_literal_val(node));
         
     | 
| 
      
 57 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@minus"), RNODE_RATIONAL(node)->minus == TRUE ? Qtrue : Qfalse);
         
     | 
| 
      
 58 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@base"), INT2FIX(RNODE_RATIONAL(node)->base));
         
     | 
| 
      
 59 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@seen_point"), INT2FIX(RNODE_RATIONAL(node)->seen_point));
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 62 
     | 
    
         
            +
            }
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 65 
     | 
    
         
            +
            parser_string_coderange_type_to_str(enum rb_parser_string_coderange_type coderange)
         
     | 
| 
      
 66 
     | 
    
         
            +
            {
         
     | 
| 
      
 67 
     | 
    
         
            +
                switch (coderange) {
         
     | 
| 
      
 68 
     | 
    
         
            +
                  case RB_PARSER_ENC_CODERANGE_UNKNOWN:
         
     | 
| 
      
 69 
     | 
    
         
            +
                    return rb_str_new_cstr("RB_PARSER_ENC_CODERANGE_UNKNOWN");
         
     | 
| 
      
 70 
     | 
    
         
            +
                  case RB_PARSER_ENC_CODERANGE_7BIT:
         
     | 
| 
      
 71 
     | 
    
         
            +
            	return rb_str_new_cstr("RB_PARSER_ENC_CODERANGE_7BIT");
         
     | 
| 
      
 72 
     | 
    
         
            +
                  case RB_PARSER_ENC_CODERANGE_VALID:
         
     | 
| 
      
 73 
     | 
    
         
            +
            	return rb_str_new_cstr("RB_PARSER_ENC_CODERANGE_VALID");
         
     | 
| 
      
 74 
     | 
    
         
            +
                  case RB_PARSER_ENC_CODERANGE_BROKEN:
         
     | 
| 
      
 75 
     | 
    
         
            +
            	return rb_str_new_cstr("RB_PARSER_ENC_CODERANGE_BROKEN");
         
     | 
| 
      
 76 
     | 
    
         
            +
                }
         
     | 
| 
      
 77 
     | 
    
         
            +
                return Qnil;
         
     | 
| 
      
 78 
     | 
    
         
            +
            }
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 81 
     | 
    
         
            +
            numeric_type_to_str(enum rb_numeric_type type)
         
     | 
| 
      
 82 
     | 
    
         
            +
            {
         
     | 
| 
      
 83 
     | 
    
         
            +
                switch (type) {
         
     | 
| 
      
 84 
     | 
    
         
            +
                  case integer_literal:
         
     | 
| 
      
 85 
     | 
    
         
            +
                    return rb_str_new_cstr("integer_literal");
         
     | 
| 
      
 86 
     | 
    
         
            +
                  case float_literal:
         
     | 
| 
      
 87 
     | 
    
         
            +
            	return rb_str_new_cstr("float_literal");
         
     | 
| 
      
 88 
     | 
    
         
            +
                  case rational_literal:
         
     | 
| 
      
 89 
     | 
    
         
            +
            	return rb_str_new_cstr("rational_literal");
         
     | 
| 
      
 90 
     | 
    
         
            +
                }
         
     | 
| 
      
 91 
     | 
    
         
            +
                return Qnil;
         
     | 
| 
      
 92 
     | 
    
         
            +
            }
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 95 
     | 
    
         
            +
            imaginary_node_new(const NODE *node)
         
     | 
| 
      
 96 
     | 
    
         
            +
            {
         
     | 
| 
      
 97 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cImaginaryNode);
         
     | 
| 
      
 98 
     | 
    
         
            +
                enum rb_numeric_type type = RNODE_IMAGINARY(node)->type;
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@val"), rb_node_imaginary_literal_val(node));
         
     | 
| 
      
 101 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@minus"), RNODE_IMAGINARY(node)->minus == TRUE ? Qtrue : Qfalse);
         
     | 
| 
      
 102 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@base"), INT2FIX(RNODE_IMAGINARY(node)->base));
         
     | 
| 
      
 103 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@seen_point"), INT2FIX(RNODE_IMAGINARY(node)->seen_point));
         
     | 
| 
      
 104 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@type"), numeric_type_to_str(type));
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 107 
     | 
    
         
            +
            }
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 110 
     | 
    
         
            +
            string_node_new(const NODE *node)
         
     | 
| 
      
 111 
     | 
    
         
            +
            {
         
     | 
| 
      
 112 
     | 
    
         
            +
                VALUE result = rb_class_new_instance(0, 0, rb_cStringNode);
         
     | 
| 
      
 113 
     | 
    
         
            +
                rb_parser_string_t *str = RNODE_STR(node)->string;
         
     | 
| 
      
 114 
     | 
    
         
            +
                rb_encoding *enc = str->enc;
         
     | 
| 
      
 115 
     | 
    
         
            +
                char *ptr = str->ptr;
         
     | 
| 
      
 116 
     | 
    
         
            +
                long len = str->len;
         
     | 
| 
      
 117 
     | 
    
         
            +
                enum rb_parser_string_coderange_type conderange = str->coderange;
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@ptr"), rb_enc_str_new(ptr, len, enc));
         
     | 
| 
      
 120 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@len"), LONG2FIX(len));
         
     | 
| 
      
 121 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@enc"), rb_enc_from_encoding(enc));
         
     | 
| 
      
 122 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@coderange"), parser_string_coderange_type_to_str(conderange));
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
                return result;
         
     | 
| 
      
 125 
     | 
    
         
            +
            }
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 128 
     | 
    
         
            +
            symbol_node_new(const NODE *node)
         
     | 
| 
      
 129 
     | 
    
         
            +
            {
         
     | 
| 
      
 130 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cSymbolNode);
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
                rb_parser_string_t *str = RNODE_SYM(node)->string;
         
     | 
| 
      
 133 
     | 
    
         
            +
                rb_encoding *enc = str->enc;
         
     | 
| 
      
 134 
     | 
    
         
            +
                char *ptr = str->ptr;
         
     | 
| 
      
 135 
     | 
    
         
            +
                long len = str->len;
         
     | 
| 
      
 136 
     | 
    
         
            +
                enum rb_parser_string_coderange_type conderange = str->coderange;
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@ptr"), rb_enc_str_new(ptr, len, enc));
         
     | 
| 
      
 139 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@len"), LONG2FIX(len));
         
     | 
| 
      
 140 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@enc"), rb_enc_from_encoding(enc));
         
     | 
| 
      
 141 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@coderange"), parser_string_coderange_type_to_str(conderange));
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 144 
     | 
    
         
            +
            }
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 147 
     | 
    
         
            +
            zero_list_node_new(const NODE *node)
         
     | 
| 
      
 148 
     | 
    
         
            +
            {
         
     | 
| 
      
 149 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cZeroListNode);
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
      
 151 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@len"), INT2FIX(0));
         
     | 
| 
      
 152 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@val"), rb_ary_new());
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 155 
     | 
    
         
            +
            }
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 158 
     | 
    
         
            +
            file_node_new(const NODE *node)
         
     | 
| 
      
 159 
     | 
    
         
            +
            {
         
     | 
| 
      
 160 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cFileNode);
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
                rb_parser_string_t *str = RNODE_FILE(node)->path;
         
     | 
| 
      
 163 
     | 
    
         
            +
                rb_encoding *enc = str->enc;
         
     | 
| 
      
 164 
     | 
    
         
            +
                char *ptr = str->ptr;
         
     | 
| 
      
 165 
     | 
    
         
            +
                long len = str->len;
         
     | 
| 
      
 166 
     | 
    
         
            +
                enum rb_parser_string_coderange_type conderange = str->coderange;
         
     | 
| 
      
 167 
     | 
    
         
            +
             
     | 
| 
      
 168 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@ptr"), rb_enc_str_new(ptr, len, enc));
         
     | 
| 
      
 169 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@len"), LONG2FIX(len));
         
     | 
| 
      
 170 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@enc"), rb_enc_from_encoding(enc));
         
     | 
| 
      
 171 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@coderange"), parser_string_coderange_type_to_str(conderange));
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 174 
     | 
    
         
            +
            }
         
     | 
| 
      
 175 
     | 
    
         
            +
             
     | 
| 
      
 176 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 177 
     | 
    
         
            +
            line_node_new(const NODE *node)
         
     | 
| 
      
 178 
     | 
    
         
            +
            {
         
     | 
| 
      
 179 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cLineNode);
         
     | 
| 
      
 180 
     | 
    
         
            +
             
     | 
| 
      
 181 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@lineno"), INT2FIX(node->nd_loc.beg_pos.lineno));
         
     | 
| 
      
 182 
     | 
    
         
            +
             
     | 
| 
      
 183 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 184 
     | 
    
         
            +
            }
         
     | 
| 
      
 185 
     | 
    
         
            +
             
     | 
| 
      
 186 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 187 
     | 
    
         
            +
            encoding_node_new(const NODE *node)
         
     | 
| 
      
 188 
     | 
    
         
            +
            {
         
     | 
| 
      
 189 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cEncodingNode);
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@val"), rb_enc_from_encoding(RNODE_ENCODING(node)->enc));
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 194 
     | 
    
         
            +
            }
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
      
 196 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 197 
     | 
    
         
            +
            nil_node_new(const NODE *node)
         
     | 
| 
      
 198 
     | 
    
         
            +
            {
         
     | 
| 
      
 199 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cNilNode);
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@val"), Qnil);
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 204 
     | 
    
         
            +
            }
         
     | 
| 
      
 205 
     | 
    
         
            +
             
     | 
| 
      
 206 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 207 
     | 
    
         
            +
            true_node_new(const NODE *node)
         
     | 
| 
      
 208 
     | 
    
         
            +
            {
         
     | 
| 
      
 209 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cTrueNode);
         
     | 
| 
      
 210 
     | 
    
         
            +
             
     | 
| 
      
 211 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@val"), Qtrue);
         
     | 
| 
      
 212 
     | 
    
         
            +
             
     | 
| 
      
 213 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 214 
     | 
    
         
            +
            }
         
     | 
| 
      
 215 
     | 
    
         
            +
             
     | 
| 
      
 216 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 217 
     | 
    
         
            +
            false_node_new(const NODE *node)
         
     | 
| 
      
 218 
     | 
    
         
            +
            {
         
     | 
| 
      
 219 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cFalseNode);
         
     | 
| 
      
 220 
     | 
    
         
            +
             
     | 
| 
      
 221 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@val"), Qfalse);
         
     | 
| 
      
 222 
     | 
    
         
            +
             
     | 
| 
      
 223 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 224 
     | 
    
         
            +
            }
         
     | 
| 
      
 225 
     | 
    
         
            +
             
     | 
| 
      
 226 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 227 
     | 
    
         
            +
            range_node_new(const NODE *node)
         
     | 
| 
      
 228 
     | 
    
         
            +
            {
         
     | 
| 
      
 229 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cRangeNode);
         
     | 
| 
      
 230 
     | 
    
         
            +
             
     | 
| 
      
 231 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@beg"), ast_to_node_instance(RNODE_DOT2(node)->nd_beg));
         
     | 
| 
      
 232 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@end"), ast_to_node_instance(RNODE_DOT2(node)->nd_end));
         
     | 
| 
      
 233 
     | 
    
         
            +
             
     | 
| 
      
 234 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 235 
     | 
    
         
            +
            }
         
     | 
| 
      
 236 
     | 
    
         
            +
             
     | 
| 
      
 237 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 238 
     | 
    
         
            +
            exclusive_range_node_new(const NODE *node)
         
     | 
| 
      
 239 
     | 
    
         
            +
            {
         
     | 
| 
      
 240 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cExclusiveRangeNode);
         
     | 
| 
      
 241 
     | 
    
         
            +
             
     | 
| 
      
 242 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@beg"), ast_to_node_instance(RNODE_DOT3(node)->nd_beg));
         
     | 
| 
      
 243 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@end"), ast_to_node_instance(RNODE_DOT3(node)->nd_end));
         
     | 
| 
      
 244 
     | 
    
         
            +
             
     | 
| 
      
 245 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 246 
     | 
    
         
            +
            }
         
     | 
| 
      
 247 
     | 
    
         
            +
             
     | 
| 
      
 248 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 249 
     | 
    
         
            +
            flip_flop_node_new(const NODE *node)
         
     | 
| 
      
 250 
     | 
    
         
            +
            {
         
     | 
| 
      
 251 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cFlipFlopNode);
         
     | 
| 
      
 252 
     | 
    
         
            +
             
     | 
| 
      
 253 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@beg"), ast_to_node_instance(RNODE_FLIP2(node)->nd_beg));
         
     | 
| 
      
 254 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@end"), ast_to_node_instance(RNODE_FLIP2(node)->nd_end));
         
     | 
| 
      
 255 
     | 
    
         
            +
             
     | 
| 
      
 256 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 257 
     | 
    
         
            +
            }
         
     | 
| 
      
 258 
     | 
    
         
            +
             
     | 
| 
      
 259 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 260 
     | 
    
         
            +
            exclusive_flip_flop_node_new(const NODE *node)
         
     | 
| 
      
 261 
     | 
    
         
            +
            {
         
     | 
| 
      
 262 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cExclusiveFlipFlopNode);
         
     | 
| 
      
 263 
     | 
    
         
            +
             
     | 
| 
      
 264 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@beg"), ast_to_node_instance(RNODE_FLIP3(node)->nd_beg));
         
     | 
| 
      
 265 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@end"), ast_to_node_instance(RNODE_FLIP3(node)->nd_end));
         
     | 
| 
      
 266 
     | 
    
         
            +
             
     | 
| 
      
 267 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 268 
     | 
    
         
            +
            }
         
     | 
| 
      
 269 
     | 
    
         
            +
             
     | 
| 
      
 270 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 271 
     | 
    
         
            +
            hash_node_new(const NODE *node)
         
     | 
| 
      
 272 
     | 
    
         
            +
            {
         
     | 
| 
      
 273 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cHashNode);
         
     | 
| 
      
 274 
     | 
    
         
            +
             
     | 
| 
      
 275 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@head"), ast_to_node_instance(RNODE_HASH(node)->nd_head));
         
     | 
| 
      
 276 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@brace"), RNODE_HASH(node)->nd_brace ? Qtrue : Qfalse);
         
     | 
| 
      
 277 
     | 
    
         
            +
             
     | 
| 
      
 278 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 279 
     | 
    
         
            +
            }
         
     | 
| 
      
 280 
     | 
    
         
            +
             
     | 
| 
      
 281 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 282 
     | 
    
         
            +
            nth_ref_node_new(const NODE *node)
         
     | 
| 
      
 283 
     | 
    
         
            +
            {
         
     | 
| 
      
 284 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cNthRefNode);
         
     | 
| 
      
 285 
     | 
    
         
            +
             
     | 
| 
      
 286 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@nth"), LONG2NUM(RNODE_NTH_REF(node)->nd_nth));
         
     | 
| 
      
 287 
     | 
    
         
            +
             
     | 
| 
      
 288 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 289 
     | 
    
         
            +
            }
         
     | 
| 
      
 290 
     | 
    
         
            +
             
     | 
| 
      
 291 
     | 
    
         
            +
            VALUE
         
     | 
| 
      
 292 
     | 
    
         
            +
            back_ref_node_new(const NODE *node)
         
     | 
| 
      
 293 
     | 
    
         
            +
            {
         
     | 
| 
      
 294 
     | 
    
         
            +
                VALUE obj = rb_class_new_instance(0, 0, rb_cBackRefNode);
         
     | 
| 
      
 295 
     | 
    
         
            +
             
     | 
| 
      
 296 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@nth"), LONG2NUM(RNODE_BACK_REF(node)->nd_nth));
         
     | 
| 
      
 297 
     | 
    
         
            +
             
     | 
| 
      
 298 
     | 
    
         
            +
                return obj;
         
     | 
| 
      
 299 
     | 
    
         
            +
            }
         
     | 
| 
      
 300 
     | 
    
         
            +
             
     | 
| 
      
 301 
     | 
    
         
            +
            void
         
     | 
| 
      
 302 
     | 
    
         
            +
            Init_LiteralNode(VALUE module)
         
     | 
| 
      
 303 
     | 
    
         
            +
            {
         
     | 
| 
      
 304 
     | 
    
         
            +
                rb_cIntegerNode = rb_define_class_under(module, "IntegerNode", rb_cObject);
         
     | 
| 
      
 305 
     | 
    
         
            +
             
     | 
| 
      
 306 
     | 
    
         
            +
                rb_cFloatNode = rb_define_class_under(module, "FloatNode", rb_cObject);
         
     | 
| 
      
 307 
     | 
    
         
            +
             
     | 
| 
      
 308 
     | 
    
         
            +
                rb_cRationalNode = rb_define_class_under(module, "RationalNode", rb_cObject);
         
     | 
| 
      
 309 
     | 
    
         
            +
             
     | 
| 
      
 310 
     | 
    
         
            +
                rb_cImaginaryNode = rb_define_class_under(module, "ImaginaryNode", rb_cObject);
         
     | 
| 
      
 311 
     | 
    
         
            +
             
     | 
| 
      
 312 
     | 
    
         
            +
                rb_cStringNode = rb_define_class_under(module, "StringNode", rb_cObject);
         
     | 
| 
      
 313 
     | 
    
         
            +
             
     | 
| 
      
 314 
     | 
    
         
            +
                rb_cSymbolNode = rb_define_class_under(module, "SymbolNode", rb_cObject);
         
     | 
| 
      
 315 
     | 
    
         
            +
             
     | 
| 
      
 316 
     | 
    
         
            +
                rb_cZeroListNode = rb_define_class_under(module, "ZeroListNode", rb_cObject);
         
     | 
| 
      
 317 
     | 
    
         
            +
             
     | 
| 
      
 318 
     | 
    
         
            +
                rb_cFileNode = rb_define_class_under(module, "FileNode", rb_cObject);
         
     | 
| 
      
 319 
     | 
    
         
            +
             
     | 
| 
      
 320 
     | 
    
         
            +
                rb_cLineNode = rb_define_class_under(module, "LineNode", rb_cObject);
         
     | 
| 
      
 321 
     | 
    
         
            +
             
     | 
| 
      
 322 
     | 
    
         
            +
                rb_cEncodingNode = rb_define_class_under(module, "EncodingNode", rb_cObject);
         
     | 
| 
      
 323 
     | 
    
         
            +
             
     | 
| 
      
 324 
     | 
    
         
            +
                rb_cNilNode = rb_define_class_under(module, "NilNode", rb_cObject);
         
     | 
| 
      
 325 
     | 
    
         
            +
             
     | 
| 
      
 326 
     | 
    
         
            +
                rb_cTrueNode = rb_define_class_under(module, "TrueNode", rb_cObject);
         
     | 
| 
      
 327 
     | 
    
         
            +
             
     | 
| 
      
 328 
     | 
    
         
            +
                rb_cFalseNode = rb_define_class_under(module, "FalseNode", rb_cObject);
         
     | 
| 
      
 329 
     | 
    
         
            +
             
     | 
| 
      
 330 
     | 
    
         
            +
                rb_cRangeNode = rb_define_class_under(module, "RangeNode", rb_cObject);
         
     | 
| 
      
 331 
     | 
    
         
            +
             
     | 
| 
      
 332 
     | 
    
         
            +
                rb_cExclusiveRangeNode = rb_define_class_under(module, "ExclusiveRangeNode", rb_cObject);
         
     | 
| 
      
 333 
     | 
    
         
            +
             
     | 
| 
      
 334 
     | 
    
         
            +
                rb_cFlipFlopNode = rb_define_class_under(module, "FlipFlopNode", rb_cObject);
         
     | 
| 
      
 335 
     | 
    
         
            +
             
     | 
| 
      
 336 
     | 
    
         
            +
                rb_cExclusiveFlipFlopNode = rb_define_class_under(module, "ExclusiveFlipFlopNode", rb_cObject);
         
     | 
| 
      
 337 
     | 
    
         
            +
             
     | 
| 
      
 338 
     | 
    
         
            +
                rb_cHashNode = rb_define_class_under(module, "HashNode", rb_cObject);
         
     | 
| 
      
 339 
     | 
    
         
            +
             
     | 
| 
      
 340 
     | 
    
         
            +
                rb_cNthRefNode = rb_define_class_under(module, "NthRefNode", rb_cObject);
         
     | 
| 
      
 341 
     | 
    
         
            +
             
     | 
| 
      
 342 
     | 
    
         
            +
                rb_cBackRefNode = rb_define_class_under(module, "BackRefNode", rb_cObject);
         
     | 
| 
      
 343 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #ifndef KANAYAGO_LITERAL_NODE_H
         
     | 
| 
      
 2 
     | 
    
         
            +
            #define KANAYAGO_LITERAL_NODE_H
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            #include "internal/ruby_parser.h"
         
     | 
| 
      
 5 
     | 
    
         
            +
            #include "kanayago.h"
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            VALUE integer_node_new(const NODE *);
         
     | 
| 
      
 8 
     | 
    
         
            +
            VALUE float_node_new(const NODE *);
         
     | 
| 
      
 9 
     | 
    
         
            +
            VALUE rational_node_new(const NODE *);
         
     | 
| 
      
 10 
     | 
    
         
            +
            VALUE imaginary_node_new(const NODE *);
         
     | 
| 
      
 11 
     | 
    
         
            +
            VALUE symbol_node_new(const NODE *);
         
     | 
| 
      
 12 
     | 
    
         
            +
            VALUE string_node_new(const NODE *);
         
     | 
| 
      
 13 
     | 
    
         
            +
            VALUE zero_list_node_new(const NODE *);
         
     | 
| 
      
 14 
     | 
    
         
            +
            VALUE file_node_new(const NODE *node);
         
     | 
| 
      
 15 
     | 
    
         
            +
            VALUE line_node_new(const NODE *);
         
     | 
| 
      
 16 
     | 
    
         
            +
            VALUE encoding_node_new(const NODE *);
         
     | 
| 
      
 17 
     | 
    
         
            +
            VALUE nil_node_new(const NODE *);
         
     | 
| 
      
 18 
     | 
    
         
            +
            VALUE true_node_new(const NODE *);
         
     | 
| 
      
 19 
     | 
    
         
            +
            VALUE false_node_new(const NODE *);
         
     | 
| 
      
 20 
     | 
    
         
            +
            VALUE range_node_new(const NODE *);
         
     | 
| 
      
 21 
     | 
    
         
            +
            VALUE exclusive_range_node_new(const NODE *);
         
     | 
| 
      
 22 
     | 
    
         
            +
            VALUE flip_flop_node_new(const NODE *);
         
     | 
| 
      
 23 
     | 
    
         
            +
            VALUE exclusive_flip_flop_node_new(const NODE *);
         
     | 
| 
      
 24 
     | 
    
         
            +
            VALUE hash_node_new(const NODE *);
         
     | 
| 
      
 25 
     | 
    
         
            +
            VALUE nth_ref_node_new(const NODE *);
         
     | 
| 
      
 26 
     | 
    
         
            +
            VALUE back_ref_node_new(const NODE *);
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            void Init_LiteralNode(VALUE);
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            #endif
         
     | 
    
        data/ext/kanayago/method.h
    CHANGED
    
    | 
         @@ -15,6 +15,7 @@ 
     | 
|
| 
       15 
15 
     | 
    
         
             
            #include "internal/imemo.h"
         
     | 
| 
       16 
16 
     | 
    
         
             
            #include "internal/compilers.h"
         
     | 
| 
       17 
17 
     | 
    
         
             
            #include "internal/static_assert.h"
         
     | 
| 
      
 18 
     | 
    
         
            +
            #include "ruby/atomic.h"
         
     | 
| 
       18 
19 
     | 
    
         | 
| 
       19 
20 
     | 
    
         
             
            #ifndef END_OF_ENUMERATION
         
     | 
| 
       20 
21 
     | 
    
         
             
            # if defined(__GNUC__) &&! defined(__STRICT_ANSI__)
         
     | 
| 
         @@ -72,10 +73,17 @@ typedef struct rb_callable_method_entry_struct { /* same fields with rb_method_e 
     | 
|
| 
       72 
73 
     | 
    
         
             
            #define METHOD_ENTRY_COMPLEMENTED(me)        ((me)->flags & IMEMO_FL_USER3)
         
     | 
| 
       73 
74 
     | 
    
         
             
            #define METHOD_ENTRY_COMPLEMENTED_SET(me)    ((me)->flags |= IMEMO_FL_USER3)
         
     | 
| 
       74 
75 
     | 
    
         
             
            #define METHOD_ENTRY_CACHED(me)              ((me)->flags & IMEMO_FL_USER4)
         
     | 
| 
       75 
     | 
    
         
            -
            #define METHOD_ENTRY_CACHED_SET(me)          ((me)->flags |= IMEMO_FL_USER4)
         
     | 
| 
       76 
76 
     | 
    
         
             
            #define METHOD_ENTRY_INVALIDATED(me)         ((me)->flags & IMEMO_FL_USER5)
         
     | 
| 
       77 
77 
     | 
    
         
             
            #define METHOD_ENTRY_INVALIDATED_SET(me)     ((me)->flags |= IMEMO_FL_USER5)
         
     | 
| 
       78 
78 
     | 
    
         | 
| 
      
 79 
     | 
    
         
            +
            static inline void
         
     | 
| 
      
 80 
     | 
    
         
            +
            METHOD_ENTRY_CACHED_SET(rb_callable_method_entry_t *me)
         
     | 
| 
      
 81 
     | 
    
         
            +
            {
         
     | 
| 
      
 82 
     | 
    
         
            +
                if (!METHOD_ENTRY_CACHED(me)) {
         
     | 
| 
      
 83 
     | 
    
         
            +
                    me->flags |= IMEMO_FL_USER4;
         
     | 
| 
      
 84 
     | 
    
         
            +
                }
         
     | 
| 
      
 85 
     | 
    
         
            +
            }
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
       79 
87 
     | 
    
         
             
            static inline void
         
     | 
| 
       80 
88 
     | 
    
         
             
            METHOD_ENTRY_VISI_SET(rb_method_entry_t *me, rb_method_visibility_t visi)
         
     | 
| 
       81 
89 
     | 
    
         
             
            {
         
     | 
| 
         @@ -181,7 +189,8 @@ struct rb_method_definition_struct { 
     | 
|
| 
       181 
189 
     | 
    
         
             
                unsigned int iseq_overload: 1;
         
     | 
| 
       182 
190 
     | 
    
         
             
                unsigned int no_redef_warning: 1;
         
     | 
| 
       183 
191 
     | 
    
         
             
                unsigned int aliased : 1;
         
     | 
| 
       184 
     | 
    
         
            -
             
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
                rb_atomic_t reference_count;
         
     | 
| 
       185 
194 
     | 
    
         | 
| 
       186 
195 
     | 
    
         
             
                union {
         
     | 
| 
       187 
196 
     | 
    
         
             
                    rb_method_iseq_t iseq;
         
     | 
| 
         @@ -195,6 +204,7 @@ struct rb_method_definition_struct { 
     | 
|
| 
       195 
204 
     | 
    
         | 
| 
       196 
205 
     | 
    
         
             
                ID original_id;
         
     | 
| 
       197 
206 
     | 
    
         
             
                uintptr_t method_serial;
         
     | 
| 
      
 207 
     | 
    
         
            +
                const rb_namespace_t *ns;
         
     | 
| 
       198 
208 
     | 
    
         
             
            };
         
     | 
| 
       199 
209 
     | 
    
         | 
| 
       200 
210 
     | 
    
         
             
            struct rb_id_table;
         
     | 
| 
         @@ -237,6 +247,7 @@ st_index_t rb_hash_method_entry(st_index_t hash, const rb_method_entry_t *me); 
     | 
|
| 
       237 
247 
     | 
    
         | 
| 
       238 
248 
     | 
    
         
             
            VALUE rb_method_entry_location(const rb_method_entry_t *me);
         
     | 
| 
       239 
249 
     | 
    
         | 
| 
      
 250 
     | 
    
         
            +
            void rb_free_method_entry_vm_weak_references(const rb_method_entry_t *me);
         
     | 
| 
       240 
251 
     | 
    
         
             
            void rb_free_method_entry(const rb_method_entry_t *me);
         
     | 
| 
       241 
252 
     | 
    
         | 
| 
       242 
253 
     | 
    
         
             
            const rb_method_entry_t *rb_method_entry_clone(const rb_method_entry_t *me);
         
     | 
| 
         @@ -244,12 +255,17 @@ const rb_callable_method_entry_t *rb_method_entry_complement_defined_class(const 
     | 
|
| 
       244 
255 
     | 
    
         
             
            void rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src);
         
     | 
| 
       245 
256 
     | 
    
         | 
| 
       246 
257 
     | 
    
         
             
            void rb_method_table_insert(VALUE klass, struct rb_id_table *table, ID method_id, const rb_method_entry_t *me);
         
     | 
| 
      
 258 
     | 
    
         
            +
            void rb_method_table_insert0(VALUE klass, struct rb_id_table *table, ID method_id, const rb_method_entry_t *me, bool iclass_shared_mtbl);
         
     | 
| 
       247 
259 
     | 
    
         | 
| 
       248 
260 
     | 
    
         
             
            void rb_scope_visibility_set(rb_method_visibility_t);
         
     | 
| 
       249 
261 
     | 
    
         | 
| 
       250 
262 
     | 
    
         
             
            VALUE rb_unnamed_parameters(int arity);
         
     | 
| 
       251 
263 
     | 
    
         | 
| 
      
 264 
     | 
    
         
            +
            void rb_vm_insert_cc_refinement(const struct rb_callcache *cc);
         
     | 
| 
      
 265 
     | 
    
         
            +
            void rb_vm_delete_cc_refinement(const struct rb_callcache *cc);
         
     | 
| 
      
 266 
     | 
    
         
            +
             
     | 
| 
       252 
267 
     | 
    
         
             
            void rb_clear_method_cache(VALUE klass_or_module, ID mid);
         
     | 
| 
       253 
268 
     | 
    
         
             
            void rb_clear_all_refinement_method_cache(void);
         
     | 
| 
      
 269 
     | 
    
         
            +
            void rb_invalidate_method_caches(struct rb_id_table *cm_tbl, VALUE cc_tbl);
         
     | 
| 
       254 
270 
     | 
    
         | 
| 
       255 
271 
     | 
    
         
             
            #endif /* RUBY_METHOD_H */
         
     | 
    
        data/ext/kanayago/node.c
    CHANGED
    
    | 
         @@ -225,7 +225,7 @@ free_ast_value(rb_ast_t *ast, void *ctx, NODE *node) 
     | 
|
| 
       225 
225 
     | 
    
         
             
            static void
         
     | 
| 
       226 
226 
     | 
    
         
             
            rb_node_buffer_free(rb_ast_t *ast, node_buffer_t *nb)
         
     | 
| 
       227 
227 
     | 
    
         
             
            {
         
     | 
| 
       228 
     | 
    
         
            -
                if (nb 
     | 
| 
      
 228 
     | 
    
         
            +
                if (nb->tokens) {
         
     | 
| 
       229 
229 
     | 
    
         
             
                    parser_tokens_free(ast, nb->tokens);
         
     | 
| 
       230 
230 
     | 
    
         
             
                }
         
     | 
| 
       231 
231 
     | 
    
         
             
                iterate_node_values(ast, &nb->buffer_list, free_ast_value, NULL);
         
     | 
| 
         @@ -438,3 +438,9 @@ rb_node_set_type(NODE *n, enum node_type t) 
     | 
|
| 
       438 
438 
     | 
    
         
             
            {
         
     | 
| 
       439 
439 
     | 
    
         
             
                return nd_init_type(n, t);
         
     | 
| 
       440 
440 
     | 
    
         
             
            }
         
     | 
| 
      
 441 
     | 
    
         
            +
             
     | 
| 
      
 442 
     | 
    
         
            +
            enum node_type
         
     | 
| 
      
 443 
     | 
    
         
            +
            rb_node_get_type(const NODE *n)
         
     | 
| 
      
 444 
     | 
    
         
            +
            {
         
     | 
| 
      
 445 
     | 
    
         
            +
                return (enum node_type)nd_type(n);
         
     | 
| 
      
 446 
     | 
    
         
            +
            }
         
     | 
    
        data/ext/kanayago/node.h
    CHANGED
    
    | 
         @@ -67,16 +67,27 @@ const struct kwtable *rb_reserved_word(const char *, unsigned int); 
     | 
|
| 
       67 
67 
     | 
    
         
             
            struct parser_params;
         
     | 
| 
       68 
68 
     | 
    
         
             
            PRINTF_ARGS(void rb_parser_printf(struct parser_params *parser, const char *fmt, ...), 2, 3);
         
     | 
| 
       69 
69 
     | 
    
         
             
            VALUE rb_node_set_type(NODE *n, enum node_type t);
         
     | 
| 
      
 70 
     | 
    
         
            +
            enum node_type rb_node_get_type(const NODE *n);
         
     | 
| 
       70 
71 
     | 
    
         | 
| 
       71 
72 
     | 
    
         
             
            RUBY_SYMBOL_EXPORT_END
         
     | 
| 
       72 
73 
     | 
    
         | 
| 
       73 
74 
     | 
    
         
             
            #define NODE_LSHIFT (NODE_TYPESHIFT+7)
         
     | 
| 
       74 
75 
     | 
    
         
             
            #define NODE_LMASK  (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
         
     | 
| 
       75 
76 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
      
 77 
     | 
    
         
            +
            static inline int
         
     | 
| 
      
 78 
     | 
    
         
            +
            nd_line(const NODE *n)
         
     | 
| 
      
 79 
     | 
    
         
            +
            {
         
     | 
| 
      
 80 
     | 
    
         
            +
                if (!n) return -1;
         
     | 
| 
      
 81 
     | 
    
         
            +
                SIGNED_VALUE flags = (SIGNED_VALUE)n->flags;
         
     | 
| 
      
 82 
     | 
    
         
            +
                return (int)(flags >> NODE_LSHIFT);
         
     | 
| 
      
 83 
     | 
    
         
            +
            }
         
     | 
| 
       79 
84 
     | 
    
         | 
| 
      
 85 
     | 
    
         
            +
            static inline void
         
     | 
| 
      
 86 
     | 
    
         
            +
            nd_set_line(NODE *n, SIGNED_VALUE l)
         
     | 
| 
      
 87 
     | 
    
         
            +
            {
         
     | 
| 
      
 88 
     | 
    
         
            +
                n->flags &= ~(~(VALUE)0 << NODE_LSHIFT);
         
     | 
| 
      
 89 
     | 
    
         
            +
                n->flags |= ((VALUE)(l & NODE_LMASK) << NODE_LSHIFT);
         
     | 
| 
      
 90 
     | 
    
         
            +
            }
         
     | 
| 
       80 
91 
     | 
    
         | 
| 
       81 
92 
     | 
    
         
             
            #define NODE_SPECIAL_REQUIRED_KEYWORD ((NODE *)-1)
         
     | 
| 
       82 
93 
     | 
    
         
             
            #define NODE_REQUIRED_KEYWORD_P(node) ((node) == NODE_SPECIAL_REQUIRED_KEYWORD)
         
     |