Skip to content

Commit 33b1c84

Browse files
aibaarsfelicitymay
andauthored
Apply suggestions from code review
Co-authored-by: Felicity Chapman <[email protected]>
1 parent aad3e06 commit 33b1c84

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/codeql/codeql-language-guides/abstract-syntax-tree-classes-for-working-with-ruby-programs.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,13 @@ All classes in this subsection are subclasses of VariableAccess_.
418418
| ``self`` | SelfVariableReadAccess_ | VariableReadAccess_, SelfVariableAccess_ | |
419419
+----------------------------+------------------------------+-----------------------------------------------+------------------+
420420

421-
Desugaring
422-
~~~~~~~~~~
421+
Syntactic sugar and desugaring
422+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
423423

424424
Certain Ruby language features are shorthands for common operations that could also be expressed in other, more verbose, forms.
425425
Such language features are typically referred to as "syntactic sugar", and make it easier for programmers to write and read code. This is
426-
great for programmers. For source code analyzers, however, this leads to additional work as they need to understand the short-hand notation as well as the long form. To make analysis easier, CodeQL automatically "desugars" Ruby code, effectively rewriting
427-
rich syntactic constructs into equivalent code that uses simpler syntactic contructs.
426+
great for programmers. For source code analyzers, however, this leads to additional work as they need to understand the shorthand notation as well as the long form. To make analysis easier, CodeQL automatically "desugars" Ruby code, effectively rewriting
427+
rich syntactic constructs into equivalent code that uses simpler syntactic constructs.
428428

429429
For example, supposing that ``x`` is an object with an attribute ``foo``, the assignment::
430430

@@ -439,7 +439,7 @@ In other words, there is effectively a call to the SetterMethodCall_ ``foo=`` on
439439

440440
In CodeQL, this is implemented by synthesizing AstNode_ instances corresponding to this desugared version of the code.
441441

442-
Note that both the original AssignExpr_ and the desugared SetterMethodCall_ versions are both available to CodeQL queries, and it is usually not necessary to be aware of any desugaring that may take place. However, if a codebase explicitly uses ``x.foo=(y)`` SetterMethodCall_ syntax, then this will not be found by a query for AssignExpr_ instances.
442+
Note that the original AssignExpr_ and the desugared SetterMethodCall_ versions are both available to use in CodeQL queries, and you do not usually need to be aware of any desugaring that may take place. However, if a codebase explicitly uses ``x.foo=(y)`` SetterMethodCall_ syntax, you cannot find this syntax by searching for instances of AssignExpr_ .
443443

444444
Other synthesized AstNode_ instances exist, see the isSynthesized_ and getDesugared_ predicates for details.
445445

0 commit comments

Comments
 (0)