mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
520 lines
60 KiB
ReStructuredText
520 lines
60 KiB
ReStructuredText
.. _abstract-syntax-tree-classes-for-working-with-go-programs:
|
|
|
|
Abstract syntax tree classes for working with Go programs
|
|
=========================================================
|
|
|
|
CodeQL has a large selection of classes for representing the abstract syntax tree of Go programs.
|
|
|
|
.. include:: ../reusables/abstract-syntax-tree.rst
|
|
|
|
Statement classes
|
|
-----------------
|
|
|
|
This table lists all subclasses of Stmt_.
|
|
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Statement syntax | CodeQL class | Superclasses | Remarks |
|
|
+===============================================================================+=======================+==================================+===================================================+
|
|
| ``;`` | EmptyStmt_ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ | ExprStmt_ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``{`` Stmt_ ``...`` ``}`` | BlockStmt_ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``if`` Expr_ BlockStmt_ | IfStmt_ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| ``if`` Expr_ BlockStmt_ ``else`` Stmt_ | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| ``if`` Stmt_\ ``;`` Expr_ BlockStmt_ | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``for`` Expr_ BlockStmt_ | ForStmt_ | LoopStmt_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| ``for`` Stmt_\ ``;`` Expr_\ ``;`` Stmt_ BlockStmt_ | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``for`` Expr_ ``...`` ``=`` ``range`` Expr_ BlockStmt_ | RangeStmt_ | LoopStmt_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``switch`` Expr_ ``{`` CaseClause_ ``...`` ``}`` | ExpressionSwitchStmt_ | SwitchStmt_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| ``switch`` Stmt_\ ``;`` Expr_ ``{`` CaseClause_ ``...`` ``}`` | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``switch`` Expr_\ ``.(type)`` ``{`` CaseClause_ ``...`` ``}`` | TypeSwitchStmt_ | SwitchStmt_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| ``switch`` SimpleAssignStmt_\ ``.(type)`` ``{`` CaseClause_ ``...`` ``}`` | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| ``switch`` Stmt_\ ``;`` Expr_\ ``.(type)`` ``{`` CaseClause_ ``...`` ``}`` | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``select`` ``{`` CommClause_ ``...`` ``}`` | SelectStmt_ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``return`` | ReturnStmt_ | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``break`` | BreakStmt_ | BranchStmt_ | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``continue`` | ContinueStmt_ | BranchStmt_ | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``goto`` LabelName_ | GotoStmt_ | BranchStmt_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``fallthrough`` | FallthroughStmt_ | BranchStmt_ | can only occur as final non-empty child of |
|
|
| | | | a CaseClause_ in an ExpressionSwitchStmt_ |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| LabelName_\ ``:`` Stmt_ | LabeledStmt_ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``var`` VariableName_ TypeName_ | DeclStmt_ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| ``const`` VariableName_ ``=`` Expr_ | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| ``type`` TypeName_ TypeExpr_ | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| ``type`` TypeName_ ``=`` TypeExpr_ | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``...`` ``=`` Expr_ ``...`` | AssignStmt_ | SimpleAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| VariableName_ ``...`` ``:=`` Expr_ ``...`` | DefineStmt_ | SimpleAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``+=`` Expr_ | AddAssignStmt_ | CompoundAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``-=`` Expr_ | SubAssignStmt_ | CompoundAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``*=`` Expr_ | MulAssignStmt_ | CompoundAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``/=`` Expr_ | QuoAssignStmt_ | CompoundAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``%=`` Expr_ | RemAssignStmt_ | CompoundAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``*=`` Expr_ | MulAssignStmt_ | CompoundAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``&=`` Expr_ | AndAssignStmt_ | CompoundAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``|=`` Expr_ | OrAssignStmt_ | CompoundAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``^=`` Expr_ | XorAssignStmt_ | CompoundAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``<<=`` Expr_ | ShlAssignStmt_ | CompoundAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``>>=`` Expr_ | ShrAssignStmt_ | CompoundAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``&^=`` Expr_ | AndNotAssignStmt_ | CompoundAssignStmt_, Assignment_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``++`` | IncStmt_ | IncDecStmt_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``--`` | DecStmt_ | IncDecStmt_ | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``go`` CallExpr_ | GoStmt_ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``defer`` CallExpr_ | DeferStmt_ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``<-`` Expr_ | SendStmt_ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``case`` Expr_ ``...``\ ``:`` Stmt_ ``...`` | CaseClause_ | | can only occur as child of a SwitchStmt_ |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| ``case`` TypeExpr_ ``...``\ ``:`` Stmt_ ``...`` | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| ``default:`` Stmt_ ``...`` | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| ``case`` SendStmt_\ ``:`` Stmt_ ``...`` | CommClause_ | | can only occur as child of a SelectStmt_ |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| ``case`` RecvStmt_\ ``:`` Stmt_ ``...`` | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| ``default:`` Stmt_ ``...`` | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| Expr_ ``...`` ``=`` RecvExpr_ | RecvStmt_ | | can only occur as child of a CommClause_ |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+ | | |
|
|
| VariableName_ ``...`` ``:=`` RecvExpr_ | | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
| (anything unparseable) | BadStmt_ | | |
|
|
| | | | |
|
|
+-------------------------------------------------------------------------------+-----------------------+----------------------------------+---------------------------------------------------+
|
|
|
|
Expression classes
|
|
------------------
|
|
|
|
There are many expression classes, so we present them by category.
|
|
All classes in this section are subclasses of
|
|
Expr_.
|
|
|
|
Literals
|
|
~~~~~~~~
|
|
|
|
+-----------------------------------------+--------------+---------------+
|
|
| Expression syntax example | CodeQL class | Superclass |
|
|
+=========================================+==============+===============+
|
|
| ``23`` | IntLit_ | BasicLit_ |
|
|
+-----------------------------------------+--------------+---------------+
|
|
| ``4.2`` | FloatLit_ | BasicLit_ |
|
|
+-----------------------------------------+--------------+---------------+
|
|
| ``4.2 + 2.7i`` | ImagLit_ | BasicLit_ |
|
|
+-----------------------------------------+--------------+---------------+
|
|
| ``'a'`` | CharLit_ | BasicLit_ |
|
|
+-----------------------------------------+--------------+---------------+
|
|
| ``"Hello"`` | StringLit_ | BasicLit_ |
|
|
+-----------------------------------------+--------------+---------------+
|
|
| ``func(x, y int) int { return x + y }`` | FuncLit_ | FuncDef_ |
|
|
+-----------------------------------------+--------------+---------------+
|
|
| ``map[string]int{"A": 1, "B": 2}`` | MapLit_ | CompositeLit_ |
|
|
+-----------------------------------------+--------------+---------------+
|
|
| ``Point3D{0.5, -0.5, 0.5}`` | StructLit_ | CompositeLit_ |
|
|
+-----------------------------------------+--------------+---------------+
|
|
|
|
Unary expressions
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
All classes in this subsection are subclasses of
|
|
UnaryExpr_.
|
|
|
|
+-------------------+-----------------+----------------------+
|
|
| Expression syntax | CodeQL class | Superclasses |
|
|
+===================+=================+======================+
|
|
| ``+``\ Expr_ | PlusExpr_ | ArithmeticUnaryExpr_ |
|
|
+-------------------+-----------------+----------------------+
|
|
| ``-``\ Expr_ | MinusExpr_ | ArithmeticUnaryExpr_ |
|
|
+-------------------+-----------------+----------------------+
|
|
| ``!``\ Expr_ | NotExpr_ | LogicalUnaryExpr_ |
|
|
+-------------------+-----------------+----------------------+
|
|
| ``^``\ Expr_ | ComplementExpr_ | BitwiseUnaryExpr_ |
|
|
+-------------------+-----------------+----------------------+
|
|
| ``&``\ Expr_ | AddressExpr_ | |
|
|
+-------------------+-----------------+----------------------+
|
|
| ``<-``\ Expr_ | RecvExpr_ | |
|
|
+-------------------+-----------------+----------------------+
|
|
|
|
Binary expressions
|
|
~~~~~~~~~~~~~~~~~~
|
|
|
|
All classes in this subsection are subclasses of
|
|
BinaryExpr_.
|
|
|
|
+--------------------+--------------+---------------------------+
|
|
| Expression syntax | CodeQL class | Superclasses |
|
|
+====================+==============+===========================+
|
|
| Expr_ ``*`` Expr_ | MulExpr_ | ArithmeticBinaryExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``/`` Expr_ | QuoExpr_ | ArithmeticBinaryExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``%`` Expr_ | RemExpr_ | ArithmeticBinaryExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``+`` Expr_ | AddExpr_ | ArithmeticBinaryExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``-`` Expr_ | SubExpr_ | ArithmeticBinaryExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``<<`` Expr_ | ShlExpr_ | ShiftExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``>>`` Expr_ | ShrExpr_ | ShiftExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``&&`` Expr_ | LandExpr_ | LogicalBinaryExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``||`` Expr_ | LorExpr_ | LogicalBinaryExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``<`` Expr_ | LssExpr_ | RelationalComparisonExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``>`` Expr_ | GtrExpr_ | RelationalComparisonExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``<=`` Expr_ | LeqExpr_ | RelationalComparisonExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``>=`` Expr_ | GeqExpr_ | RelationalComparisonExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``==`` Expr_ | EqlExpr_ | EqualityTestExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``!=`` Expr_ | NeqExpr_ | EqualityTestExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``&`` Expr_ | AndExpr_ | BitwiseBinaryExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``|`` Expr_ | OrExpr_ | BitwiseBinaryExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``^`` Expr_ | XorExpr_ | BitwiseBinaryExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
| Expr_ ``&^`` Expr_ | AndNotExpr_ | BitwiseBinaryExpr_ |
|
|
+--------------------+--------------+---------------------------+
|
|
|
|
Type expressions
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
These classes represent different expressions for types. They do
|
|
not have a common superclass.
|
|
|
|
+-----------------------------------------+-----------------------+---------------+
|
|
| Expression syntax | CodeQL class | Superclasses |
|
|
+=========================================+=======================+===============+
|
|
| ``[``\ Expr_\ ``]`` TypeExpr_ | ArrayTypeExpr_ | |
|
|
+-----------------------------------------+-----------------------+---------------+
|
|
| ``struct { ... }`` | StructTypeExpr_ | |
|
|
+-----------------------------------------+-----------------------+---------------+
|
|
| ``func`` FunctionName_\ ``(...) (...)`` | FuncTypeExpr_ | |
|
|
+-----------------------------------------+-----------------------+---------------+
|
|
| ``interface { ... }`` | InterfaceTypeExpr_ | |
|
|
+-----------------------------------------+-----------------------+---------------+
|
|
| ``map[``\ TypeExpr_\ ``]``\ TypeExpr_ | MapTypeExpr_ | |
|
|
+-----------------------------------------+-----------------------+---------------+
|
|
| ``chan<-`` TypeExpr_ | SendChanTypeExpr_ | ChanTypeExpr_ |
|
|
+-----------------------------------------+-----------------------+---------------+
|
|
| ``<-chan`` TypeExpr_ | RecvChanTypeExpr_ | ChanTypeExpr_ |
|
|
+-----------------------------------------+-----------------------+---------------+
|
|
| ``chan`` TypeExpr_ | SendRecvChanTypeExpr_ | ChanTypeExpr_ |
|
|
+-----------------------------------------+-----------------------+---------------+
|
|
|
|
Name expressions
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
All classes in this subsection are subclasses of
|
|
Name_.
|
|
|
|
The following classes relate to the structure of the name.
|
|
|
|
+-----------------------+----------------+---------------+
|
|
| Expression syntax | CodeQL class | Superclasses |
|
|
+=======================+================+===============+
|
|
| Ident_ | SimpleName_ | Ident_ |
|
|
+-----------------------+----------------+---------------+
|
|
| Ident_\ ``.``\ Ident_ | QualifiedName_ | SelectorExpr_ |
|
|
+-----------------------+----------------+---------------+
|
|
|
|
The following classes relate to what sort of entity the name refers to.
|
|
|
|
|
|
- PackageName_
|
|
- TypeName_
|
|
- LabelName_
|
|
- ValueName_
|
|
|
|
- ConstantName_
|
|
- VariableName_
|
|
- FunctionName_
|
|
|
|
Miscellaneous
|
|
~~~~~~~~~~~~~
|
|
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
| Expression syntax | CodeQL class | Superclasses | Remarks |
|
|
+========================================================+=================+=======================+=======================================================+
|
|
| ``foo`` | Ident_ | | |
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
| ``_`` | BlankIdent_ | | |
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
| ``...`` | Ellipsis_ | | |
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
| ``(``\ Expr_\ ``)`` | ParenExpr_ | | |
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
| Ident_\ ``.``\ Ident_ | SelectorExpr_ | | |
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
| Expr_\ ``[``\ Expr_\ ``]`` | IndexExpr_ | | |
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
| Expr_\ ``[``\ Expr_\ ``:``\ Expr_\ ``:``\ Expr_\ ``]`` | SliceExpr_ | | |
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
| Expr_\ ``.(``\ TypeExpr_\ ``)`` | TypeAssertExpr_ | | |
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
| ``*``\ Expr_ | StarExpr_ | | can be a ValueExpr_ or TypeExpr_ depending on context |
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
| Expr_\ ``:`` Expr_ | KeyValueExpr_ | | |
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
| TypeExpr_\ ``(``\ Expr_\ ``)`` | ConversionExpr_ | CallOrConversionExpr_ | |
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
| Expr_\ ``(...)`` | CallExpr_ | CallOrConversionExpr_ | |
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
| (anything unparseable) | BadExpr_ | | |
|
|
+--------------------------------------------------------+-----------------+-----------------------+-------------------------------------------------------+
|
|
|
|
The following classes organize expressions by the kind of entity they refer to.
|
|
|
|
+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| CodeQL class | Explanation |
|
|
+================+===================================================================================================================================================================+
|
|
| TypeExpr_ | an expression that denotes a type |
|
|
+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| ReferenceExpr_ | an expression that refers to a variable, a constant, a function, a field, or an element of an array or a slice |
|
|
+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| ValueExpr_ | an expression that can be evaluated to a value (as opposed to expressions that refer to a package, a type, or a statement label). This generalizes ReferenceExpr_ |
|
|
+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
|
|
Further reading
|
|
---------------
|
|
|
|
.. include:: ../reusables/go-further-reading.rst
|
|
.. include:: ../reusables/codeql-ref-tools-further-reading.rst
|
|
|
|
.. Links used in tables. For information about using these links, see
|
|
https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#hyperlinks.
|
|
|
|
.. _Stmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$Stmt.html
|
|
.. _Expr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$Expr.html
|
|
.. _IntLit: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$IntLit.html
|
|
.. _BasicLit: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$BasicLit.html
|
|
.. _FloatLit: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$FloatLit.html
|
|
.. _ImagLit: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ImagLit.html
|
|
.. _CharLit: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$CharLit.html
|
|
.. _StringLit: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$StringLit.html
|
|
.. _FuncLit: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$FuncLit.html
|
|
.. _FuncDef: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Decls.qll/type.Decls$FuncDef.html
|
|
.. _MapLit: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$MapLit.html
|
|
.. _CompositeLit: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$CompositeLit.html
|
|
.. _StructLit: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$StructLit.html
|
|
.. _UnaryExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$UnaryExpr.html
|
|
.. _PlusExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$PlusExpr.html
|
|
.. _ArithmeticUnaryExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ArithmeticUnaryExpr.html
|
|
.. _MinusExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$MinusExpr.html
|
|
.. _NotExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$NotExpr.html
|
|
.. _LogicalUnaryExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$LogicalUnaryExpr.html
|
|
.. _ComplementExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ComplementExpr.html
|
|
.. _BitwiseUnaryExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$BitwiseUnaryExpr.html
|
|
.. _AddressExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$AddressExpr.html
|
|
.. _RecvExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$RecvExpr.html
|
|
.. _BinaryExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$BinaryExpr.html
|
|
.. _MulExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$MulExpr.html
|
|
.. _ArithmeticBinaryExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ArithmeticBinaryExpr.html
|
|
.. _QuoExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$QuoExpr.html
|
|
.. _RemExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$RemExpr.html
|
|
.. _AddExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$AddExpr.html
|
|
.. _SubExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$SubExpr.html
|
|
.. _ShlExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ShlExpr.html
|
|
.. _ShiftExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ShiftExpr.html
|
|
.. _ShrExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ShrExpr.html
|
|
.. _LandExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$LandExpr.html
|
|
.. _LogicalBinaryExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$LogicalBinaryExpr.html
|
|
.. _LorExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$LorExpr.html
|
|
.. _LssExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$LssExpr.html
|
|
.. _RelationalComparisonExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$RelationalComparisonExpr.html
|
|
.. _GtrExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$GtrExpr.html
|
|
.. _LeqExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$LeqExpr.html
|
|
.. _GeqExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$GeqExpr.html
|
|
.. _EqlExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$EqlExpr.html
|
|
.. _EqualityTestExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$EqualityTestExpr.html
|
|
.. _NeqExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$NeqExpr.html
|
|
.. _AndExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$AndExpr.html
|
|
.. _BitwiseBinaryExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$BitwiseBinaryExpr.html
|
|
.. _OrExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$OrExpr.html
|
|
.. _XorExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$XorExpr.html
|
|
.. _AndNotExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$AndNotExpr.html
|
|
.. _TypeExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$TypeExpr.html
|
|
.. _ArrayTypeExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ArrayTypeExpr.html
|
|
.. _StructTypeExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$StructTypeExpr.html
|
|
.. _FunctionName: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$FunctionName.html
|
|
.. _FuncTypeExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$FuncTypeExpr.html
|
|
.. _InterfaceTypeExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$InterfaceTypeExpr.html
|
|
.. _MapTypeExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$MapTypeExpr.html
|
|
.. _SendChanTypeExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$SendChanTypeExpr.html
|
|
.. _ChanTypeExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ChanTypeExpr.html
|
|
.. _RecvChanTypeExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$RecvChanTypeExpr.html
|
|
.. _SendRecvChanTypeExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$SendRecvChanTypeExpr.html
|
|
.. _Name: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$Name.html
|
|
.. _Ident: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$Ident.html
|
|
.. _SimpleName: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$SimpleName.html
|
|
.. _QualifiedName: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$QualifiedName.html
|
|
.. _SelectorExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$SelectorExpr.html
|
|
.. _PackageName: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$PackageName.html
|
|
.. _TypeName: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$TypeName.html
|
|
.. _LabelName: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$LabelName.html
|
|
.. _ValueName: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ValueName.html
|
|
.. _ConstantName: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ConstantName.html
|
|
.. _VariableName: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$VariableName.html
|
|
.. _BlankIdent: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$BlankIdent.html
|
|
.. _Ellipsis: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$Ellipsis.html
|
|
.. _ParenExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ParenExpr.html
|
|
.. _IndexExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$IndexExpr.html
|
|
.. _SliceExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$SliceExpr.html
|
|
.. _TypeAssertExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$TypeAssertExpr.html
|
|
.. _StarExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$StarExpr.html
|
|
.. _ValueExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ValueExpr.html
|
|
.. _KeyValueExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$KeyValueExpr.html
|
|
.. _ConversionExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ConversionExpr.html
|
|
.. _CallOrConversionExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$CallOrConversionExpr.html
|
|
.. _CallExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$CallExpr.html
|
|
.. _BadExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$BadExpr.html
|
|
.. _ReferenceExpr: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Expr.qll/type.Expr$ReferenceExpr.html
|
|
.. _EmptyStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$EmptyStmt.html
|
|
.. _ExprStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$ExprStmt.html
|
|
.. _BlockStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$BlockStmt.html
|
|
.. _IfStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$IfStmt.html
|
|
.. _ForStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$ForStmt.html
|
|
.. _LoopStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$LoopStmt.html
|
|
.. _RangeStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$RangeStmt.html
|
|
.. _ExpressionSwitchStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$ExpressionSwitchStmt.html
|
|
.. _SwitchStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$SwitchStmt.html
|
|
.. _CaseClause: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$CaseClause.html
|
|
.. _TypeSwitchStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$TypeSwitchStmt.html
|
|
.. _SimpleAssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$SimpleAssignStmt.html
|
|
.. _CommClause: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$CommClause.html
|
|
.. _SelectStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$SelectStmt.html
|
|
.. _ReturnStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$ReturnStmt.html
|
|
.. _BreakStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$BreakStmt.html
|
|
.. _BranchStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$BranchStmt.html
|
|
.. _ContinueStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$ContinueStmt.html
|
|
.. _GotoStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$GotoStmt.html
|
|
.. _FallthroughStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$FallthroughStmt.html
|
|
.. _LabeledStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$LabeledStmt.html
|
|
.. _DeclStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$DeclStmt.html
|
|
.. _AssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$AssignStmt.html
|
|
.. _Assignment: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$Assignment.html
|
|
.. _DefineStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$DefineStmt.html
|
|
.. _AddAssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$AddAssignStmt.html
|
|
.. _CompoundAssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$CompoundAssignStmt.html
|
|
.. _SubAssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$SubAssignStmt.html
|
|
.. _MulAssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$MulAssignStmt.html
|
|
.. _QuoAssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$QuoAssignStmt.html
|
|
.. _RemAssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$RemAssignStmt.html
|
|
.. _AndAssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$AndAssignStmt.html
|
|
.. _OrAssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$OrAssignStmt.html
|
|
.. _XorAssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$XorAssignStmt.html
|
|
.. _ShlAssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$ShlAssignStmt.html
|
|
.. _ShrAssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$ShrAssignStmt.html
|
|
.. _AndNotAssignStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$AndNotAssignStmt.html
|
|
.. _IncStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$IncStmt.html
|
|
.. _IncDecStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$IncDecStmt.html
|
|
.. _DecStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$DecStmt.html
|
|
.. _GoStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$GoStmt.html
|
|
.. _DeferStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$DeferStmt.html
|
|
.. _SendStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$SendStmt.html
|
|
.. _RecvStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$RecvStmt.html
|
|
.. _BadStmt: https://codeql.github.com/codeql-standard-libraries/go/semmle/go/Stmt.qll/type.Stmt$BadStmt.html
|