You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Certain Ruby language features are shorthands for common operations that could also be expressed in other, more verbose, forms.
425
425
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.
428
428
429
429
For example, supposing that ``x`` is an object with an attribute ``foo``, the assignment::
430
430
@@ -439,7 +439,7 @@ In other words, there is effectively a call to the SetterMethodCall_ ``foo=`` on
439
439
440
440
In CodeQL, this is implemented by synthesizing AstNode_ instances corresponding to this desugared version of the code.
441
441
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_ .
443
443
444
444
Other synthesized AstNode_ instances exist, see the isSynthesized_ and getDesugared_ predicates for details.
0 commit comments