From 913db460b2a5eb34c4d35daacca237f62c124012 Mon Sep 17 00:00:00 2001 From: Taus Brock-Nannestad Date: Thu, 20 Feb 2020 18:05:37 +0100 Subject: [PATCH] Python: Add AST support for special operations. These have the form `$name(arg1, arg2, ...)` and currently have no semantics. They may be useful for testing purposes, however. --- python/ql/src/semmle/python/AstGenerated.qll | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/python/ql/src/semmle/python/AstGenerated.qll b/python/ql/src/semmle/python/AstGenerated.qll index fc79a01d8b74..6832b3f2da69 100644 --- a/python/ql/src/semmle/python/AstGenerated.qll +++ b/python/ql/src/semmle/python/AstGenerated.qll @@ -1,3 +1,8 @@ +/* + * This library file is auto-generated by 'semmle/query_gen.py'. + * WARNING: Any modifications to this file will be lost. + * Relations can be changed by modifying master.py. + */ import python library class Add_ extends @py_Add, Operator { @@ -1781,6 +1786,37 @@ library class Slice_ extends @py_Slice, Expr { } +library class SpecialOperation_ extends @py_SpecialOperation, Expr { + + + /** Gets the name of this special operation. */ + string getName() { + py_strs(result, this, 2) + } + + + /** Gets the arguments of this special operation. */ + ExprList getArguments() { + py_expr_lists(result, this, 3) + } + + + /** Gets the nth argument of this special operation. */ + Expr getArgument(int index) { + result = this.getArguments().getItem(index) + } + + /** Gets an argument of this special operation. */ + Expr getAnArgument() { + result = this.getArguments().getAnItem() + } + + override string toString() { + result = "SpecialOperation" + } + +} + library class Starred_ extends @py_Starred, Expr {