Skip to content

Commit

Permalink
make the function work
Browse files Browse the repository at this point in the history
  • Loading branch information
atacan committed Jan 18, 2025
1 parent 231064a commit 8a0ddd2
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
11 changes: 11 additions & 0 deletions data/fixtures/scopes/swift/namedFunction.constructor.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class SurveyQuestion {
var text: String
var response: String?
init(text: String) {
self.text = text
}
func ask() {
print(text)
}
}
---
13 changes: 13 additions & 0 deletions data/fixtures/scopes/swift/namedFunction.method.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Counter {
var count = 0
func increment() {
count += 1
}
func increment(by amount: Int) {
count += amount
}
func reset() {
count = 0
}
}
---
6 changes: 6 additions & 0 deletions data/fixtures/scopes/swift/namedFunction.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
func greet(person: String) -> String {
let greeting = "Hello, " + person + "!"
return greeting
}

---
3 changes: 3 additions & 0 deletions queries/swift.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(function_declaration
name: (_) @functionName
) @namedFunction @functionName.domain

0 comments on commit 8a0ddd2

Please sign in to comment.