Skip to content

Commit d963952

Browse files
author
Cedric Halbronn
committed
fix handling of arguments with both : and = in them when using 'chunk value'
1 parent e354ab1 commit d963952

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

data/playground/python/values.py

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ def func(b=True, c=True):
3232
def my_funk(value: str) -> str:
3333
print(value)
3434

35+
def my_funk(value: str = "hello", other: bool=False) -> str:
36+
print(value)
37+
3538
# we can say "change every value" to allow modifying all the values in one go
3639
def foo():
3740
a = 0

queries/python.scm

+15-21
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,24 @@
6969
;; xxxxxx
7070
;; ---------
7171
;;
72-
;; def func(b=True):
73-
;; ^^^^
74-
;; xxxxx
75-
;; ------
76-
;;
77-
;; NOTE: we ignore d["a"] of type
78-
;; (subscript
79-
;; value: ...
80-
;; )
81-
(
72+
;; {value: key for (key, value) in d1.items()}
73+
;; ^^^
74+
;; xxxxx
75+
;; ----------
76+
(pair
77+
":" @_.leading
78+
value: (_) @value
79+
) @_.domain
80+
81+
;; def func(value: str=""):
82+
;; ^^
83+
;; xxx
84+
;; -------------
85+
(parameters
8286
(_
83-
[
84-
":"
85-
"="
86-
] @_.leading
87+
"=" @_.leading
8788
value: (_) @value
8889
) @_.domain
89-
(#not-type? @_.domain subscript)
9090
)
9191

9292
;; def func():
@@ -136,12 +136,6 @@
136136
(module) @namedFunction.iteration @functionName.iteration
137137
(class_definition) @namedFunction.iteration @functionName.iteration
138138

139-
;; _ = {value: key for (key, value) in d1.items()}
140-
;; **********
141-
;;(_
142-
;; body: (_) @statement.iteration @value.iteration
143-
;;)
144-
145139
;; def foo():
146140
;; a = 0
147141
;; *****

0 commit comments

Comments
 (0)