Skip to content

Commit 583358b

Browse files
authored
Merge pull request #911 from markshannon/python-add-special-operation
Python: Add 'special operation' pseudo-expression type
2 parents 8c5b495 + 465f42e commit 583358b

File tree

5 files changed

+1985
-3
lines changed

5 files changed

+1985
-3
lines changed

python/ql/src/semmlecode.python.dbscheme

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,11 @@ py_extracted_version(int module : @py_Module ref,
431431
/* <Field> Slice.stop = 3, expr */
432432
/* <Field> Slice.step = 4, expr */
433433

434+
/* <Field> SpecialOperation.location = 0, location */
435+
/* <Field> SpecialOperation.parenthesised = 1, bool */
436+
/* <Field> SpecialOperation.name = 2, str */
437+
/* <Field> SpecialOperation.arguments = 3, expr_list */
438+
434439
/* <Field> Starred.location = 0, location */
435440
/* <Field> Starred.parenthesised = 1, bool */
436441
/* <Field> Starred.value = 2, expr */
@@ -718,7 +723,8 @@ case @py_expr.kind of
718723
| 34 = @py_Await
719724
| 35 = @py_Fstring
720725
| 36 = @py_FormattedValue
721-
| 37 = @py_AssignExpr;
726+
| 37 = @py_AssignExpr
727+
| 38 = @py_SpecialOperation;
722728

723729
case @py_expr_context.kind of
724730
0 = @py_AugLoad
@@ -789,7 +795,7 @@ case @py_unaryop.kind of
789795

790796
@py_expr_context_parent = @py_Attribute | @py_List | @py_Name | @py_PlaceHolder | @py_Starred | @py_Subscript | @py_TemplateDottedNotation | @py_Tuple;
791797

792-
@py_expr_list_parent = @py_Assign | @py_BoolExpr | @py_Call | @py_ClassExpr | @py_Compare | @py_Delete | @py_Fstring | @py_Function | @py_List | @py_Print | @py_Set | @py_Tuple | @py_arguments | @py_comprehension;
798+
@py_expr_list_parent = @py_Assign | @py_BoolExpr | @py_Call | @py_ClassExpr | @py_Compare | @py_Delete | @py_Fstring | @py_Function | @py_List | @py_Print | @py_Set | @py_SpecialOperation | @py_Tuple | @py_arguments | @py_comprehension;
793799

794800
@py_expr_or_stmt = @py_expr | @py_stmt;
795801

@@ -805,7 +811,7 @@ case @py_unaryop.kind of
805811

806812
@py_str_list_parent = @py_Global | @py_Nonlocal;
807813

808-
@py_str_parent = @py_Attribute | @py_Class | @py_ClassExpr | @py_FormattedValue | @py_Function | @py_FunctionExpr | @py_ImportExpr | @py_ImportMember | @py_Module | @py_Str | @py_StringPart | @py_TemplateDottedNotation | @py_keyword | @py_str_list;
814+
@py_str_parent = @py_Attribute | @py_Class | @py_ClassExpr | @py_FormattedValue | @py_Function | @py_FunctionExpr | @py_ImportExpr | @py_ImportMember | @py_Module | @py_SpecialOperation | @py_Str | @py_StringPart | @py_TemplateDottedNotation | @py_keyword | @py_str_list;
809815

810816
@py_variable_parent = @py_Name | @py_PlaceHolder;
811817

python/ql/src/semmlecode.python.dbscheme.stats

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@
324324
<v>200</v>
325325
</e>
326326
<e>
327+
<k>@py_SpecialOperation</k>
328+
<v>100</v>
329+
</e>
330+
<e>
327331
<k>@py_expr_context</k>
328332
<v>1140675</v>
329333
</e>

0 commit comments

Comments
 (0)