yarp 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -8
- data/CONTRIBUTING.md +2 -2
- data/Makefile +5 -5
- data/README.md +11 -12
- data/config.yml +6 -2
- data/docs/build_system.md +21 -21
- data/docs/building.md +4 -4
- data/docs/configuration.md +25 -21
- data/docs/design.md +2 -2
- data/docs/encoding.md +17 -17
- data/docs/fuzzing.md +4 -4
- data/docs/heredocs.md +3 -3
- data/docs/mapping.md +94 -94
- data/docs/ripper.md +4 -4
- data/docs/ruby_api.md +11 -11
- data/docs/serialization.md +17 -16
- data/docs/testing.md +6 -6
- data/ext/prism/api_node.c +4725 -0
- data/ext/{yarp → prism}/api_pack.c +82 -82
- data/ext/{yarp → prism}/extconf.rb +13 -13
- data/ext/{yarp → prism}/extension.c +175 -168
- data/ext/prism/extension.h +18 -0
- data/include/prism/ast.h +1932 -0
- data/include/prism/defines.h +45 -0
- data/include/prism/diagnostic.h +231 -0
- data/include/{yarp/enc/yp_encoding.h → prism/enc/pm_encoding.h} +40 -40
- data/include/prism/node.h +41 -0
- data/include/prism/pack.h +141 -0
- data/include/{yarp → prism}/parser.h +143 -142
- data/include/prism/regexp.h +19 -0
- data/include/prism/unescape.h +48 -0
- data/include/prism/util/pm_buffer.h +51 -0
- data/include/{yarp/util/yp_char.h → prism/util/pm_char.h} +20 -20
- data/include/{yarp/util/yp_constant_pool.h → prism/util/pm_constant_pool.h} +26 -22
- data/include/{yarp/util/yp_list.h → prism/util/pm_list.h} +21 -21
- data/include/prism/util/pm_memchr.h +14 -0
- data/include/{yarp/util/yp_newline_list.h → prism/util/pm_newline_list.h} +11 -11
- data/include/prism/util/pm_state_stack.h +24 -0
- data/include/{yarp/util/yp_string.h → prism/util/pm_string.h} +20 -20
- data/include/prism/util/pm_string_list.h +25 -0
- data/include/{yarp/util/yp_strpbrk.h → prism/util/pm_strpbrk.h} +7 -7
- data/include/prism/version.h +4 -0
- data/include/prism.h +82 -0
- data/lib/prism/compiler.rb +465 -0
- data/lib/prism/debug.rb +157 -0
- data/lib/{yarp/desugar_visitor.rb → prism/desugar_compiler.rb} +4 -2
- data/lib/prism/dispatcher.rb +2051 -0
- data/lib/prism/dsl.rb +750 -0
- data/lib/{yarp → prism}/ffi.rb +66 -67
- data/lib/{yarp → prism}/lex_compat.rb +40 -43
- data/lib/{yarp/mutation_visitor.rb → prism/mutation_compiler.rb} +3 -3
- data/lib/{yarp → prism}/node.rb +2012 -2593
- data/lib/prism/node_ext.rb +55 -0
- data/lib/prism/node_inspector.rb +68 -0
- data/lib/{yarp → prism}/pack.rb +1 -1
- data/lib/{yarp → prism}/parse_result/comments.rb +1 -1
- data/lib/{yarp → prism}/parse_result/newlines.rb +1 -1
- data/lib/prism/parse_result.rb +266 -0
- data/lib/{yarp → prism}/pattern.rb +14 -14
- data/lib/{yarp → prism}/ripper_compat.rb +5 -5
- data/lib/{yarp → prism}/serialize.rb +12 -7
- data/lib/prism/visitor.rb +470 -0
- data/lib/prism.rb +64 -0
- data/lib/yarp.rb +2 -614
- data/src/diagnostic.c +213 -208
- data/src/enc/pm_big5.c +52 -0
- data/src/enc/pm_euc_jp.c +58 -0
- data/src/enc/{yp_gbk.c → pm_gbk.c} +16 -16
- data/src/enc/pm_shift_jis.c +56 -0
- data/src/enc/{yp_tables.c → pm_tables.c} +69 -69
- data/src/enc/{yp_unicode.c → pm_unicode.c} +40 -40
- data/src/enc/pm_windows_31j.c +56 -0
- data/src/node.c +1293 -1233
- data/src/pack.c +247 -247
- data/src/prettyprint.c +1479 -1479
- data/src/{yarp.c → prism.c} +5205 -5083
- data/src/regexp.c +132 -132
- data/src/serialize.c +1121 -1121
- data/src/token_type.c +169 -167
- data/src/unescape.c +106 -87
- data/src/util/pm_buffer.c +103 -0
- data/src/util/{yp_char.c → pm_char.c} +72 -72
- data/src/util/{yp_constant_pool.c → pm_constant_pool.c} +85 -64
- data/src/util/{yp_list.c → pm_list.c} +10 -10
- data/src/util/{yp_memchr.c → pm_memchr.c} +6 -4
- data/src/util/{yp_newline_list.c → pm_newline_list.c} +21 -21
- data/src/util/{yp_state_stack.c → pm_state_stack.c} +4 -4
- data/src/util/{yp_string.c → pm_string.c} +38 -38
- data/src/util/pm_string_list.c +29 -0
- data/src/util/{yp_strncasecmp.c → pm_strncasecmp.c} +1 -1
- data/src/util/{yp_strpbrk.c → pm_strpbrk.c} +8 -8
- data/yarp.gemspec +68 -59
- metadata +70 -61
- data/ext/yarp/api_node.c +0 -4728
- data/ext/yarp/extension.h +0 -18
- data/include/yarp/ast.h +0 -1929
- data/include/yarp/defines.h +0 -45
- data/include/yarp/diagnostic.h +0 -226
- data/include/yarp/node.h +0 -42
- data/include/yarp/pack.h +0 -141
- data/include/yarp/regexp.h +0 -19
- data/include/yarp/unescape.h +0 -44
- data/include/yarp/util/yp_buffer.h +0 -51
- data/include/yarp/util/yp_memchr.h +0 -14
- data/include/yarp/util/yp_state_stack.h +0 -24
- data/include/yarp/util/yp_string_list.h +0 -25
- data/include/yarp/version.h +0 -4
- data/include/yarp.h +0 -82
- data/src/enc/yp_big5.c +0 -52
- data/src/enc/yp_euc_jp.c +0 -58
- data/src/enc/yp_shift_jis.c +0 -56
- data/src/enc/yp_windows_31j.c +0 -56
- data/src/util/yp_buffer.c +0 -101
- data/src/util/yp_string_list.c +0 -29
data/lib/{yarp → prism}/ffi.rb
RENAMED
@@ -6,7 +6,7 @@
|
|
6
6
|
require "rbconfig"
|
7
7
|
require "ffi"
|
8
8
|
|
9
|
-
module
|
9
|
+
module Prism
|
10
10
|
BACKEND = :FFI
|
11
11
|
|
12
12
|
module LibRubyParser
|
@@ -35,13 +35,13 @@ module YARP
|
|
35
35
|
def self.load_exported_functions_from(header, *functions)
|
36
36
|
File.foreach(File.expand_path("../../include/#{header}", __dir__)) do |line|
|
37
37
|
# We only want to attempt to load exported functions.
|
38
|
-
next unless line.start_with?("
|
38
|
+
next unless line.start_with?("PRISM_EXPORTED_FUNCTION ")
|
39
39
|
|
40
40
|
# We only want to load the functions that we are interested in.
|
41
41
|
next unless functions.any? { |function| line.include?(function) }
|
42
42
|
|
43
43
|
# Parse the function declaration.
|
44
|
-
unless /^
|
44
|
+
unless /^PRISM_EXPORTED_FUNCTION (?<return_type>.+) (?<name>\w+)\((?<arg_types>.+)\);$/ =~ line
|
45
45
|
raise "Could not parse #{line}"
|
46
46
|
end
|
47
47
|
|
@@ -67,35 +67,35 @@ module YARP
|
|
67
67
|
end
|
68
68
|
|
69
69
|
load_exported_functions_from(
|
70
|
-
"
|
71
|
-
"
|
72
|
-
"
|
73
|
-
"
|
74
|
-
"
|
70
|
+
"prism.h",
|
71
|
+
"pm_version",
|
72
|
+
"pm_parse_serialize",
|
73
|
+
"pm_lex_serialize",
|
74
|
+
"pm_parse_lex_serialize"
|
75
75
|
)
|
76
76
|
|
77
77
|
load_exported_functions_from(
|
78
|
-
"
|
79
|
-
"
|
80
|
-
"
|
81
|
-
"
|
82
|
-
"
|
83
|
-
"
|
78
|
+
"prism/util/pm_buffer.h",
|
79
|
+
"pm_buffer_sizeof",
|
80
|
+
"pm_buffer_init",
|
81
|
+
"pm_buffer_value",
|
82
|
+
"pm_buffer_length",
|
83
|
+
"pm_buffer_free"
|
84
84
|
)
|
85
85
|
|
86
86
|
load_exported_functions_from(
|
87
|
-
"
|
88
|
-
"
|
89
|
-
"
|
90
|
-
"
|
91
|
-
"
|
92
|
-
"
|
87
|
+
"prism/util/pm_string.h",
|
88
|
+
"pm_string_mapped_init",
|
89
|
+
"pm_string_free",
|
90
|
+
"pm_string_source",
|
91
|
+
"pm_string_length",
|
92
|
+
"pm_string_sizeof"
|
93
93
|
)
|
94
94
|
|
95
|
-
# This object represents a
|
96
|
-
# so it doesn't need to know the fields of
|
97
|
-
class
|
98
|
-
SIZEOF = LibRubyParser.
|
95
|
+
# This object represents a pm_buffer_t. We only use it as an opaque pointer,
|
96
|
+
# so it doesn't need to know the fields of pm_buffer_t.
|
97
|
+
class PrismBuffer
|
98
|
+
SIZEOF = LibRubyParser.pm_buffer_sizeof
|
99
99
|
|
100
100
|
attr_reader :pointer
|
101
101
|
|
@@ -104,11 +104,11 @@ module YARP
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def value
|
107
|
-
LibRubyParser.
|
107
|
+
LibRubyParser.pm_buffer_value(pointer)
|
108
108
|
end
|
109
109
|
|
110
110
|
def length
|
111
|
-
LibRubyParser.
|
111
|
+
LibRubyParser.pm_buffer_length(pointer)
|
112
112
|
end
|
113
113
|
|
114
114
|
def read
|
@@ -121,19 +121,19 @@ module YARP
|
|
121
121
|
pointer = FFI::MemoryPointer.new(SIZEOF)
|
122
122
|
|
123
123
|
begin
|
124
|
-
raise unless LibRubyParser.
|
124
|
+
raise unless LibRubyParser.pm_buffer_init(pointer)
|
125
125
|
yield new(pointer)
|
126
126
|
ensure
|
127
|
-
LibRubyParser.
|
127
|
+
LibRubyParser.pm_buffer_free(pointer)
|
128
128
|
pointer.free
|
129
129
|
end
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
-
# This object represents a
|
133
|
+
# This object represents a pm_string_t. We only use it as an opaque pointer,
|
134
134
|
# so it doesn't have to be an FFI::Struct.
|
135
|
-
class
|
136
|
-
SIZEOF = LibRubyParser.
|
135
|
+
class PrismString
|
136
|
+
SIZEOF = LibRubyParser.pm_string_sizeof
|
137
137
|
|
138
138
|
attr_reader :pointer
|
139
139
|
|
@@ -142,94 +142,93 @@ module YARP
|
|
142
142
|
end
|
143
143
|
|
144
144
|
def source
|
145
|
-
LibRubyParser.
|
145
|
+
LibRubyParser.pm_string_source(pointer)
|
146
146
|
end
|
147
147
|
|
148
148
|
def length
|
149
|
-
LibRubyParser.
|
149
|
+
LibRubyParser.pm_string_length(pointer)
|
150
150
|
end
|
151
151
|
|
152
152
|
def read
|
153
153
|
source.read_string(length)
|
154
154
|
end
|
155
155
|
|
156
|
-
# Yields a
|
156
|
+
# Yields a pm_string_t pointer to the given block.
|
157
157
|
def self.with(filepath, &block)
|
158
158
|
pointer = FFI::MemoryPointer.new(SIZEOF)
|
159
159
|
|
160
160
|
begin
|
161
|
-
raise unless LibRubyParser.
|
161
|
+
raise unless LibRubyParser.pm_string_mapped_init(pointer, filepath)
|
162
162
|
yield new(pointer)
|
163
163
|
ensure
|
164
|
-
LibRubyParser.
|
164
|
+
LibRubyParser.pm_string_free(pointer)
|
165
165
|
pointer.free
|
166
166
|
end
|
167
167
|
end
|
168
168
|
end
|
169
|
+
|
170
|
+
def self.dump_internal(source, source_size, filepath)
|
171
|
+
PrismBuffer.with do |buffer|
|
172
|
+
metadata = [filepath.bytesize, filepath.b, 0].pack("LA*L") if filepath
|
173
|
+
pm_parse_serialize(source, source_size, buffer.pointer, metadata)
|
174
|
+
buffer.read
|
175
|
+
end
|
176
|
+
end
|
169
177
|
end
|
170
178
|
|
171
179
|
# Mark the LibRubyParser module as private as it should only be called through
|
172
|
-
# the
|
180
|
+
# the prism module.
|
173
181
|
private_constant :LibRubyParser
|
174
182
|
|
175
|
-
# The version constant is set by reading the result of calling
|
176
|
-
VERSION = LibRubyParser.
|
177
|
-
|
178
|
-
def self.dump_internal(source, source_size, filepath)
|
179
|
-
LibRubyParser::YPBuffer.with do |buffer|
|
180
|
-
metadata = [filepath.bytesize, filepath.b, 0].pack("LA*L") if filepath
|
181
|
-
LibRubyParser.yp_parse_serialize(source, source_size, buffer.pointer, metadata)
|
182
|
-
buffer.read
|
183
|
-
end
|
184
|
-
end
|
185
|
-
private_class_method :dump_internal
|
183
|
+
# The version constant is set by reading the result of calling pm_version.
|
184
|
+
VERSION = LibRubyParser.pm_version.read_string
|
186
185
|
|
187
|
-
# Mirror the
|
186
|
+
# Mirror the Prism.dump API by using the serialization API.
|
188
187
|
def self.dump(code, filepath = nil)
|
189
|
-
dump_internal(code, code.bytesize, filepath)
|
188
|
+
LibRubyParser.dump_internal(code, code.bytesize, filepath)
|
190
189
|
end
|
191
190
|
|
192
|
-
# Mirror the
|
191
|
+
# Mirror the Prism.dump_file API by using the serialization API.
|
193
192
|
def self.dump_file(filepath)
|
194
|
-
LibRubyParser::
|
195
|
-
dump_internal(string.source, string.length, filepath)
|
193
|
+
LibRubyParser::PrismString.with(filepath) do |string|
|
194
|
+
LibRubyParser.dump_internal(string.source, string.length, filepath)
|
196
195
|
end
|
197
196
|
end
|
198
197
|
|
199
|
-
# Mirror the
|
198
|
+
# Mirror the Prism.lex API by using the serialization API.
|
200
199
|
def self.lex(code, filepath = nil)
|
201
|
-
LibRubyParser::
|
202
|
-
LibRubyParser.
|
200
|
+
LibRubyParser::PrismBuffer.with do |buffer|
|
201
|
+
LibRubyParser.pm_lex_serialize(code, code.bytesize, filepath, buffer.pointer)
|
203
202
|
Serialize.load_tokens(Source.new(code), buffer.read)
|
204
203
|
end
|
205
204
|
end
|
206
205
|
|
207
|
-
# Mirror the
|
206
|
+
# Mirror the Prism.lex_file API by using the serialization API.
|
208
207
|
def self.lex_file(filepath)
|
209
|
-
LibRubyParser::
|
208
|
+
LibRubyParser::PrismString.with(filepath) do |string|
|
210
209
|
lex(string.read, filepath)
|
211
210
|
end
|
212
211
|
end
|
213
212
|
|
214
|
-
# Mirror the
|
213
|
+
# Mirror the Prism.parse API by using the serialization API.
|
215
214
|
def self.parse(code, filepath = nil)
|
216
|
-
|
215
|
+
Prism.load(code, dump(code, filepath))
|
217
216
|
end
|
218
217
|
|
219
|
-
# Mirror the
|
218
|
+
# Mirror the Prism.parse_file API by using the serialization API. This uses
|
220
219
|
# native strings instead of Ruby strings because it allows us to use mmap when
|
221
220
|
# it is available.
|
222
221
|
def self.parse_file(filepath)
|
223
|
-
LibRubyParser::
|
222
|
+
LibRubyParser::PrismString.with(filepath) do |string|
|
224
223
|
parse(string.read, filepath)
|
225
224
|
end
|
226
225
|
end
|
227
226
|
|
228
|
-
# Mirror the
|
227
|
+
# Mirror the Prism.parse_lex API by using the serialization API.
|
229
228
|
def self.parse_lex(code, filepath = nil)
|
230
|
-
LibRubyParser::
|
229
|
+
LibRubyParser::PrismBuffer.with do |buffer|
|
231
230
|
metadata = [filepath.bytesize, filepath.b, 0].pack("LA*L") if filepath
|
232
|
-
LibRubyParser.
|
231
|
+
LibRubyParser.pm_parse_lex_serialize(code, code.bytesize, buffer.pointer, metadata)
|
233
232
|
|
234
233
|
source = Source.new(code)
|
235
234
|
loader = Serialize::Loader.new(source, buffer.read)
|
@@ -243,9 +242,9 @@ module YARP
|
|
243
242
|
end
|
244
243
|
end
|
245
244
|
|
246
|
-
# Mirror the
|
245
|
+
# Mirror the Prism.parse_lex_file API by using the serialization API.
|
247
246
|
def self.parse_lex_file(filepath)
|
248
|
-
LibRubyParser::
|
247
|
+
LibRubyParser::PrismString.with(filepath) do |string|
|
249
248
|
parse_lex(string.read, filepath)
|
250
249
|
end
|
251
250
|
end
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
require "delegate"
|
4
4
|
|
5
|
-
module
|
6
|
-
# This class is responsible for lexing the source using
|
5
|
+
module Prism
|
6
|
+
# This class is responsible for lexing the source using prism and then
|
7
7
|
# converting those tokens to be compatible with Ripper. In the vast majority
|
8
8
|
# of cases, this is a one-to-one mapping of the token type. Everything else
|
9
9
|
# generally lines up. However, there are a few cases that require special
|
10
10
|
# handling.
|
11
11
|
class LexCompat
|
12
|
-
# This is a mapping of
|
12
|
+
# This is a mapping of prism token types to Ripper token types. This is a
|
13
13
|
# many-to-one mapping because we split up our token types, whereas Ripper
|
14
14
|
# tends to group them.
|
15
15
|
RIPPER = {
|
@@ -128,6 +128,7 @@ module YARP
|
|
128
128
|
LESS_EQUAL_GREATER: :on_op,
|
129
129
|
LESS_LESS: :on_op,
|
130
130
|
LESS_LESS_EQUAL: :on_op,
|
131
|
+
METHOD_NAME: :on_ident,
|
131
132
|
MINUS: :on_op,
|
132
133
|
MINUS_EQUAL: :on_op,
|
133
134
|
MINUS_GREATER: :on_tlambda,
|
@@ -338,8 +339,8 @@ module YARP
|
|
338
339
|
|
339
340
|
# Heredocs that are dedenting heredocs are a little more complicated.
|
340
341
|
# Ripper outputs on_ignored_sp tokens for the whitespace that is being
|
341
|
-
# removed from the output.
|
342
|
-
# the token the same. This simplifies
|
342
|
+
# removed from the output. prism only modifies the node itself and keeps
|
343
|
+
# the token the same. This simplifies prism, but makes comparing against
|
343
344
|
# Ripper much harder because there is a length mismatch.
|
344
345
|
#
|
345
346
|
# Fortunately, we already have to pull out the heredoc tokens in order to
|
@@ -562,7 +563,7 @@ module YARP
|
|
562
563
|
state = :default
|
563
564
|
heredoc_stack = [[]]
|
564
565
|
|
565
|
-
result =
|
566
|
+
result = Prism.lex(source, @filepath)
|
566
567
|
result_value = result.value
|
567
568
|
previous_state = nil
|
568
569
|
|
@@ -649,7 +650,7 @@ module YARP
|
|
649
650
|
IgnoredNewlineToken.new([[lineno, column], event, value, lex_state])
|
650
651
|
when :on_regexp_end
|
651
652
|
# On regex end, Ripper scans and then sets end state, so the ripper
|
652
|
-
# lexed output is begin, when it should be end.
|
653
|
+
# lexed output is begin, when it should be end. prism sets lex state
|
653
654
|
# correctly to end state, but we want to be able to compare against
|
654
655
|
# Ripper's lexed state. So here, if it's a regexp end token, we
|
655
656
|
# output the state as the previous state, solely for the sake of
|
@@ -705,7 +706,7 @@ module YARP
|
|
705
706
|
|
706
707
|
# The order in which tokens appear in our lexer is different from the
|
707
708
|
# order that they appear in Ripper. When we hit the declaration of a
|
708
|
-
# heredoc in
|
709
|
+
# heredoc in prism, we skip forward and lex the rest of the content of
|
709
710
|
# the heredoc before going back and lexing at the end of the heredoc
|
710
711
|
# identifier.
|
711
712
|
#
|
@@ -794,48 +795,44 @@ module YARP
|
|
794
795
|
end
|
795
796
|
end
|
796
797
|
|
797
|
-
#
|
798
|
-
#
|
799
|
-
|
798
|
+
# This is a class that wraps the Ripper lexer to produce almost exactly the
|
799
|
+
# same tokens.
|
800
|
+
class LexRipper
|
801
|
+
attr_reader :source
|
800
802
|
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
def self.lex_compat(source, filepath = "")
|
805
|
-
LexCompat.new(source, filepath).result
|
806
|
-
end
|
803
|
+
def initialize(source)
|
804
|
+
@source = source
|
805
|
+
end
|
807
806
|
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
previous
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
807
|
+
def result
|
808
|
+
previous = []
|
809
|
+
results = []
|
810
|
+
|
811
|
+
Ripper.lex(source, raise_errors: true).each do |token|
|
812
|
+
case token[1]
|
813
|
+
when :on_sp
|
814
|
+
# skip
|
815
|
+
when :on_tstring_content
|
816
|
+
if previous[1] == :on_tstring_content && (token[2].start_with?("\#$") || token[2].start_with?("\#@"))
|
817
|
+
previous[2] << token[2]
|
818
|
+
else
|
819
|
+
results << token
|
820
|
+
previous = token
|
821
|
+
end
|
822
|
+
when :on_words_sep
|
823
|
+
if previous[1] == :on_words_sep
|
824
|
+
previous[2] << token[2]
|
825
|
+
else
|
826
|
+
results << token
|
827
|
+
previous = token
|
828
|
+
end
|
829
829
|
else
|
830
830
|
results << token
|
831
831
|
previous = token
|
832
832
|
end
|
833
|
-
else
|
834
|
-
results << token
|
835
|
-
previous = token
|
836
833
|
end
|
837
|
-
end
|
838
834
|
|
839
|
-
|
835
|
+
results
|
836
|
+
end
|
840
837
|
end
|
841
838
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
=begin
|
3
3
|
This file is generated by the templates/template.rb script and should not be
|
4
|
-
modified manually. See templates/lib/
|
4
|
+
modified manually. See templates/lib/prism/mutation_compiler.rb.erb
|
5
5
|
if you are looking to modify the template
|
6
6
|
=end
|
7
7
|
|
8
|
-
module
|
8
|
+
module Prism
|
9
9
|
# This visitor walks through the tree and copies each node as it is being
|
10
10
|
# visited. This is useful for consumers that want to mutate the tree, as you
|
11
11
|
# can change subtrees in place without effecting the rest of the tree.
|
12
|
-
class
|
12
|
+
class MutationCompiler < Compiler
|
13
13
|
# Copy a AliasGlobalVariableNode node
|
14
14
|
def visit_alias_global_variable_node(node)
|
15
15
|
node.copy(new_name: visit(node.new_name), old_name: visit(node.old_name))
|