node_mutation 1.23.3 → 1.24.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 +4 -0
- data/Gemfile.lock +1 -1
- data/lib/node_mutation/adapter/parser.rb +1 -5
- data/lib/node_mutation/adapter/prism.rb +1 -5
- data/lib/node_mutation/adapter/syntax_tree.rb +1 -5
- data/lib/node_mutation/adapter.rb +0 -7
- data/lib/node_mutation/version.rb +1 -1
- data/sig/node_mutation/adapter.rbs +0 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6083384501299b7550d7a91ddee8a643ebfa8ef1d167dd8b95687af79ddcbad4
|
4
|
+
data.tar.gz: a1e8ac6f05d36650b5d012a3f5e1bc3adbd7b0a5fde2d2f7eb559bd2a5abea31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fa73367b5a8508bb4b7f5c5fc5831c00f3f1e6d36b9eef0b5cb87ea9814514317d61d0ae5c016b35459e1a232de0fc32a3b9f437c62642ac017d1d406e7f9bf
|
7
|
+
data.tar.gz: 67d8d95f5f3877905b55ef4e5c30e193ed8f20d7f1516e93fd26552a5887eae4d3f29c4da85064f8c09844a6188899eb2af32e812e8f573f1c2d2cdf0c6d4cd4
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -82,7 +82,7 @@ class NodeMutation::ParserAdapter < NodeMutation::Adapter
|
|
82
82
|
if lines_count > 1 && lines_count == evaluated.size
|
83
83
|
new_code = []
|
84
84
|
lines.each_with_index { |line, index|
|
85
|
-
new_code << (index == 0 ? line : line[
|
85
|
+
new_code << (index == 0 ? line : line[get_start_loc(evaluated.first).column - NodeMutation.tab_width..-1])
|
86
86
|
}
|
87
87
|
new_code.join("\n")
|
88
88
|
else
|
@@ -253,10 +253,6 @@ class NodeMutation::ParserAdapter < NodeMutation::Adapter
|
|
253
253
|
NodeMutation::Struct::Location.new(end_loc.line, end_loc.column)
|
254
254
|
end
|
255
255
|
|
256
|
-
def get_indent(node)
|
257
|
-
file_source(node).split("\n")[get_start_loc(node).line - 1][/\A */].size
|
258
|
-
end
|
259
|
-
|
260
256
|
private
|
261
257
|
|
262
258
|
def child_node_by_name(node, child_name)
|
@@ -74,7 +74,7 @@ class NodeMutation::PrismAdapter < NodeMutation::Adapter
|
|
74
74
|
if lines_count > 1 && lines_count == evaluated.size
|
75
75
|
new_code = []
|
76
76
|
lines.each_with_index { |line, index|
|
77
|
-
new_code << (index == 0 ? line : line[
|
77
|
+
new_code << (index == 0 ? line : line[get_start_loc(evaluated.first).column - NodeMutation.tab_width..-1])
|
78
78
|
}
|
79
79
|
new_code.join("\n")
|
80
80
|
else
|
@@ -186,10 +186,6 @@ class NodeMutation::PrismAdapter < NodeMutation::Adapter
|
|
186
186
|
NodeMutation::Struct::Location.new(node.location.end_line, node.location.end_column)
|
187
187
|
end
|
188
188
|
|
189
|
-
def get_indent(node)
|
190
|
-
node.location.start_column
|
191
|
-
end
|
192
|
-
|
193
189
|
private
|
194
190
|
|
195
191
|
def child_node_by_name(node, child_name)
|
@@ -74,7 +74,7 @@ class NodeMutation::SyntaxTreeAdapter < NodeMutation::Adapter
|
|
74
74
|
if lines_count > 1 && lines_count == evaluated.size
|
75
75
|
new_code = []
|
76
76
|
lines.each_with_index { |line, index|
|
77
|
-
new_code << (index == 0 ? line : line[
|
77
|
+
new_code << (index == 0 ? line : line[get_start_loc(evaluated.first).column - NodeMutation.tab_width..-1])
|
78
78
|
}
|
79
79
|
new_code.join("\n")
|
80
80
|
else
|
@@ -185,10 +185,6 @@ class NodeMutation::SyntaxTreeAdapter < NodeMutation::Adapter
|
|
185
185
|
NodeMutation::Struct::Location.new(node.location.end_line, node.location.end_column)
|
186
186
|
end
|
187
187
|
|
188
|
-
def get_indent(node)
|
189
|
-
node.location.start_column
|
190
|
-
end
|
191
|
-
|
192
188
|
private
|
193
189
|
|
194
190
|
def child_node_by_name(node, child_name)
|
@@ -66,11 +66,4 @@ class NodeMutation::Adapter
|
|
66
66
|
def get_end_loc(node, child_name = nil)
|
67
67
|
raise NotImplementedError, "get_end_loc is not implemented"
|
68
68
|
end
|
69
|
-
|
70
|
-
# Get indent of ast node
|
71
|
-
# @param node [Node] ast node
|
72
|
-
# @return [Number] indent
|
73
|
-
def get_indent(node)
|
74
|
-
raise NotImplementedError, "get_indent is not implemented"
|
75
|
-
end
|
76
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: node_mutation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ast node mutation apis
|
14
14
|
email:
|