mirror of
https://github.com/github/codeql.git
synced 2026-04-15 03:54:02 +02:00
Python: Add parser support for lazy imports
As defined in PEP-810. We implement this in much the same way as how we handle `async` annotations currently. The relevant nodes get an `is_lazy` field that defaults to being false.
This commit is contained in:
@@ -1777,6 +1777,13 @@
|
||||
|
||||
attr (@importfrom.importexpr) level = level
|
||||
}
|
||||
; Set is_lazy for lazy import statements (PEP 810)
|
||||
[
|
||||
(import_statement is_lazy: _)
|
||||
(import_from_statement is_lazy: _)
|
||||
] @lazy_import
|
||||
{ attr (@lazy_import.node) is_lazy = #true }
|
||||
|
||||
;;;;;; End of Import (`from ... import ...`)
|
||||
|
||||
;;;;;; Raise (`raise ...`)
|
||||
|
||||
Reference in New Issue
Block a user