Skip to content

Commit 78f604a

Browse files
committed
Ruby: Document Field access path token
1 parent 6f852aa commit 78f604a

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

ruby/ql/docs/flow_summaries.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ Models as Data. These strings are often referred to as access paths.
4949

5050
Access paths consist of zero or more components separated by dots (`.`). The
5151
permitted components differ for input and output paths. The meaning of each
52-
component is defined relative to the implicit context of the component, which
53-
itself is defined by the preceding access path. For example,
52+
component is defined relative to the implicit context of the component as
53+
defined by the preceding access path. For example,
5454

5555
```
5656
Argument[0].Element[1].ReturnValue
@@ -93,10 +93,10 @@ A keyword argument to the call with the given name. For example,
9393
The block argument passed to the call, if any.
9494

9595
#### `any`
96-
Any argument to the call. TODO: does this include self and block args?
96+
Any argument to the call, except `self` or `block` arguments.
9797

9898
#### `any-named`
99-
TODO
99+
Any keyword argument to the call.
100100

101101
#### `hash-splat`
102102
The special "hash splat" argument/parameter, which is written as `**args`.
@@ -139,7 +139,20 @@ typically something like `foo` for the string key `"foo"` and `:foo` for the
139139
symbol `:foo`.
140140

141141
## `Field`
142-
TODO
142+
A "field" in the object. In practice this refers to a value stored in an
143+
instance variable in the object. The only valid specifier is `@<string>`, where
144+
`<string>` is the name of the instance variable. Currently we assume that a
145+
setter call such as `x.foo = bar` means there is a field `foo` in `x`, backed by
146+
an instance variable `@foo`.
147+
148+
For example, the access path `Argument[0].Field[@foo]` would refer to the value
149+
`"foo"` in
150+
151+
```rb
152+
x = SomeClass.new
153+
x.foo = "foo"
154+
some_call(x)
155+
```
143156

144157
## `WithElement`
145158
This component restricts the set of elements that are included in the preceding

0 commit comments

Comments
 (0)