Public utility to detect read/write access for an expression

Implemented ReadWriteAccessDetector which gives read/write access in Highlight Usages and Find Usages
+ More correct UsageType detection
This commit is contained in:
Valentin Kipyatkov
2015-08-17 22:01:15 +03:00
parent 1fd0578b9e
commit 5e97387e8d
13 changed files with 178 additions and 74 deletions
@@ -0,0 +1,13 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.JetProperty
// OPTIONS: usages
// OPTIONS: skipWrite
fun foo() {
var <caret>v = 1
v = 2
print(v)
++v
v--
print(-v)
v += 1
v -= 1
}
@@ -0,0 +1,6 @@
Value read (10: 12) print(-v)
Value read (7: 11) print(v)
Value write (11: 5) v += 1
Value write (12: 5) v -= 1
Value write (8: 7) ++v
Value write (9: 5) v--
@@ -0,0 +1,13 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.JetProperty
// OPTIONS: usages
// OPTIONS: skipRead
fun foo() {
var <caret>v = 1
v = 2
print(v)
++v
v--
print(-v)
v += 1
v -= 1
}
@@ -0,0 +1,5 @@
Value write (11: 5) v += 1
Value write (12: 5) v -= 1
Value write (6: 5) v = 2
Value write (8: 7) ++v
Value write (9: 5) v--