Skip to content

Commit d578450

Browse files
committed
Inside nth argument: replace query_description with deepcopy that is missing nth
for these kind of queries nth decoding Should happen inside the transformation function not inside process_line. These was causing problems, because queries that they don't specify an inside index("inside first argument 1" As opposed to "inside 1 first argument 1") Were not searching All of the arguments of the parent call But only the one with index 1
1 parent 278985b commit d578450

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

queries/argument.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import ast
22

3+
from copy import deepcopy
4+
5+
import PythonVoiceCodingPlugin.library.info as info
6+
37
from PythonVoiceCodingPlugin.library import sorted_by_source_region,get_source_region,make_flat
48
from PythonVoiceCodingPlugin.library.selection_node import nearest_node_from_offset,node_from_range
59
from PythonVoiceCodingPlugin.library.info import identity,get_argument_from_call,get_keyword_argument, make_information ,correspond_to_index_in_call,get_caller,get_sub_index,get_weak_header,get_argument_from_empty_call
6-
import PythonVoiceCodingPlugin.library.info as info
710
from PythonVoiceCodingPlugin.library.LCA import LCA
811
from PythonVoiceCodingPlugin.library.level_info import LevelVisitor
912
from PythonVoiceCodingPlugin.library.partial import partially_parse, line_partial
@@ -99,7 +102,7 @@ def process_line(self,q, root ,atok, origin = None, select_node = None,tiebreak
99102
if "nth" not in q:
100103
if origin and calling_node:
101104
result = calling_node if calling_node in information_nodes else None
102-
information_nodes = [x for x in tiebreaker(information_nodes) if x != calling_node]
105+
information_nodes = [x for x in tiebreaker(information_nodes) if x is not calling_node]
103106
else:
104107
result = None
105108
information_nodes = [x for x in tiebreaker(information_nodes)]
@@ -352,9 +355,9 @@ def inverse_transformation(node):
352355

353356

354357

355-
358+
q = deepcopy(query_description); del q["nth"]
356359
result, alternatives = self.process_line(
357-
q = query_description,
360+
q = q,
358361
root = statement_node,
359362
atok = atok,
360363
origin = origin,

0 commit comments

Comments
 (0)