mirror of
https://github.com/github/codeql.git
synced 2026-04-15 12:04:07 +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:
@@ -109,6 +109,7 @@ module.exports = grammar({
|
||||
),
|
||||
|
||||
import_statement: $ => seq(
|
||||
optional(field('is_lazy', 'lazy')),
|
||||
'import',
|
||||
$._import_list
|
||||
),
|
||||
@@ -131,6 +132,7 @@ module.exports = grammar({
|
||||
),
|
||||
|
||||
import_from_statement: $ => seq(
|
||||
optional(field('is_lazy', 'lazy')),
|
||||
'from',
|
||||
field('module_name', choice(
|
||||
$.relative_import,
|
||||
@@ -1228,6 +1230,7 @@ module.exports = grammar({
|
||||
'await',
|
||||
'match',
|
||||
'type',
|
||||
'lazy',
|
||||
),
|
||||
$.identifier
|
||||
)),
|
||||
|
||||
Reference in New Issue
Block a user